authorizenetsample 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/CustomerProfiles/create-customer-payment-profile.rb +62 -0
- data/lib/CustomerProfiles/create-customer-profile-from-transaction.rb +51 -0
- data/lib/CustomerProfiles/create-customer-profile.rb +92 -0
- data/lib/CustomerProfiles/create-customer-shipping-address.rb +31 -0
- data/lib/CustomerProfiles/delete-customer-payment-profile.rb +32 -0
- data/lib/CustomerProfiles/delete-customer-profile.rb +31 -0
- data/lib/CustomerProfiles/delete-customer-shipping-address.rb +33 -0
- data/lib/CustomerProfiles/get-accept-customer-profile-page.rb +23 -5
- data/lib/CustomerProfiles/get-customer-payment-profile-list.rb +54 -0
- data/lib/CustomerProfiles/get-customer-payment-profile.rb +40 -0
- data/lib/CustomerProfiles/get-customer-profile-ids.rb +45 -0
- data/lib/CustomerProfiles/get-customer-profile.rb +39 -3
- data/lib/CustomerProfiles/get-customer-shipping-address.rb +41 -0
- data/lib/CustomerProfiles/update-customer-payment-profile.rb +37 -0
- data/lib/CustomerProfiles/update-customer-profile.rb +37 -0
- data/lib/CustomerProfiles/update-customer-shipping-address.rb +37 -0
- data/lib/CustomerProfiles/validate-customer-payment-profile.rb +37 -0
- data/lib/FraudManagement/approve-or-decline-held-transaction.rb +57 -0
- data/lib/FraudManagement/get-held-transaction-list.rb +47 -0
- data/lib/MobileInAppTransactions/create-an-accept-transaction.rb +59 -0
- data/lib/MobileInAppTransactions/create-an-android-pay-transaction.rb +59 -0
- data/lib/MobileInAppTransactions/create-an-apple-pay-transaction.rb +58 -0
- data/lib/PayPalExpressCheckout/authorization-and-capture-continued.rb +69 -0
- data/lib/PayPalExpressCheckout/authorization-and-capture.rb +70 -0
- data/lib/PayPalExpressCheckout/authorization-only-continued.rb +70 -0
- data/lib/PayPalExpressCheckout/authorization-only.rb +71 -0
- data/lib/PayPalExpressCheckout/credit.rb +67 -0
- data/lib/PayPalExpressCheckout/get-details.rb +69 -0
- data/lib/PayPalExpressCheckout/prior-authorization-capture.rb +112 -0
- data/lib/PayPalExpressCheckout/void.rb +113 -0
- data/lib/PaymentTransactions/authorize-credit-card.rb +103 -0
- data/lib/PaymentTransactions/capture-funds-authorized-through-another-channel.rb +60 -0
- data/lib/PaymentTransactions/capture-previously-authorized-amount.rb +104 -0
- data/lib/PaymentTransactions/charge-credit-card.rb +104 -0
- data/lib/PaymentTransactions/charge-customer-profile.rb +61 -0
- data/lib/PaymentTransactions/charge-tokenized-credit-card.rb +60 -0
- data/lib/PaymentTransactions/create-an-accept-payment-transaction.rb +47 -6
- data/lib/PaymentTransactions/credit-bank-account.rb +62 -0
- data/lib/PaymentTransactions/debit-bank-account.rb +64 -0
- data/lib/PaymentTransactions/get-an-accept-payment-page.rb +70 -49
- data/lib/PaymentTransactions/refund-transaction.rb +60 -0
- data/lib/PaymentTransactions/update-split-tender-group.rb +44 -0
- data/lib/PaymentTransactions/void-transaction.rb +103 -0
- data/lib/RecurringBilling/cancel-subscription.rb +36 -0
- data/lib/RecurringBilling/create-subscription-from-customer-profile.rb +52 -0
- data/lib/RecurringBilling/create-subscription.rb +54 -0
- data/lib/RecurringBilling/get-list-of-subscriptions.rb +51 -0
- data/lib/RecurringBilling/get-subscription-status.rb +36 -0
- data/lib/RecurringBilling/get-subscription.rb +42 -0
- data/lib/RecurringBilling/update-subscription.rb +54 -0
- data/lib/TransactionReporting/get-batch-statistics.rb +57 -0
- data/lib/TransactionReporting/get-customer-profile-transaction-list.rb +49 -0
- data/lib/TransactionReporting/get-merchant-details.rb +50 -0
- data/lib/TransactionReporting/get-settled-batch-list.rb +49 -0
- data/lib/TransactionReporting/get-transaction-details.rb +40 -0
- data/lib/TransactionReporting/get-transaction-list.rb +58 -0
- data/lib/TransactionReporting/get-unsettled-transaction-list.rb +48 -0
- data/lib/VisaCheckout/create-visa-checkout-transaction.rb +62 -0
- data/lib/VisaCheckout/decrypt-visa-checkout-data.rb +37 -0
- data/lib/authorize_netsample.rb +21 -0
- data/lib/authorizenetsample.rb +4 -12
- data/lib/credentials.yml +9 -0
- data/lib/spec/sample_code_spec.rb +320 -0
- data/lib/spec/spec.opts +2 -0
- data/lib/spec/spec_helper.rb +10 -0
- data/lib/spec/support/shared_helper.rb +7 -0
- metadata +69 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7ccf3fb246b955178f11584ad602e4013b7b13d
|
4
|
+
data.tar.gz: c73cfe09057a73a046b1652bb036f107f7c27802
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 365aa70390081b4ac59bc62dce7e427086c5009767b4b7bde9b8aaaa4ba8e7a2f5fbdb28ff7e2c5a127fa9ff5e188e6c5642a77fa746d9a463435358233de79f
|
7
|
+
data.tar.gz: fc872550378ef46d2d13898a15c8ed550507ab845a4b0a4ec078d3df4e04a970725760c71d9c9a2d99da12f2c3981f188e710ee1e4fbfe94ed2ed47ceb4a2cd9
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'authorizenet'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
include AuthorizeNet::API
|
7
|
+
|
8
|
+
def create_customer_payment_profile(customerProfileId = '1813343337')
|
9
|
+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
10
|
+
transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
11
|
+
|
12
|
+
# Build the payment object
|
13
|
+
payment = PaymentType.new(CreditCardType.new)
|
14
|
+
payment.creditCard.cardNumber = '4111111111111111'
|
15
|
+
payment.creditCard.expirationDate = '2022-05'
|
16
|
+
|
17
|
+
# Build an address object
|
18
|
+
billTo = CustomerAddressType.new
|
19
|
+
billTo.firstName = "Jerry"
|
20
|
+
billTo.lastName = "Johnson"
|
21
|
+
billTo.company = "Souveniropolis"
|
22
|
+
billTo.address = "14 Main Street"
|
23
|
+
billTo.city = "Pecan Springs"
|
24
|
+
billTo.state = "TX"
|
25
|
+
billTo.zip = "44628"
|
26
|
+
billTo.country = "US"
|
27
|
+
billTo.phoneNumber = "999-999-9999"
|
28
|
+
billTo.faxNumber = "999-999-9999"
|
29
|
+
|
30
|
+
# Use the previously defined payment and billTo objects to
|
31
|
+
# build a payment profile to send with the request
|
32
|
+
paymentProfile = CustomerPaymentProfileType.new
|
33
|
+
paymentProfile.payment = payment
|
34
|
+
paymentProfile.billTo = billTo
|
35
|
+
paymentProfile.defaultPaymentProfile = true
|
36
|
+
|
37
|
+
# Build the request object
|
38
|
+
request = CreateCustomerPaymentProfileRequest.new
|
39
|
+
request.paymentProfile = paymentProfile
|
40
|
+
request.customerProfileId = customerProfileId
|
41
|
+
request.validationMode = ValidationModeEnum::LiveMode
|
42
|
+
|
43
|
+
response = transaction.create_customer_payment_profile(request)
|
44
|
+
|
45
|
+
if response != nil
|
46
|
+
if response.messages.resultCode == MessageTypeEnum::Ok
|
47
|
+
puts "Successfully created a customer payment profile with id: #{response.customerPaymentProfileId}."
|
48
|
+
else
|
49
|
+
puts response.messages.messages[0].code
|
50
|
+
puts response.messages.messages[0].text
|
51
|
+
puts "Failed to create a new customer payment profile."
|
52
|
+
end
|
53
|
+
else
|
54
|
+
puts "Response is null"
|
55
|
+
raise "Failed to create a new customer payment profile."
|
56
|
+
end
|
57
|
+
return response
|
58
|
+
end
|
59
|
+
|
60
|
+
if __FILE__ == $0
|
61
|
+
create_customer_payment_profile()
|
62
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'authorizenet'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
include AuthorizeNet::API
|
7
|
+
|
8
|
+
def create_customer_profile_from_a_transaction(transId = 60031516226)
|
9
|
+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
10
|
+
|
11
|
+
transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
12
|
+
|
13
|
+
|
14
|
+
request = CreateCustomerProfileFromTransactionRequest.new
|
15
|
+
request.transId = transId
|
16
|
+
|
17
|
+
# You can either specify the customer information to create a new customer profile
|
18
|
+
# or, specify an existing customer profile ID to create a new customer payment profile
|
19
|
+
# attached to the existing customer profile. If no profile information is specified,
|
20
|
+
# a new profile will still be created as long as either an ID or email exists in the
|
21
|
+
# original transaction that can be used to identify a new profile.
|
22
|
+
#
|
23
|
+
# To create a new customer profile containing a payment profile with this transaction's
|
24
|
+
# payment information, submit the new profile information in the form of a
|
25
|
+
# customerProfileBaseType object
|
26
|
+
request.customer = CustomerProfileBaseType.new
|
27
|
+
request.customer.merchantCustomerId = "1231232"
|
28
|
+
request.customer.description = "This is a sample customer profile"
|
29
|
+
request.customer.email = "johnsnow@castleblack.com"
|
30
|
+
# -OR- to create a payment profile under an existing customer profile,
|
31
|
+
# just provide the customer Profile ID
|
32
|
+
# customerProfileId = "123343"
|
33
|
+
|
34
|
+
response = transaction.create_customer_profile_from_transaction(request)
|
35
|
+
|
36
|
+
|
37
|
+
if response.messages.resultCode == MessageTypeEnum::Ok
|
38
|
+
puts "Successfully created a customer profile from transaction ID #{transId}"
|
39
|
+
puts "Customer profile ID: #{response.customerProfileId}"
|
40
|
+
puts "New customer payment profile ID: #{response.customerPaymentProfileIdList.numericString[0]}"
|
41
|
+
puts "New customer shipping profile ID (if created): #{response.customerShippingAddressIdList.numericString[0]}"
|
42
|
+
else
|
43
|
+
puts response.messages.messages[0].text
|
44
|
+
raise "Failed to create a customer profile from an existing transaction."
|
45
|
+
end
|
46
|
+
return response
|
47
|
+
end
|
48
|
+
|
49
|
+
if __FILE__ == $0
|
50
|
+
create_customer_profile_from_a_transaction()
|
51
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'authorizenet'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
include AuthorizeNet::API
|
7
|
+
|
8
|
+
def create_customer_profile()
|
9
|
+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
10
|
+
transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
11
|
+
|
12
|
+
# Build the payment object
|
13
|
+
payment = PaymentType.new(CreditCardType.new)
|
14
|
+
payment.creditCard.cardNumber = '4111111111111111'
|
15
|
+
payment.creditCard.expirationDate = '2020-05'
|
16
|
+
|
17
|
+
# Build an address object
|
18
|
+
billTo = CustomerAddressType.new
|
19
|
+
billTo.firstName = "Ellen"
|
20
|
+
billTo.lastName = "Johnson"
|
21
|
+
billTo.company = "Souveniropolis"
|
22
|
+
billTo.address = "14 Main Street"
|
23
|
+
billTo.city = "Pecan Springs"
|
24
|
+
billTo.state = "TX"
|
25
|
+
billTo.zip = "44628"
|
26
|
+
billTo.country = "US"
|
27
|
+
billTo.phoneNumber = "999-999-9999"
|
28
|
+
billTo.faxNumber = "999-999-9999"
|
29
|
+
|
30
|
+
# Use the previously defined payment and billTo objects to
|
31
|
+
# build a payment profile to send with the request
|
32
|
+
paymentProfile = CustomerPaymentProfileType.new
|
33
|
+
paymentProfile.payment = payment
|
34
|
+
paymentProfile.billTo = billTo
|
35
|
+
paymentProfile.defaultPaymentProfile = true
|
36
|
+
|
37
|
+
# Build a shipping address to send with the request
|
38
|
+
shippingAddress = CustomerAddressType.new
|
39
|
+
shippingAddress.firstName = "John"
|
40
|
+
shippingAddress.lastName = "Snow"
|
41
|
+
shippingAddress.company = "Night's Watch, Inc."
|
42
|
+
shippingAddress.address = "Castle Black"
|
43
|
+
shippingAddress.city = "The Wall"
|
44
|
+
shippingAddress.state = "North Westeros"
|
45
|
+
shippingAddress.zip = "99499"
|
46
|
+
shippingAddress.country = "Westeros"
|
47
|
+
shippingAddress.phoneNumber = "999-999-9999"
|
48
|
+
shippingAddress.faxNumber = "999-999-9999"
|
49
|
+
|
50
|
+
# Build the request object
|
51
|
+
request = CreateCustomerProfileRequest.new
|
52
|
+
# Build the profile object containing the main information about the customer profile
|
53
|
+
request.profile = CustomerProfileType.new
|
54
|
+
request.profile.merchantCustomerId = 'jdoe' + rand(10000).to_s
|
55
|
+
request.profile.description = 'John2 Doe'
|
56
|
+
request.profile.email = rand(10000).to_s + '@mail.com'
|
57
|
+
# Add the payment profile and shipping profile defined previously
|
58
|
+
request.profile.paymentProfiles = [paymentProfile]
|
59
|
+
request.profile.shipToList = [shippingAddress]
|
60
|
+
request.validationMode = ValidationModeEnum::LiveMode
|
61
|
+
|
62
|
+
response = transaction.create_customer_profile(request)
|
63
|
+
puts response.messages.resultCode
|
64
|
+
|
65
|
+
if response != nil
|
66
|
+
if response.messages.resultCode == MessageTypeEnum::Ok
|
67
|
+
puts "Successfully created a customer profile with id: #{response.customerProfileId}"
|
68
|
+
puts " Customer Payment Profile Id List:"
|
69
|
+
response.customerPaymentProfileIdList.numericString.each do |id|
|
70
|
+
puts " #{id}"
|
71
|
+
end
|
72
|
+
puts " Customer Shipping Address Id List:"
|
73
|
+
response.customerShippingAddressIdList.numericString.each do |id|
|
74
|
+
puts " #{id}"
|
75
|
+
end
|
76
|
+
puts
|
77
|
+
else
|
78
|
+
puts response.messages.messages[0].code
|
79
|
+
puts response.messages.messages[0].text
|
80
|
+
raise "Failed to create a new customer profile."
|
81
|
+
end
|
82
|
+
else
|
83
|
+
puts "Response is null"
|
84
|
+
raise "Failed to create a new customer profile."
|
85
|
+
end
|
86
|
+
|
87
|
+
return response
|
88
|
+
end
|
89
|
+
|
90
|
+
if __FILE__ == $0
|
91
|
+
create_customer_profile()
|
92
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'authorizenet'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
include AuthorizeNet::API
|
7
|
+
|
8
|
+
def create_customer_shipping_address(customerProfileId = '1813343337')
|
9
|
+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
10
|
+
|
11
|
+
transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
12
|
+
|
13
|
+
|
14
|
+
request = CreateCustomerShippingAddressRequest.new
|
15
|
+
|
16
|
+
request.address = CustomerAddressType.new('John','Doe')
|
17
|
+
request.customerProfileId = customerProfileId
|
18
|
+
response = transaction.create_customer_shipping_profile(request)
|
19
|
+
|
20
|
+
|
21
|
+
if response.messages.resultCode == MessageTypeEnum::Ok
|
22
|
+
puts "Successfully created a customer shipping address with id: #{response.customerAddressId}."
|
23
|
+
else
|
24
|
+
puts "Failed to create a new customer shipping address: #{response.messages.messages[0].text}"
|
25
|
+
end
|
26
|
+
return response
|
27
|
+
end
|
28
|
+
|
29
|
+
if __FILE__ == $0
|
30
|
+
create_customer_shipping_address()
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'authorizenet'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
include AuthorizeNet::API
|
7
|
+
|
8
|
+
def delete_customer_payment_profile(customerProfileId='35894174', customerPaymentProfileId='33604709')
|
9
|
+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
10
|
+
|
11
|
+
transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
12
|
+
|
13
|
+
|
14
|
+
request = DeleteCustomerPaymentProfileRequest.new
|
15
|
+
request.customerProfileId = customerProfileId
|
16
|
+
request.customerPaymentProfileId = customerPaymentProfileId
|
17
|
+
|
18
|
+
response = transaction.delete_customer_payment_profile(request)
|
19
|
+
|
20
|
+
|
21
|
+
if response.messages.resultCode == MessageTypeEnum::Ok
|
22
|
+
puts "Successfully deleted payment profile with customer payment profile ID #{request.customerPaymentProfileId}."
|
23
|
+
else
|
24
|
+
puts "Failed to delete payment profile with profile ID #{request.customerPaymentProfileId}: #{response.messages.messages[0].text}"
|
25
|
+
end
|
26
|
+
return response
|
27
|
+
end
|
28
|
+
|
29
|
+
if __FILE__ == $0
|
30
|
+
delete_customer_payment_profile()
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'authorizenet'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
include AuthorizeNet::API
|
7
|
+
|
8
|
+
def delete_customer_profile(customerProfileId = '36551110')
|
9
|
+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
10
|
+
|
11
|
+
transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
12
|
+
|
13
|
+
|
14
|
+
request = DeleteCustomerProfileRequest.new
|
15
|
+
request.customerProfileId = customerProfileId
|
16
|
+
|
17
|
+
response = transaction.delete_customer_profile(request)
|
18
|
+
|
19
|
+
|
20
|
+
if response.messages.resultCode == MessageTypeEnum::Ok
|
21
|
+
puts "Successfully deleted customer with customer profile ID #{request.customerProfileId}."
|
22
|
+
else
|
23
|
+
puts response.messages.messages[0].text
|
24
|
+
raise "Failed to delete customer with customer profile ID #{request.customerProfileId}."
|
25
|
+
end
|
26
|
+
return response
|
27
|
+
end
|
28
|
+
|
29
|
+
if __FILE__ == $0
|
30
|
+
delete_customer_profile()
|
31
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'authorizenet'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
include AuthorizeNet::API
|
7
|
+
|
8
|
+
def delete_customer_shipping_address(customerProfileId = '36551110', customerAddressId = '35894174')
|
9
|
+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
10
|
+
|
11
|
+
transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
12
|
+
|
13
|
+
|
14
|
+
request = DeleteCustomerShippingAddressRequest.new
|
15
|
+
request.customerProfileId = customerProfileId
|
16
|
+
request.customerAddressId = customerAddressId
|
17
|
+
|
18
|
+
response = transaction.delete_customer_shipping_profile(request)
|
19
|
+
|
20
|
+
|
21
|
+
if response.messages.resultCode == MessageTypeEnum::Ok
|
22
|
+
puts "Successfully deleted shipping address with customer shipping profile ID #{request.customerAddressId}."
|
23
|
+
else
|
24
|
+
puts response.messages.messages[0].text
|
25
|
+
raise "Failed to delete payment profile with profile ID #{request.customerAddressId}."
|
26
|
+
end
|
27
|
+
return response
|
28
|
+
end
|
29
|
+
|
30
|
+
if __FILE__ == $0
|
31
|
+
delete_customer_shipping_address()
|
32
|
+
end
|
33
|
+
|
@@ -4,27 +4,45 @@ require 'authorizenet'
|
|
4
4
|
require 'securerandom'
|
5
5
|
|
6
6
|
include AuthorizeNet::API
|
7
|
-
|
7
|
+
|
8
8
|
def get_accept_customer_profile_page(api_login_id,api_transaction_key,iframeCommunicatorUrl,customerProfileId = '37696245')
|
9
|
-
|
9
|
+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
10
|
+
|
11
|
+
# transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
12
|
+
|
10
13
|
transaction = Transaction.new(api_login_id, api_transaction_key, :gateway => :sandbox)
|
11
14
|
|
12
15
|
setting = SettingType.new
|
13
16
|
setting.settingName = SettingNameEnum::HostedProfileReturnUrl
|
14
17
|
setting.settingValue = "https://returnurl.com/return/"
|
15
|
-
|
18
|
+
|
16
19
|
setting1 = SettingType.new
|
17
20
|
setting1.settingName = SettingNameEnum::HostedProfileIFrameCommunicatorUrl
|
18
21
|
setting1.settingValue = iframeCommunicatorUrl
|
19
22
|
|
20
23
|
settings = Settings.new([setting,setting1])
|
21
|
-
|
24
|
+
puts "TESTING #{setting1.settingValue}"
|
25
|
+
|
22
26
|
request = GetHostedProfilePageRequest.new
|
23
27
|
request.customerProfileId = customerProfileId
|
24
28
|
request.refId = ""
|
25
29
|
request.hostedProfileSettings = settings
|
26
|
-
|
30
|
+
|
27
31
|
response = transaction.get_hosted_profile_page(request)
|
32
|
+
|
33
|
+
# if response.messages.resultCode == MessageTypeEnum::Ok
|
34
|
+
# puts "Successfully got Accept Customer page token."
|
35
|
+
# puts " Response code: #{response.messages.messages[0].code}"
|
36
|
+
# puts " Response message: #{response.messages.messages[0].text}"
|
37
|
+
# puts " Token: #{response.token}"
|
38
|
+
# else
|
39
|
+
# puts "#{response.messages.messages[0].code}"
|
40
|
+
# puts "#{response.messages.messages[0].text}"
|
41
|
+
# raise "Failed to get hosted profile page with customer profile ID #{request.customerProfileId}"
|
42
|
+
# end
|
28
43
|
return response
|
29
44
|
end
|
30
45
|
|
46
|
+
if __FILE__ == $0
|
47
|
+
get_accept_customer_profile_page()
|
48
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'authorizenet'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
include AuthorizeNet::API
|
7
|
+
|
8
|
+
def get_customer_payment_profile_list()
|
9
|
+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
10
|
+
|
11
|
+
transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
12
|
+
|
13
|
+
searchTypeEnum = CustomerPaymentProfileSearchTypeEnum::CardsExpiringInMonth
|
14
|
+
sorting = CustomerPaymentProfileSorting.new
|
15
|
+
orderByEnum = CustomerPaymentProfileOrderFieldEnum::Id
|
16
|
+
sorting.orderBy = orderByEnum
|
17
|
+
sorting.orderDescending = false
|
18
|
+
|
19
|
+
paging = Paging.new
|
20
|
+
paging.limit = 1000
|
21
|
+
paging.offset = 1
|
22
|
+
|
23
|
+
|
24
|
+
request = GetCustomerPaymentProfileListRequest.new
|
25
|
+
|
26
|
+
request.searchType = searchTypeEnum
|
27
|
+
request.month = "2020-12"
|
28
|
+
request.sorting = sorting
|
29
|
+
request.paging = paging
|
30
|
+
|
31
|
+
response = transaction.get_customer_payment_profile_list(request)
|
32
|
+
|
33
|
+
if response.messages.resultCode == MessageTypeEnum::Ok
|
34
|
+
puts "Successfully got customer payment profile list."
|
35
|
+
puts response.messages.messages[0].code
|
36
|
+
puts response.messages.messages[0].text
|
37
|
+
puts " Total number in result set: #{response.totalNumInResultSet}"
|
38
|
+
# response.paymentProfiles.paymentProfile.each do |paymentProfile|
|
39
|
+
# puts "Payment profile ID = #{paymentProfile.customerPaymentProfileId}"
|
40
|
+
# puts "First Name in Billing Address = #{paymentProfile.billTo.firstName}"
|
41
|
+
# puts "Credit Card Number = #{paymentProfile.payment.creditCard.cardNumber}"
|
42
|
+
# end
|
43
|
+
else
|
44
|
+
puts response.messages.messages[0].code
|
45
|
+
puts response.messages.messages[0].text
|
46
|
+
raise "Failed to get customer payment profile list"
|
47
|
+
end
|
48
|
+
return response
|
49
|
+
end
|
50
|
+
|
51
|
+
if __FILE__ == $0
|
52
|
+
get_customer_payment_profile_list()
|
53
|
+
end
|
54
|
+
|