authorizenetsample 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/CustomerProfiles/get-accept-customer-profile-page.rb +5 -23
- data/lib/CustomerProfiles/get-customer-profile.rb +3 -39
- data/lib/PaymentTransactions/create-an-accept-payment-transaction.rb +5 -45
- data/lib/PaymentTransactions/get-an-accept-payment-page.rb +49 -70
- data/lib/authorizenetsample.rb +12 -4
- metadata +6 -69
- data/lib/CustomerProfiles/create-customer-payment-profile.rb +0 -62
- data/lib/CustomerProfiles/create-customer-profile-from-transaction.rb +0 -51
- data/lib/CustomerProfiles/create-customer-profile.rb +0 -92
- data/lib/CustomerProfiles/create-customer-shipping-address.rb +0 -31
- data/lib/CustomerProfiles/delete-customer-payment-profile.rb +0 -32
- data/lib/CustomerProfiles/delete-customer-profile.rb +0 -31
- data/lib/CustomerProfiles/delete-customer-shipping-address.rb +0 -33
- data/lib/CustomerProfiles/get-customer-payment-profile-list.rb +0 -54
- data/lib/CustomerProfiles/get-customer-payment-profile.rb +0 -40
- data/lib/CustomerProfiles/get-customer-profile-ids.rb +0 -45
- data/lib/CustomerProfiles/get-customer-shipping-address.rb +0 -41
- data/lib/CustomerProfiles/update-customer-payment-profile.rb +0 -37
- data/lib/CustomerProfiles/update-customer-profile.rb +0 -37
- data/lib/CustomerProfiles/update-customer-shipping-address.rb +0 -37
- data/lib/CustomerProfiles/validate-customer-payment-profile.rb +0 -37
- data/lib/FraudManagement/approve-or-decline-held-transaction.rb +0 -57
- data/lib/FraudManagement/get-held-transaction-list.rb +0 -47
- data/lib/MobileInAppTransactions/create-an-accept-transaction.rb +0 -59
- data/lib/MobileInAppTransactions/create-an-android-pay-transaction.rb +0 -59
- data/lib/MobileInAppTransactions/create-an-apple-pay-transaction.rb +0 -58
- data/lib/PayPalExpressCheckout/authorization-and-capture-continued.rb +0 -69
- data/lib/PayPalExpressCheckout/authorization-and-capture.rb +0 -70
- data/lib/PayPalExpressCheckout/authorization-only-continued.rb +0 -70
- data/lib/PayPalExpressCheckout/authorization-only.rb +0 -71
- data/lib/PayPalExpressCheckout/credit.rb +0 -67
- data/lib/PayPalExpressCheckout/get-details.rb +0 -69
- data/lib/PayPalExpressCheckout/prior-authorization-capture.rb +0 -112
- data/lib/PayPalExpressCheckout/void.rb +0 -113
- data/lib/PaymentTransactions/authorize-credit-card.rb +0 -103
- data/lib/PaymentTransactions/capture-funds-authorized-through-another-channel.rb +0 -60
- data/lib/PaymentTransactions/capture-previously-authorized-amount.rb +0 -104
- data/lib/PaymentTransactions/charge-credit-card.rb +0 -104
- data/lib/PaymentTransactions/charge-customer-profile.rb +0 -61
- data/lib/PaymentTransactions/charge-tokenized-credit-card.rb +0 -60
- data/lib/PaymentTransactions/credit-bank-account.rb +0 -62
- data/lib/PaymentTransactions/debit-bank-account.rb +0 -64
- data/lib/PaymentTransactions/refund-transaction.rb +0 -60
- data/lib/PaymentTransactions/update-split-tender-group.rb +0 -44
- data/lib/PaymentTransactions/void-transaction.rb +0 -103
- data/lib/RecurringBilling/cancel-subscription.rb +0 -36
- data/lib/RecurringBilling/create-subscription-from-customer-profile.rb +0 -52
- data/lib/RecurringBilling/create-subscription.rb +0 -54
- data/lib/RecurringBilling/get-list-of-subscriptions.rb +0 -51
- data/lib/RecurringBilling/get-subscription-status.rb +0 -36
- data/lib/RecurringBilling/get-subscription.rb +0 -42
- data/lib/RecurringBilling/update-subscription.rb +0 -54
- data/lib/TransactionReporting/get-batch-statistics.rb +0 -57
- data/lib/TransactionReporting/get-customer-profile-transaction-list.rb +0 -49
- data/lib/TransactionReporting/get-merchant-details.rb +0 -50
- data/lib/TransactionReporting/get-settled-batch-list.rb +0 -49
- data/lib/TransactionReporting/get-transaction-details.rb +0 -40
- data/lib/TransactionReporting/get-transaction-list.rb +0 -58
- data/lib/TransactionReporting/get-unsettled-transaction-list.rb +0 -48
- data/lib/VisaCheckout/create-visa-checkout-transaction.rb +0 -62
- data/lib/VisaCheckout/decrypt-visa-checkout-data.rb +0 -37
- data/lib/authorize_netsample.rb +0 -21
- data/lib/credentials.yml +0 -9
- data/lib/spec/sample_code_spec.rb +0 -320
- data/lib/spec/spec.opts +0 -2
- data/lib/spec/spec_helper.rb +0 -10
- data/lib/spec/support/shared_helper.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6238ab604eaa3276a1b492f3ff348c40f4b2c04
|
4
|
+
data.tar.gz: 61d68e3021d79506b5bb5dd65b36b298cf6aa3c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b7b392ceb8293d08dd7a75c587f14a846f6cea75789f72d7c38af7a14dcf2ce997f7695d07986c83f6ffc4ae06e75fb87cc9ffccc303750e0b94efce6469e6
|
7
|
+
data.tar.gz: 771dee6a8f4ec498d8549b37bdcd075323806a8b953d5bc7e46acf9e41447ee8e4793317f13f0a3d539b315e25eb9c279f2f2cbf334219ee73957552001c97be
|
@@ -4,45 +4,27 @@ require 'authorizenet'
|
|
4
4
|
require 'securerandom'
|
5
5
|
|
6
6
|
include AuthorizeNet::API
|
7
|
-
|
7
|
+
#Function to get the token to load customer profile form
|
8
8
|
def get_accept_customer_profile_page(api_login_id,api_transaction_key,iframeCommunicatorUrl,customerProfileId = '37696245')
|
9
|
-
|
10
|
-
|
11
|
-
# transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
12
|
-
|
9
|
+
|
13
10
|
transaction = Transaction.new(api_login_id, api_transaction_key, :gateway => :sandbox)
|
14
11
|
|
15
12
|
setting = SettingType.new
|
16
13
|
setting.settingName = SettingNameEnum::HostedProfileReturnUrl
|
17
14
|
setting.settingValue = "https://returnurl.com/return/"
|
18
|
-
|
15
|
+
#Iframe URL to load the customer profile page
|
19
16
|
setting1 = SettingType.new
|
20
17
|
setting1.settingName = SettingNameEnum::HostedProfileIFrameCommunicatorUrl
|
21
18
|
setting1.settingValue = iframeCommunicatorUrl
|
22
19
|
|
23
20
|
settings = Settings.new([setting,setting1])
|
24
|
-
|
25
|
-
|
21
|
+
|
26
22
|
request = GetHostedProfilePageRequest.new
|
27
23
|
request.customerProfileId = customerProfileId
|
28
24
|
request.refId = ""
|
29
25
|
request.hostedProfileSettings = settings
|
30
|
-
|
26
|
+
#response with token details to load the customer profile page from server(Error handling in web api)
|
31
27
|
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
|
43
28
|
return response
|
44
29
|
end
|
45
30
|
|
46
|
-
if __FILE__ == $0
|
47
|
-
get_accept_customer_profile_page()
|
48
|
-
end
|
@@ -4,53 +4,17 @@ require 'authorizenet'
|
|
4
4
|
require 'securerandom'
|
5
5
|
|
6
6
|
include AuthorizeNet::API
|
7
|
-
|
7
|
+
#Function to validate the customer ID
|
8
8
|
def get_customer_profile(api_login_id,api_transaction_key,customerProfileId = '40036377')
|
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
9
|
|
13
10
|
transaction = Transaction.new(api_login_id, api_transaction_key, :gateway => :sandbox)
|
14
11
|
|
15
|
-
|
16
12
|
request = GetCustomerProfileRequest.new
|
17
13
|
request.customerProfileId = customerProfileId
|
18
|
-
|
14
|
+
# Response have the validation result of customer ID(Error handling in web api)
|
19
15
|
response = transaction.get_customer_profile(request)
|
20
16
|
|
21
|
-
# if response.messages.resultCode == MessageTypeEnum::Ok
|
22
|
-
# puts "Successfully retrieved a customer with profile ID is #{request.customerProfileId} and whose customer ID is #{response.profile.merchantCustomerId}."
|
23
|
-
# response.profile.paymentProfiles.each do |paymentProfile|
|
24
|
-
# puts " Payment Profile ID #{paymentProfile.customerPaymentProfileId}"
|
25
|
-
# puts " Payment Details:"
|
26
|
-
# if paymentProfile.billTo != nil
|
27
|
-
# puts " Last Name: #{paymentProfile.billTo.lastName}"
|
28
|
-
# puts " Address: #{paymentProfile.billTo.address}"
|
29
|
-
# end
|
30
|
-
# end
|
31
|
-
# response.profile.shipToList.each do |ship|
|
32
|
-
# puts " Shipping Address ID #{ship.customerAddressId}"
|
33
|
-
# puts " Shipping Details:"
|
34
|
-
# puts " First Name: #{ship.firstName}"
|
35
|
-
# puts " Last Name: #{ship.lastName}"
|
36
|
-
# puts " Address: #{ship.address}"
|
37
|
-
# end
|
38
|
-
|
39
|
-
# if response.subscriptionIds != nil && response.subscriptionIds.subscriptionId != nil
|
40
|
-
# puts " List of subscriptions: "
|
41
|
-
# response.subscriptionIds.subscriptionId.each do |subscriptionId|
|
42
|
-
# puts " #{subscriptionId}"
|
43
|
-
# end
|
44
|
-
# end
|
45
|
-
|
46
|
-
# else
|
47
|
-
# puts response.messages.messages[0].text
|
48
|
-
# raise "Failed to get customer profile information with ID #{request.customerProfileId}"
|
49
|
-
# end
|
50
17
|
return response
|
51
18
|
end
|
52
|
-
|
53
|
-
if __FILE__ == $0
|
54
|
-
get_customer_profile()
|
55
|
-
end
|
19
|
+
|
56
20
|
|
@@ -4,12 +4,9 @@ require 'authorizenet'
|
|
4
4
|
require 'securerandom'
|
5
5
|
|
6
6
|
include AuthorizeNet::API
|
7
|
-
|
7
|
+
#Function to make transaction using AcceptJs
|
8
8
|
def create_an_accept_payment_transaction(api_login_id,api_transaction_key,token)
|
9
|
-
|
10
|
-
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
|
11
|
-
|
12
|
-
# transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
|
9
|
+
|
13
10
|
transaction = Transaction.new(api_login_id, api_transaction_key, :gateway => :sandbox)
|
14
11
|
|
15
12
|
request = CreateTransactionRequest.new
|
@@ -19,56 +16,19 @@ require 'securerandom'
|
|
19
16
|
billTo.lastName = "Doe"
|
20
17
|
billTo.address = "123 My St"
|
21
18
|
billTo.city = "OurTown"
|
22
|
-
billTo.zip = "
|
19
|
+
billTo.zip = "46282"
|
23
20
|
|
24
21
|
request.transactionRequest = TransactionRequestType.new()
|
25
22
|
request.transactionRequest.amount = ((SecureRandom.random_number + 1 ) * 150 ).round(2)
|
26
23
|
request.transactionRequest.billTo = billTo
|
27
24
|
request.transactionRequest.payment = PaymentType.new
|
28
|
-
# request.transactionRequest.payment.opaqueData = OpaqueDataType.new('COMMON.ACCEPT.INAPP.PAYMENT','eyJjb2RlIjoiNTBfMl8wNjAwMDUzQTczNERGMDY0MUMyMzUxMkIyQTM2MUE3QTBFQUQ4NTIxQ0EzQjM3MUU1REMyMjlEQkYwMjRERjI5QzdFOTJBMDIzNzJGRDVDQkI0ODRDMTQ2NDYyQ0U4NkFCRjA0Q0Y3IiwidG9rZW4iOiI5NTM5MzYyNzY1NjM2NTgyODA0NjA0IiwidiI6IjEuMSJ9')
|
29
25
|
request.transactionRequest.payment.opaqueData = OpaqueDataType.new('COMMON.ACCEPT.INAPP.PAYMENT',token)
|
30
26
|
request.transactionRequest.customer = CustomerDataType.new(nil,nil,'bmc@mail.com')
|
31
27
|
request.transactionRequest.transactionType = TransactionTypeEnum::AuthCaptureTransaction
|
32
28
|
request.transactionRequest.order = OrderType.new("invoiceNumber#{(SecureRandom.random_number*1000000).round(0)}","Order Description")
|
33
29
|
|
30
|
+
#Response will have the transaction detals(Error handling in web api)
|
34
31
|
response = transaction.create_transaction(request)
|
35
32
|
|
36
|
-
|
37
|
-
|
38
|
-
# if response != nil
|
39
|
-
# if response.messages.resultCode == MessageTypeEnum::Ok
|
40
|
-
# if response.transactionResponse != nil && response.transactionResponse.messages != nil
|
41
|
-
# puts "Successful charge (auth + capture) (authorization code: #{response.transactionResponse.authCode})"
|
42
|
-
# puts "Transaction Response code: #{response.transactionResponse.responseCode}"
|
43
|
-
# puts "Code: #{response.transactionResponse.messages.messages[0].code}"
|
44
|
-
# puts "Description: #{response.transactionResponse.messages.messages[0].description}"
|
45
|
-
# else
|
46
|
-
# puts "Transaction Failed"
|
47
|
-
# if response.transactionResponse.errors != nil
|
48
|
-
# puts "Error Code: #{response.transactionResponse.errors.errors[0].errorCode}"
|
49
|
-
# puts "Error Message: #{response.transactionResponse.errors.errors[0].errorText}"
|
50
|
-
# end
|
51
|
-
# raise "Failed to charge card."
|
52
|
-
# end
|
53
|
-
# else
|
54
|
-
# puts "Transaction Failed"
|
55
|
-
# if response.transactionResponse != nil && response.transactionResponse.errors != nil
|
56
|
-
# puts "Error Code: #{response.transactionResponse.errors.errors[0].errorCode}"
|
57
|
-
# puts "Error Message: #{response.transactionResponse.errors.errors[0].errorText}"
|
58
|
-
# else
|
59
|
-
# puts "Error Code: #{response.messages.messages[0].code}"
|
60
|
-
# puts "Error Message: #{response.messages.messages[0].text}"
|
61
|
-
# end
|
62
|
-
# raise "Failed to charge card."
|
63
|
-
# end
|
64
|
-
# else
|
65
|
-
# puts "Response is null"
|
66
|
-
# raise "Failed to charge card."
|
67
|
-
# end
|
68
|
-
|
69
33
|
return response
|
70
|
-
end
|
71
|
-
|
72
|
-
if __FILE__ == $0
|
73
|
-
create_an_accept_payment_transaction()
|
74
|
-
end
|
34
|
+
end
|
@@ -1,70 +1,49 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'yaml'
|
3
|
-
require 'authorizenet'
|
4
|
-
require 'securerandom'
|
5
|
-
|
6
|
-
include AuthorizeNet::API
|
7
|
-
|
8
|
-
def get_an_accept_payment_page(api_login_id,api_transaction_key,customerId=nil,iframeCommunicatorUrl)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
transactionRequest =
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
request = GetHostedPaymentPageRequest.new
|
51
|
-
request.transactionRequest = transactionRequest
|
52
|
-
request.hostedPaymentSettings = settings
|
53
|
-
|
54
|
-
response = transaction.get_hosted_payment_page(request)
|
55
|
-
|
56
|
-
# if response.messages.resultCode == MessageTypeEnum::Ok
|
57
|
-
# puts "#{response.messages.messages[0].code}"
|
58
|
-
# puts "#{response.messages.messages[0].text}"
|
59
|
-
# puts "#{response.token}"
|
60
|
-
# else
|
61
|
-
# puts "#{response.messages.messages[0].code}"
|
62
|
-
# puts "#{response.messages.messages[0].text}"
|
63
|
-
# raise "Failed to get hosted payment page"
|
64
|
-
# end
|
65
|
-
return response
|
66
|
-
end
|
67
|
-
|
68
|
-
if __FILE__ == $0
|
69
|
-
get_an_accept_payment_page()
|
70
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'authorizenet'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
include AuthorizeNet::API
|
7
|
+
#Function to get the token to load the accept hosted payment form
|
8
|
+
def get_an_accept_payment_page(api_login_id,api_transaction_key,customerId=nil,iframeCommunicatorUrl)
|
9
|
+
|
10
|
+
transaction = Transaction.new(api_login_id, api_transaction_key, :gateway => :sandbox)
|
11
|
+
|
12
|
+
custProfile = CustomerProfilePaymentType.new
|
13
|
+
custProfile.customerProfileId = customerId
|
14
|
+
|
15
|
+
transactionRequest = TransactionRequestType.new
|
16
|
+
transactionRequest.amount = 99
|
17
|
+
transactionRequest.transactionType = TransactionTypeEnum::AuthCaptureTransaction
|
18
|
+
transactionRequest.profile = custProfile
|
19
|
+
|
20
|
+
setting1 = SettingType.new
|
21
|
+
setting1.settingName = SettingNameEnum::HostedPaymentButtonOptions
|
22
|
+
setting1.settingValue = "{\"text\": \"Pay\"}"
|
23
|
+
|
24
|
+
setting2 = SettingType.new
|
25
|
+
setting2.settingName = SettingNameEnum::HostedPaymentOrderOptions
|
26
|
+
setting2.settingValue = "{\"show\": false}"
|
27
|
+
|
28
|
+
setting4 = SettingType.new
|
29
|
+
setting4.settingName = SettingNameEnum::HostedPaymentBillingAddressOptions
|
30
|
+
setting4.settingValue = "{\"show\": false}"
|
31
|
+
|
32
|
+
setting3 = SettingType.new
|
33
|
+
setting3.settingName = SettingNameEnum::HostedPaymentIFrameCommunicatorUrl
|
34
|
+
setting3.settingValue = "{\"url\": \"#{iframeCommunicatorUrl}\"}"
|
35
|
+
#Disabling reciept display to have dynamic success message
|
36
|
+
setting5 = SettingType.new
|
37
|
+
setting5.settingName = SettingNameEnum::HostedPaymentReturnOptions
|
38
|
+
setting5.settingValue = "{\"showReceipt\": false,\"url\": \"#{iframeCommunicatorUrl}\",\"urlText\":\"Continue\",\"cancelUrlText\":\"Cancel\"}"
|
39
|
+
|
40
|
+
settings = Settings.new([ setting1, setting2,setting3,setting4,setting5])
|
41
|
+
|
42
|
+
request = GetHostedPaymentPageRequest.new
|
43
|
+
request.transactionRequest = transactionRequest
|
44
|
+
request.hostedPaymentSettings = settings
|
45
|
+
#Response will have the token to load the hosted form from server(Error hanling in web api)
|
46
|
+
response = transaction.get_hosted_payment_page(request)
|
47
|
+
|
48
|
+
return response
|
49
|
+
end
|
data/lib/authorizenetsample.rb
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
# This file is just here to avoid obnoxious gem name/require name issues. All this
|
2
|
-
# file does is require authorize_netsample.rb, the real initialization file.
|
3
|
-
|
4
|
-
require 'authorize_netsample'
|
1
|
+
# This file is just here to avoid obnoxious gem name/require name issues. All this
|
2
|
+
# file does is require authorize_netsample.rb, the real initialization file.
|
3
|
+
|
4
|
+
# require 'authorize_netsample'
|
5
|
+
|
6
|
+
require "PaymentTransactions/create-an-accept-payment-transaction.rb"
|
7
|
+
|
8
|
+
require "PaymentTransactions/get-an-accept-payment-page.rb"
|
9
|
+
|
10
|
+
require "CustomerProfiles/get-customer-profile.rb"
|
11
|
+
|
12
|
+
require "CustomerProfiles/get-accept-customer-profile-page.rb"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authorizenetsample
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Authorize.Net
|
@@ -10,82 +10,19 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
customer profiles
|
13
|
+
description: Sample code includes payment and customer profile functionalities
|
15
14
|
email: developer@authorize.net
|
16
15
|
executables: []
|
17
16
|
extensions: []
|
18
17
|
extra_rdoc_files: []
|
19
18
|
files:
|
20
|
-
- lib/CustomerProfiles/create-customer-payment-profile.rb
|
21
|
-
- lib/CustomerProfiles/create-customer-profile-from-transaction.rb
|
22
|
-
- lib/CustomerProfiles/create-customer-profile.rb
|
23
|
-
- lib/CustomerProfiles/create-customer-shipping-address.rb
|
24
|
-
- lib/CustomerProfiles/delete-customer-payment-profile.rb
|
25
|
-
- lib/CustomerProfiles/delete-customer-profile.rb
|
26
|
-
- lib/CustomerProfiles/delete-customer-shipping-address.rb
|
27
19
|
- lib/CustomerProfiles/get-accept-customer-profile-page.rb
|
28
|
-
- lib/CustomerProfiles/get-customer-payment-profile-list.rb
|
29
|
-
- lib/CustomerProfiles/get-customer-payment-profile.rb
|
30
|
-
- lib/CustomerProfiles/get-customer-profile-ids.rb
|
31
20
|
- lib/CustomerProfiles/get-customer-profile.rb
|
32
|
-
- lib/CustomerProfiles/get-customer-shipping-address.rb
|
33
|
-
- lib/CustomerProfiles/update-customer-payment-profile.rb
|
34
|
-
- lib/CustomerProfiles/update-customer-profile.rb
|
35
|
-
- lib/CustomerProfiles/update-customer-shipping-address.rb
|
36
|
-
- lib/CustomerProfiles/validate-customer-payment-profile.rb
|
37
|
-
- lib/FraudManagement/approve-or-decline-held-transaction.rb
|
38
|
-
- lib/FraudManagement/get-held-transaction-list.rb
|
39
|
-
- lib/MobileInAppTransactions/create-an-accept-transaction.rb
|
40
|
-
- lib/MobileInAppTransactions/create-an-android-pay-transaction.rb
|
41
|
-
- lib/MobileInAppTransactions/create-an-apple-pay-transaction.rb
|
42
|
-
- lib/PayPalExpressCheckout/authorization-and-capture-continued.rb
|
43
|
-
- lib/PayPalExpressCheckout/authorization-and-capture.rb
|
44
|
-
- lib/PayPalExpressCheckout/authorization-only-continued.rb
|
45
|
-
- lib/PayPalExpressCheckout/authorization-only.rb
|
46
|
-
- lib/PayPalExpressCheckout/credit.rb
|
47
|
-
- lib/PayPalExpressCheckout/get-details.rb
|
48
|
-
- lib/PayPalExpressCheckout/prior-authorization-capture.rb
|
49
|
-
- lib/PayPalExpressCheckout/void.rb
|
50
|
-
- lib/PaymentTransactions/authorize-credit-card.rb
|
51
|
-
- lib/PaymentTransactions/capture-funds-authorized-through-another-channel.rb
|
52
|
-
- lib/PaymentTransactions/capture-previously-authorized-amount.rb
|
53
|
-
- lib/PaymentTransactions/charge-credit-card.rb
|
54
|
-
- lib/PaymentTransactions/charge-customer-profile.rb
|
55
|
-
- lib/PaymentTransactions/charge-tokenized-credit-card.rb
|
56
21
|
- lib/PaymentTransactions/create-an-accept-payment-transaction.rb
|
57
|
-
- lib/PaymentTransactions/credit-bank-account.rb
|
58
|
-
- lib/PaymentTransactions/debit-bank-account.rb
|
59
22
|
- lib/PaymentTransactions/get-an-accept-payment-page.rb
|
60
|
-
- lib/PaymentTransactions/refund-transaction.rb
|
61
|
-
- lib/PaymentTransactions/update-split-tender-group.rb
|
62
|
-
- lib/PaymentTransactions/void-transaction.rb
|
63
|
-
- lib/RecurringBilling/cancel-subscription.rb
|
64
|
-
- lib/RecurringBilling/create-subscription-from-customer-profile.rb
|
65
|
-
- lib/RecurringBilling/create-subscription.rb
|
66
|
-
- lib/RecurringBilling/get-list-of-subscriptions.rb
|
67
|
-
- lib/RecurringBilling/get-subscription-status.rb
|
68
|
-
- lib/RecurringBilling/get-subscription.rb
|
69
|
-
- lib/RecurringBilling/update-subscription.rb
|
70
|
-
- lib/TransactionReporting/get-batch-statistics.rb
|
71
|
-
- lib/TransactionReporting/get-customer-profile-transaction-list.rb
|
72
|
-
- lib/TransactionReporting/get-merchant-details.rb
|
73
|
-
- lib/TransactionReporting/get-settled-batch-list.rb
|
74
|
-
- lib/TransactionReporting/get-transaction-details.rb
|
75
|
-
- lib/TransactionReporting/get-transaction-list.rb
|
76
|
-
- lib/TransactionReporting/get-unsettled-transaction-list.rb
|
77
|
-
- lib/VisaCheckout/create-visa-checkout-transaction.rb
|
78
|
-
- lib/VisaCheckout/decrypt-visa-checkout-data.rb
|
79
|
-
- lib/authorize_netsample.rb
|
80
23
|
- lib/authorizenetsample.rb
|
81
|
-
|
82
|
-
|
83
|
-
- lib/spec/spec.opts
|
84
|
-
- lib/spec/spec_helper.rb
|
85
|
-
- lib/spec/support/shared_helper.rb
|
86
|
-
homepage: https://github.com/AuthorizeNet/sample-code-ruby
|
87
|
-
licenses:
|
88
|
-
- https://github.com/AuthorizeNet/sample-code-ruby/LICENSE
|
24
|
+
homepage:
|
25
|
+
licenses: []
|
89
26
|
metadata: {}
|
90
27
|
post_install_message:
|
91
28
|
rdoc_options: []
|
@@ -95,7 +32,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
32
|
requirements:
|
96
33
|
- - ">="
|
97
34
|
- !ruby/object:Gem::Version
|
98
|
-
version: 2.2.
|
35
|
+
version: 2.2.6
|
99
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
37
|
requirements:
|
101
38
|
- - ">="
|
@@ -106,5 +43,5 @@ rubyforge_project:
|
|
106
43
|
rubygems_version: 2.4.5.2
|
107
44
|
signing_key:
|
108
45
|
specification_version: 4
|
109
|
-
summary: Authorize.Net Payments
|
46
|
+
summary: Authorize.Net Payments sample code
|
110
47
|
test_files: []
|
@@ -1,62 +0,0 @@
|
|
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
|
@@ -1,51 +0,0 @@
|
|
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
|
@@ -1,92 +0,0 @@
|
|
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
|