Skip to content

Instantly share code, notes, and snippets.

@magedmakled
Created May 20, 2014 14:32
Show Gist options
  • Save magedmakled/b6843bd5b5b9963a3018 to your computer and use it in GitHub Desktop.
Save magedmakled/b6843bd5b5b9963a3018 to your computer and use it in GitHub Desktop.
Litle Gateway Ruby Legal Entity Creation
xml = Builder::XmlMarkup.new; false
xml.instruct! :xml, :version=>"1.0", :encoding => "UTF-8", :standalone=> "yes"
xml.legalEntityCreateRequest "xmlns" => "http://psp.litle.com/api/merchant/onboard" do
xml.legalEntityName("Legal Entity Name")
xml.legalEntityType("LIMITED_LIABILITY_COMPANY")
xml.doingBusinessAs("Alternate Business Name")
xml.taxId("12345")
xml.contactPhone("7817659800")
xml.annualCreditCardSalesVolume("80000000")
xml.hasAcceptedCreditCards("true")
xml.address do
xml.streetAddress1("914 Chelmsford St")
xml.streetAddress2("Street Address 2")
xml.city("Fridley")
xml.stateProvince("MN")
xml.postalCode("55432")
xml.countryCode("USA")
end
xml.principals do
xml.principal do
xml.firstName("principal First Name")
xml.lastName("principal Last")
xml.emailAddress("principal@gmail.com")
xml.ssn("123459876")
xml.contactPhone("7817659800")
xml.dateOfBirth("1980-10-12")
xml.driversLicense("892327409832")
xml.driversLicenseState("MA")
xml.address do
xml.streetAddress1("principal Street Address 1")
xml.streetAddress2("principal Street Address 2")
xml.city("Minneapols")
xml.stateProvince("MN")
xml.postalCode("55406")
xml.countryCode("USA")
end
end
end
end
header = {"Authorization" => "Basic bWVyY2hhbnQxOnBhc3N3b3Jk=", "Content-Type" => "application/com.litle.psp-v8+xml", "Accept" => "application/com.litle.psp-v8+xml"}
uri = URI.parse("https://www.testlitle.com/sandbox/legalentity")
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.request_uri)
req.body = xml.target!
req.initialize_http_header(header)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.request(req)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment