merb_merchant 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +421 -0
- data/CONTRIBUTERS +90 -0
- data/MIT-LICENSE +20 -0
- data/README +131 -0
- data/Rakefile +129 -0
- data/init.rb +3 -0
- data/lib/certs/cacert.pem +7815 -0
- data/lib/core_ext/delegating_attributes.rb +76 -0
- data/lib/core_ext/hash_ext.rb +35 -0
- data/lib/core_ext/inheritable_attributes.rb +145 -0
- data/lib/core_ext/time_dsl.rb +59 -0
- data/lib/merb_merchant.rb +96 -0
- data/lib/merb_merchant/billing/avs_result.rb +95 -0
- data/lib/merb_merchant/billing/base.rb +71 -0
- data/lib/merb_merchant/billing/check.rb +68 -0
- data/lib/merb_merchant/billing/credit_card.rb +157 -0
- data/lib/merb_merchant/billing/credit_card_formatting.rb +21 -0
- data/lib/merb_merchant/billing/credit_card_methods.rb +125 -0
- data/lib/merb_merchant/billing/cvv_result.rb +38 -0
- data/lib/merb_merchant/billing/expiry_date.rb +28 -0
- data/lib/merb_merchant/billing/gateway.rb +162 -0
- data/lib/merb_merchant/billing/gateways.rb +3 -0
- data/lib/merb_merchant/billing/gateways/authorize_net.rb +646 -0
- data/lib/merb_merchant/billing/gateways/authorize_net_cim.rb +702 -0
- data/lib/merb_merchant/billing/gateways/beanstream.rb +102 -0
- data/lib/merb_merchant/billing/gateways/beanstream/beanstream_core.rb +233 -0
- data/lib/merb_merchant/billing/gateways/beanstream_interac.rb +54 -0
- data/lib/merb_merchant/billing/gateways/bogus.rb +98 -0
- data/lib/merb_merchant/billing/gateways/braintree.rb +222 -0
- data/lib/merb_merchant/billing/gateways/card_stream.rb +229 -0
- data/lib/merb_merchant/billing/gateways/cyber_source.rb +406 -0
- data/lib/merb_merchant/billing/gateways/data_cash.rb +595 -0
- data/lib/merb_merchant/billing/gateways/efsnet.rb +229 -0
- data/lib/merb_merchant/billing/gateways/eway.rb +272 -0
- data/lib/merb_merchant/billing/gateways/exact.rb +222 -0
- data/lib/merb_merchant/billing/gateways/linkpoint.rb +396 -0
- data/lib/merb_merchant/billing/gateways/modern_payments.rb +36 -0
- data/lib/merb_merchant/billing/gateways/modern_payments_cim.rb +214 -0
- data/lib/merb_merchant/billing/gateways/moneris.rb +205 -0
- data/lib/merb_merchant/billing/gateways/net_registry.rb +189 -0
- data/lib/merb_merchant/billing/gateways/netbilling.rb +168 -0
- data/lib/merb_merchant/billing/gateways/pay_junction.rb +392 -0
- data/lib/merb_merchant/billing/gateways/pay_secure.rb +120 -0
- data/lib/merb_merchant/billing/gateways/payflow.rb +236 -0
- data/lib/merb_merchant/billing/gateways/payflow/payflow_common_api.rb +207 -0
- data/lib/merb_merchant/billing/gateways/payflow/payflow_express_response.rb +39 -0
- data/lib/merb_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/merb_merchant/billing/gateways/payflow_express.rb +138 -0
- data/lib/merb_merchant/billing/gateways/payflow_express_uk.rb +15 -0
- data/lib/merb_merchant/billing/gateways/payflow_uk.rb +21 -0
- data/lib/merb_merchant/billing/gateways/payment_express.rb +241 -0
- data/lib/merb_merchant/billing/gateways/paypal.rb +108 -0
- data/lib/merb_merchant/billing/gateways/paypal/paypal_common_api.rb +325 -0
- data/lib/merb_merchant/billing/gateways/paypal/paypal_express_response.rb +38 -0
- data/lib/merb_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/merb_merchant/billing/gateways/paypal_express.rb +130 -0
- data/lib/merb_merchant/billing/gateways/paypal_express_common.rb +20 -0
- data/lib/merb_merchant/billing/gateways/plugnpay.rb +292 -0
- data/lib/merb_merchant/billing/gateways/protx.rb +284 -0
- data/lib/merb_merchant/billing/gateways/psigate.rb +214 -0
- data/lib/merb_merchant/billing/gateways/psl_card.rb +306 -0
- data/lib/merb_merchant/billing/gateways/quickpay.rb +213 -0
- data/lib/merb_merchant/billing/gateways/realex.rb +200 -0
- data/lib/merb_merchant/billing/gateways/sage.rb +146 -0
- data/lib/merb_merchant/billing/gateways/sage/sage_bankcard.rb +88 -0
- data/lib/merb_merchant/billing/gateways/sage/sage_core.rb +110 -0
- data/lib/merb_merchant/billing/gateways/sage/sage_virtual_check.rb +97 -0
- data/lib/merb_merchant/billing/gateways/secure_pay.rb +31 -0
- data/lib/merb_merchant/billing/gateways/secure_pay_au.rb +157 -0
- data/lib/merb_merchant/billing/gateways/secure_pay_tech.rb +113 -0
- data/lib/merb_merchant/billing/gateways/skip_jack.rb +439 -0
- data/lib/merb_merchant/billing/gateways/trans_first.rb +127 -0
- data/lib/merb_merchant/billing/gateways/trust_commerce.rb +418 -0
- data/lib/merb_merchant/billing/gateways/usa_epay.rb +194 -0
- data/lib/merb_merchant/billing/gateways/verifi.rb +228 -0
- data/lib/merb_merchant/billing/gateways/viaklix.rb +165 -0
- data/lib/merb_merchant/billing/gateways/wirecard.rb +305 -0
- data/lib/merb_merchant/billing/integrations.rb +22 -0
- data/lib/merb_merchant/billing/integrations/action_view_helper.rb +79 -0
- data/lib/merb_merchant/billing/integrations/bogus.rb +29 -0
- data/lib/merb_merchant/billing/integrations/bogus/helper.rb +17 -0
- data/lib/merb_merchant/billing/integrations/bogus/notification.rb +11 -0
- data/lib/merb_merchant/billing/integrations/bogus/return.rb +10 -0
- data/lib/merb_merchant/billing/integrations/chronopay.rb +29 -0
- data/lib/merb_merchant/billing/integrations/chronopay/helper.rb +81 -0
- data/lib/merb_merchant/billing/integrations/chronopay/notification.rb +156 -0
- data/lib/merb_merchant/billing/integrations/chronopay/return.rb +10 -0
- data/lib/merb_merchant/billing/integrations/gestpay.rb +32 -0
- data/lib/merb_merchant/billing/integrations/gestpay/common.rb +42 -0
- data/lib/merb_merchant/billing/integrations/gestpay/helper.rb +70 -0
- data/lib/merb_merchant/billing/integrations/gestpay/notification.rb +83 -0
- data/lib/merb_merchant/billing/integrations/gestpay/return.rb +10 -0
- data/lib/merb_merchant/billing/integrations/helper.rb +93 -0
- data/lib/merb_merchant/billing/integrations/hi_trust.rb +26 -0
- data/lib/merb_merchant/billing/integrations/hi_trust/helper.rb +58 -0
- data/lib/merb_merchant/billing/integrations/hi_trust/notification.rb +59 -0
- data/lib/merb_merchant/billing/integrations/hi_trust/return.rb +67 -0
- data/lib/merb_merchant/billing/integrations/nochex.rb +101 -0
- data/lib/merb_merchant/billing/integrations/nochex/helper.rb +68 -0
- data/lib/merb_merchant/billing/integrations/nochex/notification.rb +94 -0
- data/lib/merb_merchant/billing/integrations/nochex/return.rb +10 -0
- data/lib/merb_merchant/billing/integrations/notification.rb +62 -0
- data/lib/merb_merchant/billing/integrations/paypal.rb +54 -0
- data/lib/merb_merchant/billing/integrations/paypal/helper.rb +118 -0
- data/lib/merb_merchant/billing/integrations/paypal/notification.rb +154 -0
- data/lib/merb_merchant/billing/integrations/paypal/return.rb +10 -0
- data/lib/merb_merchant/billing/integrations/quickpay.rb +25 -0
- data/lib/merb_merchant/billing/integrations/quickpay/helper.rb +72 -0
- data/lib/merb_merchant/billing/integrations/quickpay/notification.rb +74 -0
- data/lib/merb_merchant/billing/integrations/return.rb +35 -0
- data/lib/merb_merchant/billing/integrations/two_checkout.rb +30 -0
- data/lib/merb_merchant/billing/integrations/two_checkout/helper.rb +59 -0
- data/lib/merb_merchant/billing/integrations/two_checkout/notification.rb +114 -0
- data/lib/merb_merchant/billing/integrations/two_checkout/return.rb +17 -0
- data/lib/merb_merchant/billing/response.rb +32 -0
- data/lib/merb_merchant/lib/country.rb +298 -0
- data/lib/merb_merchant/lib/error.rb +4 -0
- data/lib/merb_merchant/lib/inflector.rb +69 -0
- data/lib/merb_merchant/lib/post_data.rb +22 -0
- data/lib/merb_merchant/lib/posts_data.rb +109 -0
- data/lib/merb_merchant/lib/requires_parameters.rb +16 -0
- data/lib/merb_merchant/lib/utils.rb +18 -0
- data/lib/merb_merchant/lib/validateable.rb +76 -0
- data/lib/support/gateway_support.rb +57 -0
- data/lib/tasks/cia.rb +90 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/extra/binding_of_caller.rb +80 -0
- data/test/extra/breakpoint.rb +547 -0
- data/test/fixtures.yml +317 -0
- data/test/remote/gateways/remote_authorize_net_cim_test.rb +459 -0
- data/test/remote/gateways/remote_authorize_net_test.rb +145 -0
- data/test/remote/gateways/remote_beanstream_interac_test.rb +53 -0
- data/test/remote/gateways/remote_beanstream_test.rb +150 -0
- data/test/remote/gateways/remote_braintree_test.rb +154 -0
- data/test/remote/gateways/remote_card_stream_test.rb +148 -0
- data/test/remote/gateways/remote_cyber_source_test.rb +144 -0
- data/test/remote/gateways/remote_data_cash_test.rb +357 -0
- data/test/remote/gateways/remote_efsnet_test.rb +81 -0
- data/test/remote/gateways/remote_eway_test.rb +74 -0
- data/test/remote/gateways/remote_exact_test.rb +60 -0
- data/test/remote/gateways/remote_linkpoint_test.rb +112 -0
- data/test/remote/gateways/remote_modern_payments_cim_test.rb +58 -0
- data/test/remote/gateways/remote_modern_payments_test.rb +43 -0
- data/test/remote/gateways/remote_moneris_test.rb +82 -0
- data/test/remote/gateways/remote_net_registry_test.rb +85 -0
- data/test/remote/gateways/remote_netbilling_test.rb +70 -0
- data/test/remote/gateways/remote_pay_junction_test.rb +143 -0
- data/test/remote/gateways/remote_pay_secure_test.rb +39 -0
- data/test/remote/gateways/remote_payflow_express_test.rb +50 -0
- data/test/remote/gateways/remote_payflow_test.rb +237 -0
- data/test/remote/gateways/remote_payflow_uk_test.rb +173 -0
- data/test/remote/gateways/remote_payment_express_test.rb +126 -0
- data/test/remote/gateways/remote_paypal_express_test.rb +49 -0
- data/test/remote/gateways/remote_paypal_test.rb +167 -0
- data/test/remote/gateways/remote_plugnpay_test.rb +72 -0
- data/test/remote/gateways/remote_protx_test.rb +184 -0
- data/test/remote/gateways/remote_psigate_test.rb +50 -0
- data/test/remote/gateways/remote_psl_card_test.rb +125 -0
- data/test/remote/gateways/remote_quickpay_test.rb +190 -0
- data/test/remote/gateways/remote_realex_test.rb +224 -0
- data/test/remote/gateways/remote_sage_bankcard_test.rb +109 -0
- data/test/remote/gateways/remote_sage_test.rb +87 -0
- data/test/remote/gateways/remote_sage_virtual_check_test.rb +62 -0
- data/test/remote/gateways/remote_secure_pay_au_test.rb +40 -0
- data/test/remote/gateways/remote_secure_pay_tech_test.rb +37 -0
- data/test/remote/gateways/remote_secure_pay_test.rb +28 -0
- data/test/remote/gateways/remote_skipjack_test.rb +105 -0
- data/test/remote/gateways/remote_trans_first_test.rb +34 -0
- data/test/remote/gateways/remote_trust_commerce_test.rb +152 -0
- data/test/remote/gateways/remote_usa_epay_test.rb +46 -0
- data/test/remote/gateways/remote_verifi_test.rb +107 -0
- data/test/remote/gateways/remote_viaklix_test.rb +43 -0
- data/test/remote/gateways/remote_wirecard_test.rb +77 -0
- data/test/remote/integrations/remote_gestpay_integration_test.rb +37 -0
- data/test/remote/integrations/remote_paypal_integration_test.rb +26 -0
- data/test/test_helper.rb +208 -0
- data/test/unit/avs_result_test.rb +59 -0
- data/test/unit/base_test.rb +55 -0
- data/test/unit/check_test.rb +88 -0
- data/test/unit/country_code_test.rb +33 -0
- data/test/unit/country_test.rb +64 -0
- data/test/unit/credit_card_formatting_test.rb +19 -0
- data/test/unit/credit_card_methods_test.rb +170 -0
- data/test/unit/credit_card_test.rb +311 -0
- data/test/unit/cvv_result_test.rb +33 -0
- data/test/unit/expiry_date_test.rb +21 -0
- data/test/unit/gateways/authorize_net_cim_test.rb +638 -0
- data/test/unit/gateways/authorize_net_test.rb +290 -0
- data/test/unit/gateways/beanstream_interac_test.rb +51 -0
- data/test/unit/gateways/beanstream_test.rb +108 -0
- data/test/unit/gateways/bogus_test.rb +46 -0
- data/test/unit/gateways/braintree_test.rb +116 -0
- data/test/unit/gateways/card_stream_test.rb +91 -0
- data/test/unit/gateways/cyber_source_test.rb +188 -0
- data/test/unit/gateways/data_cash_test.rb +132 -0
- data/test/unit/gateways/efsnet_test.rb +124 -0
- data/test/unit/gateways/eway_test.rb +118 -0
- data/test/unit/gateways/exact_test.rb +156 -0
- data/test/unit/gateways/gateway_test.rb +48 -0
- data/test/unit/gateways/linkpoint_test.rb +167 -0
- data/test/unit/gateways/modern_payments_cim_test.rb +171 -0
- data/test/unit/gateways/moneris_test.rb +158 -0
- data/test/unit/gateways/net_registry_test.rb +416 -0
- data/test/unit/gateways/netbilling_test.rb +54 -0
- data/test/unit/gateways/pay_junction_test.rb +123 -0
- data/test/unit/gateways/pay_secure_test.rb +71 -0
- data/test/unit/gateways/payflow_express_test.rb +173 -0
- data/test/unit/gateways/payflow_express_uk_test.rb +14 -0
- data/test/unit/gateways/payflow_test.rb +305 -0
- data/test/unit/gateways/payflow_uk_test.rb +30 -0
- data/test/unit/gateways/payment_express_test.rb +195 -0
- data/test/unit/gateways/paypal_express_test.rb +382 -0
- data/test/unit/gateways/paypal_test.rb +520 -0
- data/test/unit/gateways/plugnpay_test.rb +86 -0
- data/test/unit/gateways/protx_test.rb +122 -0
- data/test/unit/gateways/psigate_test.rb +169 -0
- data/test/unit/gateways/psl_card_test.rb +64 -0
- data/test/unit/gateways/quickpay_test.rb +112 -0
- data/test/unit/gateways/realex_test.rb +151 -0
- data/test/unit/gateways/sage_bankcard_test.rb +162 -0
- data/test/unit/gateways/sage_virtual_check_test.rb +71 -0
- data/test/unit/gateways/secure_pay_au_test.rb +207 -0
- data/test/unit/gateways/secure_pay_tech_test.rb +44 -0
- data/test/unit/gateways/secure_pay_test.rb +87 -0
- data/test/unit/gateways/skip_jack_test.rb +133 -0
- data/test/unit/gateways/trans_first_test.rb +112 -0
- data/test/unit/gateways/trust_commerce_test.rb +90 -0
- data/test/unit/gateways/usa_epay_test.rb +128 -0
- data/test/unit/gateways/verifi_test.rb +96 -0
- data/test/unit/gateways/viaklix_test.rb +78 -0
- data/test/unit/gateways/wirecard_test.rb +232 -0
- data/test/unit/generators/test_gateway_generator.rb +46 -0
- data/test/unit/generators/test_generator_helper.rb +20 -0
- data/test/unit/generators/test_integration_generator.rb +53 -0
- data/test/unit/integrations/action_view_helper_test.rb +50 -0
- data/test/unit/integrations/bogus_module_test.rb +20 -0
- data/test/unit/integrations/chronopay_module_test.rb +13 -0
- data/test/unit/integrations/gestpay_module_test.rb +14 -0
- data/test/unit/integrations/helpers/bogus_helper_test.rb +28 -0
- data/test/unit/integrations/helpers/chronopay_helper_test.rb +67 -0
- data/test/unit/integrations/helpers/gestpay_helper_test.rb +100 -0
- data/test/unit/integrations/helpers/hi_trust_helper_test.rb +16 -0
- data/test/unit/integrations/helpers/nochex_helper_test.rb +53 -0
- data/test/unit/integrations/helpers/paypal_helper_test.rb +162 -0
- data/test/unit/integrations/helpers/quickpay_helper_test.rb +40 -0
- data/test/unit/integrations/helpers/two_checkout_helper_test.rb +92 -0
- data/test/unit/integrations/hi_trust_module_test.rb +13 -0
- data/test/unit/integrations/nochex_module_test.rb +13 -0
- data/test/unit/integrations/notifications/chronopay_notification_test.rb +66 -0
- data/test/unit/integrations/notifications/gestpay_notification_test.rb +60 -0
- data/test/unit/integrations/notifications/hi_trust_notification_test.rb +59 -0
- data/test/unit/integrations/notifications/nochex_notification_test.rb +51 -0
- data/test/unit/integrations/notifications/notification_test.rb +54 -0
- data/test/unit/integrations/notifications/paypal_notification_test.rb +85 -0
- data/test/unit/integrations/notifications/quickpay_notification_test.rb +69 -0
- data/test/unit/integrations/notifications/two_checkout_notification_test.rb +55 -0
- data/test/unit/integrations/paypal_module_test.rb +28 -0
- data/test/unit/integrations/quickpay_module_test.rb +9 -0
- data/test/unit/integrations/returns/chronopay_return_test.rb +11 -0
- data/test/unit/integrations/returns/gestpay_return_test.rb +10 -0
- data/test/unit/integrations/returns/hi_trust_return_test.rb +24 -0
- data/test/unit/integrations/returns/nochex_return_test.rb +10 -0
- data/test/unit/integrations/returns/paypal_return_test.rb +10 -0
- data/test/unit/integrations/returns/return_test.rb +11 -0
- data/test/unit/integrations/returns/two_checkout_return_test.rb +24 -0
- data/test/unit/integrations/two_checkout_module_test.rb +13 -0
- data/test/unit/post_data_test.rb +55 -0
- data/test/unit/posts_data_test.rb +100 -0
- data/test/unit/response_test.rb +28 -0
- data/test/unit/utils_test.rb +7 -0
- data/test/unit/validateable_test.rb +60 -0
- metadata +379 -0
data/test/fixtures.yml
ADDED
@@ -0,0 +1,317 @@
|
|
1
|
+
# This file has all of the MerbMerchant test account credentials.
|
2
|
+
# Many gateways do not offer publicly available test accounts. In
|
3
|
+
# order to make testing the gateways easy you can copy this file to
|
4
|
+
# your home directory as the file ~/.merb_merchant/fixtures.yml
|
5
|
+
# You can then place your own test account credentials in your local
|
6
|
+
# copy of the file.
|
7
|
+
#
|
8
|
+
# If the login is numeric, ensure that you place quotes around it.
|
9
|
+
# Leading zeros will be lost when YAML parses the file if you don't.
|
10
|
+
#
|
11
|
+
# Paste any required PEM certificates after the pem key.
|
12
|
+
#
|
13
|
+
authorize_net:
|
14
|
+
login: X
|
15
|
+
password: Y
|
16
|
+
|
17
|
+
beanstream:
|
18
|
+
login: merchant id
|
19
|
+
user: username
|
20
|
+
password: password
|
21
|
+
|
22
|
+
beanstream_interac:
|
23
|
+
login: merchant id
|
24
|
+
user: username
|
25
|
+
password: password
|
26
|
+
|
27
|
+
braintree:
|
28
|
+
login: demo
|
29
|
+
password: password
|
30
|
+
|
31
|
+
card_stream:
|
32
|
+
login: X
|
33
|
+
password: Y
|
34
|
+
|
35
|
+
cyber_source:
|
36
|
+
login: X
|
37
|
+
password: Y
|
38
|
+
|
39
|
+
data_cash:
|
40
|
+
login: X
|
41
|
+
password: Y
|
42
|
+
|
43
|
+
efsnet:
|
44
|
+
login: X
|
45
|
+
password: Y
|
46
|
+
|
47
|
+
# Working credentials, no need to replace
|
48
|
+
eway:
|
49
|
+
login: '87654321'
|
50
|
+
|
51
|
+
# Working credentials, no need to replace
|
52
|
+
exact:
|
53
|
+
login: "A00427-01"
|
54
|
+
password: testus
|
55
|
+
|
56
|
+
ideal_ing_postbank:
|
57
|
+
login: LOGIN
|
58
|
+
password: PASSWORD
|
59
|
+
pem: |--
|
60
|
+
PASTE YOUR PEM FILE HERE
|
61
|
+
|
62
|
+
linkpoint:
|
63
|
+
login: STOREID
|
64
|
+
pem: |--
|
65
|
+
PASTE YOUR PEM FILE HERE
|
66
|
+
|
67
|
+
modern_payments:
|
68
|
+
login: login
|
69
|
+
password: password
|
70
|
+
|
71
|
+
# Working credentials, no need to replace
|
72
|
+
moneris:
|
73
|
+
login: store1
|
74
|
+
password: yesguy
|
75
|
+
|
76
|
+
# Working credentials, no need to replace
|
77
|
+
# Contact Netbilling for login info to the admin area
|
78
|
+
netbilling:
|
79
|
+
login: '104901072025'
|
80
|
+
|
81
|
+
net_registry:
|
82
|
+
login: X
|
83
|
+
password: Y
|
84
|
+
|
85
|
+
payflow:
|
86
|
+
login: LOGIN
|
87
|
+
password: PASSWORD
|
88
|
+
partner: PayPal
|
89
|
+
|
90
|
+
payflow_uk:
|
91
|
+
login: LOGIN
|
92
|
+
password: PASSWORD
|
93
|
+
partner: PayPalUk
|
94
|
+
|
95
|
+
# Working credentials, no need to replace
|
96
|
+
pay_junction:
|
97
|
+
login: 'pj-ql-01'
|
98
|
+
password: 'pj-ql-01p'
|
99
|
+
|
100
|
+
payment_express:
|
101
|
+
login: LOGIN
|
102
|
+
password: PASSWORD
|
103
|
+
|
104
|
+
# You can use either your API PEM file or API signature with PayPal.
|
105
|
+
paypal_certificate:
|
106
|
+
login: LOGIN
|
107
|
+
password: PASSWORD
|
108
|
+
subject:
|
109
|
+
pem: |--
|
110
|
+
PASTE YOUR PEM FILE HERE
|
111
|
+
|
112
|
+
paypal_signature:
|
113
|
+
login: LOGIN
|
114
|
+
password: PASSWORD
|
115
|
+
signature: SIGNATURE
|
116
|
+
|
117
|
+
pay_secure:
|
118
|
+
login: LOGIN
|
119
|
+
password: PASSWORD
|
120
|
+
|
121
|
+
plugnpay:
|
122
|
+
login: LOGIN
|
123
|
+
password: PASSWORD
|
124
|
+
|
125
|
+
protx:
|
126
|
+
login: LOGIN
|
127
|
+
|
128
|
+
# Working credentials, no need to replace
|
129
|
+
psigate:
|
130
|
+
login: teststore
|
131
|
+
password: psigate1234
|
132
|
+
|
133
|
+
psl_card:
|
134
|
+
login: LOGIN
|
135
|
+
|
136
|
+
# PSL doesn't want the test data made public
|
137
|
+
psl_maestro:
|
138
|
+
number:
|
139
|
+
month:
|
140
|
+
year:
|
141
|
+
verification_value:
|
142
|
+
issue_number:
|
143
|
+
|
144
|
+
psl_maestro_address:
|
145
|
+
address1:
|
146
|
+
address2:
|
147
|
+
city:
|
148
|
+
state:
|
149
|
+
zip:
|
150
|
+
|
151
|
+
psl_solo:
|
152
|
+
number:
|
153
|
+
month:
|
154
|
+
year:
|
155
|
+
verification_value:
|
156
|
+
issue_number:
|
157
|
+
|
158
|
+
psl_solo_address:
|
159
|
+
address1:
|
160
|
+
city:
|
161
|
+
state:
|
162
|
+
zip:
|
163
|
+
|
164
|
+
psl_visa:
|
165
|
+
number:
|
166
|
+
month:
|
167
|
+
year:
|
168
|
+
verification_value:
|
169
|
+
|
170
|
+
psl_visa_address:
|
171
|
+
address1:
|
172
|
+
address2:
|
173
|
+
address3:
|
174
|
+
city:
|
175
|
+
zip:
|
176
|
+
|
177
|
+
psl_visa_debit:
|
178
|
+
first_name:
|
179
|
+
last_name:
|
180
|
+
number:
|
181
|
+
month:
|
182
|
+
year:
|
183
|
+
verification_value:
|
184
|
+
|
185
|
+
psl_visa_debit_address:
|
186
|
+
address1:
|
187
|
+
address2:
|
188
|
+
address3:
|
189
|
+
city:
|
190
|
+
state:
|
191
|
+
zip:
|
192
|
+
|
193
|
+
quickpay:
|
194
|
+
login: 89898989
|
195
|
+
password: "n5KrR5e2538awi9hUk6728LHTQ6E4uG1z4IFSb2pPN9j76DqJ2vA4698X315M1cd"
|
196
|
+
|
197
|
+
realex:
|
198
|
+
login: X
|
199
|
+
password: Y
|
200
|
+
|
201
|
+
realex_with_account:
|
202
|
+
login: X
|
203
|
+
password: Y
|
204
|
+
account: testaccount
|
205
|
+
|
206
|
+
# Realex doesn't provide public testing data
|
207
|
+
# Fill in the card numbers with the Realex test
|
208
|
+
# data.
|
209
|
+
realex_visa:
|
210
|
+
number:
|
211
|
+
month: '6'
|
212
|
+
year: '2020'
|
213
|
+
verification_value: '123'
|
214
|
+
|
215
|
+
realex_visa_declined:
|
216
|
+
number:
|
217
|
+
month: '6'
|
218
|
+
year: '2020'
|
219
|
+
verification_value: '123'
|
220
|
+
|
221
|
+
realex_visa_referral_a:
|
222
|
+
number:
|
223
|
+
month: '6'
|
224
|
+
year: '2020'
|
225
|
+
verification_value: '123'
|
226
|
+
|
227
|
+
realex_visa_referral_b:
|
228
|
+
number:
|
229
|
+
month: '6'
|
230
|
+
year: '2020'
|
231
|
+
verification_value: '123'
|
232
|
+
|
233
|
+
realex_visa_coms_error:
|
234
|
+
number:
|
235
|
+
month: '6'
|
236
|
+
year: '2020'
|
237
|
+
verification_value: '123'
|
238
|
+
|
239
|
+
realex_mastercard:
|
240
|
+
number:
|
241
|
+
month: '6'
|
242
|
+
year: '2020'
|
243
|
+
verification_value: '123'
|
244
|
+
|
245
|
+
realex_mastercard_declined:
|
246
|
+
number:
|
247
|
+
month: '6'
|
248
|
+
year: '2020'
|
249
|
+
verification_value: '123'
|
250
|
+
|
251
|
+
realex_mastercard_referral_a:
|
252
|
+
number:
|
253
|
+
month: '6'
|
254
|
+
year: '2020'
|
255
|
+
verification_value: '123'
|
256
|
+
|
257
|
+
realex_mastercard_referral_b:
|
258
|
+
number:
|
259
|
+
month: '6'
|
260
|
+
year: '2020'
|
261
|
+
verification_value: '123'
|
262
|
+
|
263
|
+
realex_mastercard_coms_error:
|
264
|
+
number:
|
265
|
+
month: '6'
|
266
|
+
year: '2020'
|
267
|
+
verification_value: '123'
|
268
|
+
|
269
|
+
sage:
|
270
|
+
login: login
|
271
|
+
password: password
|
272
|
+
|
273
|
+
secure_pay:
|
274
|
+
login: LOGIN
|
275
|
+
password: PASSWORD
|
276
|
+
|
277
|
+
secure_pay_tech:
|
278
|
+
login: TESTDIGISPL1
|
279
|
+
password: d557591484cb2cd12bba445aba420d2c69cd6a88
|
280
|
+
|
281
|
+
secure_pay_au:
|
282
|
+
login:
|
283
|
+
password:
|
284
|
+
|
285
|
+
# Replace with your serial numbers for the skipjack test environment
|
286
|
+
skipjack:
|
287
|
+
login: X
|
288
|
+
password: Y
|
289
|
+
|
290
|
+
trans_first:
|
291
|
+
login: LOGIN
|
292
|
+
password: PASSWORD
|
293
|
+
|
294
|
+
# Working credentials, no need to replace
|
295
|
+
trust_commerce:
|
296
|
+
login: 'TestMerchant'
|
297
|
+
password: 'password'
|
298
|
+
|
299
|
+
# Working credentials, no need to replace
|
300
|
+
usa_epay:
|
301
|
+
login: 'yCaWGYQsSVR0S48B6AKMK07RQhaxHvGu'
|
302
|
+
|
303
|
+
# Working credentials, no need to replace
|
304
|
+
verify:
|
305
|
+
login: 'demo'
|
306
|
+
password: 'password'
|
307
|
+
|
308
|
+
viaklix:
|
309
|
+
login: LOGIN
|
310
|
+
password: PASSWORD
|
311
|
+
user: USER
|
312
|
+
|
313
|
+
# Working test credentials, no need to replace
|
314
|
+
wirecard:
|
315
|
+
login: 56500
|
316
|
+
password: TestXAPTER
|
317
|
+
|
@@ -0,0 +1,459 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
require 'pp'
|
3
|
+
|
4
|
+
class AuthorizeNetCimTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
Base.mode = :test
|
7
|
+
|
8
|
+
@gateway = AuthorizeNetCimGateway.new(fixtures(:authorize_net))
|
9
|
+
@amount = 100
|
10
|
+
@credit_card = credit_card('4242424242424242')
|
11
|
+
@payment = {
|
12
|
+
:credit_card => @credit_card
|
13
|
+
}
|
14
|
+
@profile = {
|
15
|
+
:merchant_customer_id => 'Up to 20 chars', # Optional
|
16
|
+
:description => 'Up to 255 Characters', # Optional
|
17
|
+
:email => 'Up to 255 Characters', # Optional
|
18
|
+
:payment_profiles => { # Optional
|
19
|
+
:customer_type => 'individual', # Optional
|
20
|
+
:bill_to => @address,
|
21
|
+
:payment => @payment
|
22
|
+
},
|
23
|
+
:ship_to_list => {
|
24
|
+
:first_name => 'John',
|
25
|
+
:last_name => 'Doe',
|
26
|
+
:company => 'Widgets, Inc',
|
27
|
+
:address1 => '1234 Fake Street',
|
28
|
+
:city => 'Anytown',
|
29
|
+
:state => 'MD',
|
30
|
+
:zip => '12345',
|
31
|
+
:country => 'USA',
|
32
|
+
:phone_number => '(123)123-1234', # Optional - Up to 25 digits (no letters)
|
33
|
+
:fax_number => '(123)123-1234' # Optional - Up to 25 digits (no letters)
|
34
|
+
}
|
35
|
+
}
|
36
|
+
@options = {
|
37
|
+
:ref_id => '1234', # Optional
|
38
|
+
:profile => @profile
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def teardown
|
43
|
+
if @customer_profile_id
|
44
|
+
assert response = @gateway.delete_customer_profile(:customer_profile_id => @customer_profile_id)
|
45
|
+
assert_success response
|
46
|
+
@customer_profile_id = nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_successful_profile_create_get_update_and_delete
|
51
|
+
assert response = @gateway.create_customer_profile(@options)
|
52
|
+
@customer_profile_id = response.authorization
|
53
|
+
|
54
|
+
assert_success response
|
55
|
+
assert response.test?
|
56
|
+
|
57
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
58
|
+
assert response.test?
|
59
|
+
assert_success response
|
60
|
+
assert_equal @customer_profile_id, response.authorization
|
61
|
+
assert_equal 'Successful.', response.message
|
62
|
+
assert response.params['profile']['payment_profiles']['customer_payment_profile_id'] =~ /\d+/, 'The customer_payment_profile_id should be a number'
|
63
|
+
assert_equal "XXXX#{@credit_card.last_digits}", response.params['profile']['payment_profiles']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in #{@credit_card.last_digits}"
|
64
|
+
assert_equal @profile[:merchant_customer_id], response.params['profile']['merchant_customer_id']
|
65
|
+
assert_equal @profile[:description], response.params['profile']['description']
|
66
|
+
assert_equal @profile[:email], response.params['profile']['email']
|
67
|
+
assert_equal @profile[:payment_profiles][:customer_type], response.params['profile']['payment_profiles']['customer_type']
|
68
|
+
assert_equal @profile[:ship_to_list][:phone_number], response.params['profile']['ship_to_list']['phone_number']
|
69
|
+
assert_equal @profile[:ship_to_list][:company], response.params['profile']['ship_to_list']['company']
|
70
|
+
|
71
|
+
assert response = @gateway.update_customer_profile(:profile => {:customer_profile_id => @customer_profile_id, :email => 'new email address'})
|
72
|
+
assert response.test?
|
73
|
+
assert_success response
|
74
|
+
assert_nil response.authorization
|
75
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
76
|
+
assert_nil response.params['profile']['merchant_customer_id']
|
77
|
+
assert_nil response.params['profile']['description']
|
78
|
+
assert_equal 'new email address', response.params['profile']['email']
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_successful_create_customer_profile_transaction_auth_only_and_then_capture_only_requests
|
82
|
+
assert response = @gateway.create_customer_profile(@options)
|
83
|
+
@customer_profile_id = response.authorization
|
84
|
+
|
85
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
86
|
+
@customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
|
87
|
+
|
88
|
+
assert response = @gateway.create_customer_profile_transaction(
|
89
|
+
:transaction => {
|
90
|
+
:customer_profile_id => @customer_profile_id,
|
91
|
+
:customer_payment_profile_id => @customer_payment_profile_id,
|
92
|
+
:type => :auth_only,
|
93
|
+
:amount => @amount
|
94
|
+
}
|
95
|
+
)
|
96
|
+
|
97
|
+
assert response.test?
|
98
|
+
assert_success response
|
99
|
+
assert_nil response.authorization
|
100
|
+
assert_equal "This transaction has been approved.", response.params['direct_response']['message']
|
101
|
+
assert response.params['direct_response']['approval_code'] =~ /\w{6}/
|
102
|
+
assert_equal "auth_only", response.params['direct_response']['transaction_type']
|
103
|
+
assert_equal "100.00", response.params['direct_response']['amount']
|
104
|
+
|
105
|
+
approval_code = response.params['direct_response']['approval_code']
|
106
|
+
|
107
|
+
# Capture the previously authorized funds
|
108
|
+
|
109
|
+
assert response = @gateway.create_customer_profile_transaction(
|
110
|
+
:transaction => {
|
111
|
+
:customer_profile_id => @customer_profile_id,
|
112
|
+
:customer_payment_profile_id => @customer_payment_profile_id,
|
113
|
+
:type => :capture_only,
|
114
|
+
:amount => @amount,
|
115
|
+
:approval_code => approval_code
|
116
|
+
}
|
117
|
+
)
|
118
|
+
|
119
|
+
assert response.test?
|
120
|
+
assert_success response
|
121
|
+
assert_nil response.authorization
|
122
|
+
assert_equal "This transaction has been approved.", response.params['direct_response']['message']
|
123
|
+
assert_equal approval_code, response.params['direct_response']['approval_code']
|
124
|
+
assert_equal "capture_only", response.params['direct_response']['transaction_type']
|
125
|
+
assert_equal "100.00", response.params['direct_response']['amount']
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_successful_create_customer_profile_transaction_auth_capture_request
|
129
|
+
assert response = @gateway.create_customer_profile(@options)
|
130
|
+
@customer_profile_id = response.authorization
|
131
|
+
|
132
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
133
|
+
@customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
|
134
|
+
|
135
|
+
assert response = @gateway.create_customer_profile_transaction(
|
136
|
+
:transaction => {
|
137
|
+
:customer_profile_id => @customer_profile_id,
|
138
|
+
:customer_payment_profile_id => @customer_payment_profile_id,
|
139
|
+
:type => :auth_capture,
|
140
|
+
:order => {
|
141
|
+
:invoice_number => '1234',
|
142
|
+
:description => 'Test Order Description',
|
143
|
+
:purchase_order_number => '4321'
|
144
|
+
},
|
145
|
+
:amount => @amount
|
146
|
+
}
|
147
|
+
)
|
148
|
+
|
149
|
+
assert response.test?
|
150
|
+
assert_success response
|
151
|
+
assert_nil response.authorization
|
152
|
+
assert_equal "This transaction has been approved.", response.params['direct_response']['message']
|
153
|
+
assert response.params['direct_response']['approval_code'] =~ /\w{6}/
|
154
|
+
assert_equal "auth_capture", response.params['direct_response']['transaction_type']
|
155
|
+
assert_equal "100.00", response.params['direct_response']['amount']
|
156
|
+
assert_equal response.params['direct_response']['invoice_number'], '1234'
|
157
|
+
assert_equal response.params['direct_response']['order_description'], 'Test Order Description'
|
158
|
+
assert_equal response.params['direct_response']['purchase_order_number'], '4321'
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_successful_create_customer_payment_profile_request
|
162
|
+
payment_profile = @options[:profile].delete(:payment_profiles)
|
163
|
+
assert response = @gateway.create_customer_profile(@options)
|
164
|
+
@customer_profile_id = response.authorization
|
165
|
+
|
166
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
167
|
+
assert_nil response.params['profile']['payment_profiles']
|
168
|
+
|
169
|
+
assert response = @gateway.create_customer_payment_profile(
|
170
|
+
:customer_profile_id => @customer_profile_id,
|
171
|
+
:payment_profile => payment_profile
|
172
|
+
)
|
173
|
+
|
174
|
+
assert response.test?
|
175
|
+
assert_success response
|
176
|
+
assert_nil response.authorization
|
177
|
+
assert customer_payment_profile_id = response.params['customer_payment_profile_id']
|
178
|
+
assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_successful_create_customer_payment_profile_request_with_bank_account
|
182
|
+
payment_profile = @options[:profile].delete(:payment_profiles)
|
183
|
+
assert response = @gateway.create_customer_profile(@options)
|
184
|
+
@customer_profile_id = response.authorization
|
185
|
+
|
186
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
187
|
+
assert_nil response.params['profile']['payment_profiles']
|
188
|
+
|
189
|
+
assert response = @gateway.create_customer_payment_profile(
|
190
|
+
:customer_profile_id => @customer_profile_id,
|
191
|
+
:payment_profile => {
|
192
|
+
:customer_type => 'individual', # Optional
|
193
|
+
:bill_to => @address,
|
194
|
+
:payment => {
|
195
|
+
:bank_account => {
|
196
|
+
:account_type => :checking,
|
197
|
+
:name_on_account => 'John Doe',
|
198
|
+
:echeck_type => :ccd,
|
199
|
+
:bank_name => 'Bank of America',
|
200
|
+
:routing_number => '123456789',
|
201
|
+
:account_number => '12345'
|
202
|
+
}
|
203
|
+
},
|
204
|
+
:drivers_license => {
|
205
|
+
:state => 'MD',
|
206
|
+
:number => '12345',
|
207
|
+
:date_of_birth => '1981-3-31'
|
208
|
+
},
|
209
|
+
:tax_id => '123456789'
|
210
|
+
}
|
211
|
+
)
|
212
|
+
|
213
|
+
assert response.test?
|
214
|
+
assert_success response
|
215
|
+
assert_nil response.authorization
|
216
|
+
assert customer_payment_profile_id = response.params['customer_payment_profile_id']
|
217
|
+
assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
|
218
|
+
end
|
219
|
+
|
220
|
+
def test_successful_create_customer_shipping_address_request
|
221
|
+
shipping_address = @options[:profile].delete(:ship_to_list)
|
222
|
+
assert response = @gateway.create_customer_profile(@options)
|
223
|
+
@customer_profile_id = response.authorization
|
224
|
+
|
225
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
226
|
+
assert_nil response.params['profile']['ship_to_list']
|
227
|
+
|
228
|
+
assert response = @gateway.create_customer_shipping_address(
|
229
|
+
:customer_profile_id => @customer_profile_id,
|
230
|
+
:address => shipping_address
|
231
|
+
)
|
232
|
+
|
233
|
+
assert response.test?
|
234
|
+
assert_success response
|
235
|
+
assert_nil response.authorization
|
236
|
+
assert customer_address_id = response.params['customer_address_id']
|
237
|
+
assert customer_address_id =~ /\d+/, "The customerAddressId should be numeric. It was #{customer_address_id}"
|
238
|
+
end
|
239
|
+
|
240
|
+
def test_successful_get_customer_profile_with_multiple_payment_profiles
|
241
|
+
second_payment_profile = {
|
242
|
+
:customer_type => 'individual',
|
243
|
+
:bill_to => @address,
|
244
|
+
:payment => {
|
245
|
+
:credit_card => credit_card('1234123412341234')
|
246
|
+
}
|
247
|
+
}
|
248
|
+
assert response = @gateway.create_customer_profile(@options)
|
249
|
+
@customer_profile_id = response.authorization
|
250
|
+
|
251
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
252
|
+
|
253
|
+
assert response = @gateway.create_customer_payment_profile(
|
254
|
+
:customer_profile_id => @customer_profile_id,
|
255
|
+
:payment_profile => second_payment_profile
|
256
|
+
)
|
257
|
+
|
258
|
+
assert response.test?
|
259
|
+
assert_success response
|
260
|
+
assert_nil response.authorization
|
261
|
+
assert customer_payment_profile_id = response.params['customer_payment_profile_id']
|
262
|
+
assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
|
263
|
+
|
264
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
265
|
+
assert_equal 2, response.params['profile']['payment_profiles'].size
|
266
|
+
assert_equal 'XXXX4242', response.params['profile']['payment_profiles'][0]['payment']['credit_card']['card_number']
|
267
|
+
assert_equal 'XXXX1234', response.params['profile']['payment_profiles'][1]['payment']['credit_card']['card_number']
|
268
|
+
end
|
269
|
+
|
270
|
+
def test_successful_delete_customer_payment_profile_request
|
271
|
+
assert response = @gateway.create_customer_profile(@options)
|
272
|
+
@customer_profile_id = response.authorization
|
273
|
+
|
274
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
275
|
+
assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
|
276
|
+
|
277
|
+
assert response = @gateway.delete_customer_payment_profile(
|
278
|
+
:customer_profile_id => @customer_profile_id,
|
279
|
+
:customer_payment_profile_id => customer_payment_profile_id
|
280
|
+
)
|
281
|
+
|
282
|
+
assert response.test?
|
283
|
+
assert_success response
|
284
|
+
assert_nil response.authorization
|
285
|
+
|
286
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
287
|
+
assert_nil response.params['profile']['payment_profiles']
|
288
|
+
end
|
289
|
+
|
290
|
+
def test_successful_delete_customer_shipping_address_request
|
291
|
+
assert response = @gateway.create_customer_profile(@options)
|
292
|
+
@customer_profile_id = response.authorization
|
293
|
+
|
294
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
295
|
+
assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
|
296
|
+
|
297
|
+
assert response = @gateway.delete_customer_shipping_address(
|
298
|
+
:customer_profile_id => @customer_profile_id,
|
299
|
+
:customer_address_id => customer_address_id
|
300
|
+
)
|
301
|
+
|
302
|
+
assert response.test?
|
303
|
+
assert_success response
|
304
|
+
assert_nil response.authorization
|
305
|
+
|
306
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
307
|
+
assert_nil response.params['profile']['ship_to_list']
|
308
|
+
end
|
309
|
+
|
310
|
+
def test_successful_get_customer_payment_profile_request
|
311
|
+
assert response = @gateway.create_customer_profile(@options)
|
312
|
+
@customer_profile_id = response.authorization
|
313
|
+
|
314
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
315
|
+
assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
|
316
|
+
|
317
|
+
assert response = @gateway.get_customer_payment_profile(
|
318
|
+
:customer_profile_id => @customer_profile_id,
|
319
|
+
:customer_payment_profile_id => customer_payment_profile_id
|
320
|
+
)
|
321
|
+
|
322
|
+
assert response.test?
|
323
|
+
assert_success response
|
324
|
+
assert_nil response.authorization
|
325
|
+
assert response.params['payment_profile']['customer_payment_profile_id'] =~ /\d+/, 'The customer_payment_profile_id should be a number'
|
326
|
+
assert_equal "XXXX#{@credit_card.last_digits}", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in #{@credit_card.last_digits}"
|
327
|
+
assert_equal @profile[:payment_profiles][:customer_type], response.params['payment_profile']['customer_type']
|
328
|
+
end
|
329
|
+
|
330
|
+
def test_successful_get_customer_shipping_address_request
|
331
|
+
assert response = @gateway.create_customer_profile(@options)
|
332
|
+
@customer_profile_id = response.authorization
|
333
|
+
|
334
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
335
|
+
assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
|
336
|
+
|
337
|
+
assert response = @gateway.get_customer_shipping_address(
|
338
|
+
:customer_profile_id => @customer_profile_id,
|
339
|
+
:customer_address_id => customer_address_id
|
340
|
+
)
|
341
|
+
|
342
|
+
assert response.test?
|
343
|
+
assert_success response
|
344
|
+
assert_nil response.authorization
|
345
|
+
assert response.params['address']['customer_address_id'] =~ /\d+/, 'The customer_address_id should be a number'
|
346
|
+
assert_equal @profile[:ship_to_list][:city], response.params['address']['city']
|
347
|
+
end
|
348
|
+
|
349
|
+
def test_successful_update_customer_payment_profile_request
|
350
|
+
# Create a new Customer Profile with Payment Profile
|
351
|
+
assert response = @gateway.create_customer_profile(@options)
|
352
|
+
@customer_profile_id = response.authorization
|
353
|
+
|
354
|
+
# Get the customerPaymentProfileId
|
355
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
356
|
+
assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
|
357
|
+
|
358
|
+
# Get the customerPaymentProfile
|
359
|
+
assert response = @gateway.get_customer_payment_profile(
|
360
|
+
:customer_profile_id => @customer_profile_id,
|
361
|
+
:customer_payment_profile_id => customer_payment_profile_id
|
362
|
+
)
|
363
|
+
|
364
|
+
# The value before updating
|
365
|
+
assert_equal "XXXX4242", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in 4242"
|
366
|
+
|
367
|
+
#Update the payment profile
|
368
|
+
assert response = @gateway.update_customer_payment_profile(
|
369
|
+
:customer_profile_id => @customer_profile_id,
|
370
|
+
:payment_profile => {
|
371
|
+
:customer_payment_profile_id => customer_payment_profile_id,
|
372
|
+
:payment => {
|
373
|
+
:credit_card => credit_card('1234123412341234')
|
374
|
+
}
|
375
|
+
}
|
376
|
+
)
|
377
|
+
assert response.test?
|
378
|
+
assert_success response
|
379
|
+
assert_nil response.authorization
|
380
|
+
|
381
|
+
# Get the updated payment profile
|
382
|
+
assert response = @gateway.get_customer_payment_profile(
|
383
|
+
:customer_profile_id => @customer_profile_id,
|
384
|
+
:customer_payment_profile_id => customer_payment_profile_id
|
385
|
+
)
|
386
|
+
|
387
|
+
# Show that the payment profile was updated
|
388
|
+
assert_equal "XXXX1234", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in: 1234"
|
389
|
+
# Show that fields that were left out of the update were cleared
|
390
|
+
assert_nil response.params['payment_profile']['customer_type']
|
391
|
+
end
|
392
|
+
|
393
|
+
def test_successful_update_customer_shipping_address_request
|
394
|
+
# Create a new Customer Profile with Shipping Address
|
395
|
+
assert response = @gateway.create_customer_profile(@options)
|
396
|
+
@customer_profile_id = response.authorization
|
397
|
+
|
398
|
+
# Get the customerAddressId
|
399
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
400
|
+
assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
|
401
|
+
|
402
|
+
# Get the customerShippingAddress
|
403
|
+
assert response = @gateway.get_customer_shipping_address(
|
404
|
+
:customer_profile_id => @customer_profile_id,
|
405
|
+
:customer_address_id => customer_address_id
|
406
|
+
)
|
407
|
+
|
408
|
+
assert address = response.params['address']
|
409
|
+
# The value before updating
|
410
|
+
assert_equal "1234 Fake Street", address['address']
|
411
|
+
|
412
|
+
# Update the address and remove the phone_number
|
413
|
+
new_address = address.symbolize_keys.merge!(
|
414
|
+
:address => '5678 Fake Street'
|
415
|
+
)
|
416
|
+
new_address.delete(:phone_number)
|
417
|
+
|
418
|
+
#Update the shipping address
|
419
|
+
assert response = @gateway.update_customer_shipping_address(
|
420
|
+
:customer_profile_id => @customer_profile_id,
|
421
|
+
:address => new_address
|
422
|
+
)
|
423
|
+
assert response.test?
|
424
|
+
assert_success response
|
425
|
+
assert_nil response.authorization
|
426
|
+
|
427
|
+
# Get the updated shipping address
|
428
|
+
assert response = @gateway.get_customer_shipping_address(
|
429
|
+
:customer_profile_id => @customer_profile_id,
|
430
|
+
:customer_address_id => customer_address_id
|
431
|
+
)
|
432
|
+
|
433
|
+
# Show that the shipping address was updated
|
434
|
+
assert_equal "5678 Fake Street", response.params['address']['address']
|
435
|
+
# Show that fields that were left out of the update were cleared
|
436
|
+
assert_nil response.params['address']['phone_number']
|
437
|
+
end
|
438
|
+
|
439
|
+
def test_successful_validate_customer_payment_profile_request
|
440
|
+
assert response = @gateway.create_customer_profile(@options)
|
441
|
+
@customer_profile_id = response.authorization
|
442
|
+
|
443
|
+
assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
|
444
|
+
assert @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
|
445
|
+
assert @customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
|
446
|
+
|
447
|
+
assert response = @gateway.validate_customer_payment_profile(
|
448
|
+
:customer_profile_id => @customer_profile_id,
|
449
|
+
:customer_payment_profile_id => @customer_payment_profile_id,
|
450
|
+
:customer_address_id => @customer_address_id,
|
451
|
+
:validation_mode => :live
|
452
|
+
)
|
453
|
+
|
454
|
+
assert response.test?
|
455
|
+
assert_success response
|
456
|
+
assert_nil response.authorization
|
457
|
+
assert_equal "This transaction has been approved.", response.params['direct_response']['message']
|
458
|
+
end
|
459
|
+
end
|