Created
May 23, 2012 18:08
-
-
Save cmar/2776742 to your computer and use it in GitHub Desktop.
TaxCloud Test Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "savon" | |
cart_id = rand(9999) | |
order_id = rand(9999) | |
api_login_id = '1B3D4440' | |
api_key = '77CE20A3-0805-4A3D-BF36-AD7FC4D39BA0' | |
# create a client for your SOAP service | |
client = Savon::Client.new("https://api.taxcloud.net/1.0/?wsdl") | |
puts client.wsdl.soap_actions | |
response = client.request(:ping) do | |
soap.body = { 'apiLoginID' => api_login_id, | |
'apiKey' => api_key | |
} | |
end | |
puts response.body | |
response = client.request(:lookup) do | |
soap.body = { 'apiLoginID' => api_login_id, | |
'apiKey' => api_key, | |
'customerID' => '1', | |
'cartID' => cart_id, | |
'cartItems' => [ | |
{'CartItem' => { | |
'Index' => 1, | |
'ItemID' => 'SKU-001', | |
'TIC' => 0, | |
'Price' => 544.99, | |
'Qty' => 3 }}, | |
{'CartItem' => { | |
'Index' => 2, | |
'ItemID' => 'SHIPPING', | |
'TIC' => 11010, | |
'Price' => 10.00, | |
'Qty' => 1 }} | |
], | |
'origin' => { | |
'Address1' => '7735 OLD GEORGETOWN RD STE 510', | |
'Address2' => '', | |
'City' => 'Bethesda', | |
'State' => 'MD', | |
'Zip5' => '20814', | |
'Zip4' => '' | |
}, | |
'destination' => { | |
'Address1' => '1 Infinite Loop', | |
'Address2' => '', | |
'City' => 'Cupertino', | |
'State' => 'CA', | |
'Zip5' => '95014', | |
'Zip4' => '' | |
} | |
} | |
puts soap.body | |
end | |
puts response.body | |
response = client.request(:authorized_with_capture) do | |
soap.body = { 'apiLoginID' => api_login_id, | |
'apiKey' => api_key, | |
'customerID' => '1', | |
'cartID' => cart_id, | |
#'cartItems' => [ | |
# 'CartItem' => { 'Index' => 1, | |
# 'ItemID' => 'SKU-001', | |
# 'Qty' => 3 } | |
#], | |
'orderID' => order_id, | |
'dateAuthorized' => DateTime.now, | |
'dateCaptured' => DateTime.now | |
} | |
end | |
puts response.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment