vaulted_billing 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/LICENSE +19 -0
  2. data/lib/vaulted_billing/gateways/bogus.rb +2 -0
  3. data/lib/vaulted_billing/version.rb +1 -1
  4. data/spec/certification/ipcommerce/README.md +9 -0
  5. data/spec/certification/ipcommerce/TODO.md +1 -0
  6. data/spec/certification/ipcommerce/host_capture_ecommerce.rb +318 -0
  7. data/spec/certification/ipcommerce/ipcommerce_transaction.rb +28 -0
  8. data/spec/certification/ipcommerce/terminal_capture_ecommerce.rb +298 -0
  9. data/spec/config.example.yml +18 -0
  10. data/spec/factories/credit_cards.rb +38 -0
  11. data/spec/factories/customers.rb +7 -0
  12. data/spec/factories/sequences.rb +22 -0
  13. data/spec/fixtures/net/authorize_net_cim/add_customer/failure.yml +38 -0
  14. data/spec/fixtures/net/authorize_net_cim/add_customer/success.yml +39 -0
  15. data/spec/fixtures/net/authorize_net_cim/add_customer_credit_card/failure.yml +83 -0
  16. data/spec/fixtures/net/authorize_net_cim/add_customer_credit_card/success.yml +81 -0
  17. data/spec/fixtures/net/authorize_net_cim/authorize/failure.yml +121 -0
  18. data/spec/fixtures/net/authorize_net_cim/authorize/success.yml +121 -0
  19. data/spec/fixtures/net/authorize_net_cim/capture/failure.yml +161 -0
  20. data/spec/fixtures/net/authorize_net_cim/capture/success.yml +160 -0
  21. data/spec/fixtures/net/authorize_net_cim/purchase/failure.yml +122 -0
  22. data/spec/fixtures/net/authorize_net_cim/purchase/success.yml +122 -0
  23. data/spec/fixtures/net/authorize_net_cim/refund/failure.yml +123 -0
  24. data/spec/fixtures/net/authorize_net_cim/refund/failure_2.yml +43 -0
  25. data/spec/fixtures/net/authorize_net_cim/remove_customer/failure.yml +76 -0
  26. data/spec/fixtures/net/authorize_net_cim/remove_customer/success.yml +75 -0
  27. data/spec/fixtures/net/authorize_net_cim/remove_customer_credit_card/failure.yml +156 -0
  28. data/spec/fixtures/net/authorize_net_cim/remove_customer_credit_card/success.yml +118 -0
  29. data/spec/fixtures/net/authorize_net_cim/update_customer/failure.yml +77 -0
  30. data/spec/fixtures/net/authorize_net_cim/update_customer/success.yml +76 -0
  31. data/spec/fixtures/net/authorize_net_cim/update_customer_credit_card/failure.yml +125 -0
  32. data/spec/fixtures/net/authorize_net_cim/update_customer_credit_card/success.yml +124 -0
  33. data/spec/fixtures/net/authorize_net_cim/void/success.yml +159 -0
  34. data/spec/fixtures/net/ipcommerce/add_customer_credit_card/failure.yml +53 -0
  35. data/spec/fixtures/net/ipcommerce/add_customer_credit_card/success.yml +103 -0
  36. data/spec/fixtures/net/ipcommerce/authorize/existing/failure.yml +51 -0
  37. data/spec/fixtures/net/ipcommerce/authorize/existing/success.yml +105 -0
  38. data/spec/fixtures/net/ipcommerce/authorize/new/avs/bad_format.yml +53 -0
  39. data/spec/fixtures/net/ipcommerce/authorize/new/avs/issuer_not_certified.yml +53 -0
  40. data/spec/fixtures/net/ipcommerce/authorize/new/avs/match.yml +53 -0
  41. data/spec/fixtures/net/ipcommerce/authorize/new/avs/no_match.yml +53 -0
  42. data/spec/fixtures/net/ipcommerce/authorize/new/avs/no_response_from_card_association.yml +53 -0
  43. data/spec/fixtures/net/ipcommerce/authorize/new/avs/not_included.yml +53 -0
  44. data/spec/fixtures/net/ipcommerce/authorize/new/avs/not_sent.yml +53 -0
  45. data/spec/fixtures/net/ipcommerce/authorize/new/avs/not_verified.yml +53 -0
  46. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/invalid.yml +53 -0
  47. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/issuer_not_certified.yml +53 -0
  48. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/no_code_present.yml +53 -0
  49. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/no_match.yml +53 -0
  50. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/no_response.yml +53 -0
  51. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/not_applicable.yml +53 -0
  52. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/not_processed.yml +53 -0
  53. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/should_have_been_present.yml +53 -0
  54. data/spec/fixtures/net/ipcommerce/authorize/new/failure.yml +53 -0
  55. data/spec/fixtures/net/ipcommerce/authorize/new/success.yml +53 -0
  56. data/spec/fixtures/net/ipcommerce/capture/failure.yml +78 -0
  57. data/spec/fixtures/net/ipcommerce/capture/invalid.yml +78 -0
  58. data/spec/fixtures/net/ipcommerce/capture/success.yml +78 -0
  59. data/spec/fixtures/net/ipcommerce/failover.yml +53 -0
  60. data/spec/fixtures/net/ipcommerce/purchase/existing/failure.yml +51 -0
  61. data/spec/fixtures/net/ipcommerce/purchase/existing/success.yml +105 -0
  62. data/spec/fixtures/net/ipcommerce/purchase/new/failure.yml +53 -0
  63. data/spec/fixtures/net/ipcommerce/purchase/new/success.yml +53 -0
  64. data/spec/fixtures/net/ipcommerce/refund/failure.yml +78 -0
  65. data/spec/fixtures/net/ipcommerce/refund/success.yml +80 -0
  66. data/spec/fixtures/net/ipcommerce/update_customer_credit_card/failure.yml +53 -0
  67. data/spec/fixtures/net/ipcommerce/update_customer_credit_card/success.yml +103 -0
  68. data/spec/fixtures/net/ipcommerce/void/failure.yml +78 -0
  69. data/spec/fixtures/net/ipcommerce/void/success.yml +78 -0
  70. data/spec/fixtures/net/nmi_customer_vault/add_customer_credit_card/failure.yml +26 -0
  71. data/spec/fixtures/net/nmi_customer_vault/add_customer_credit_card/success.yml +26 -0
  72. data/spec/fixtures/net/nmi_customer_vault/authorize/decline.yml +51 -0
  73. data/spec/fixtures/net/nmi_customer_vault/authorize/success.yml +51 -0
  74. data/spec/fixtures/net/nmi_customer_vault/capture/failure.yml +76 -0
  75. data/spec/fixtures/net/nmi_customer_vault/capture/success.yml +76 -0
  76. data/spec/fixtures/net/nmi_customer_vault/purchase/decline.yml +51 -0
  77. data/spec/fixtures/net/nmi_customer_vault/purchase/success.yml +51 -0
  78. data/spec/fixtures/net/nmi_customer_vault/refund/failure.yml +101 -0
  79. data/spec/fixtures/net/nmi_customer_vault/remove_customer_credit_card/failure.yml +26 -0
  80. data/spec/fixtures/net/nmi_customer_vault/remove_customer_credit_card/success.yml +51 -0
  81. data/spec/fixtures/net/nmi_customer_vault/update_customer_credit_card/success.yml +51 -0
  82. data/spec/fixtures/net/nmi_customer_vault/void/failure.yml +26 -0
  83. data/spec/fixtures/net/nmi_customer_vault/void/success.yml +76 -0
  84. data/spec/models/vaulted_billing/configuration_spec.rb +62 -0
  85. data/spec/models/vaulted_billing/core_ext/hash_spec.rb +47 -0
  86. data/spec/models/vaulted_billing/credit_card_spec.rb +61 -0
  87. data/spec/models/vaulted_billing/gateway_spec.rb +115 -0
  88. data/spec/models/vaulted_billing/http_spec.rb +154 -0
  89. data/spec/models/vaulted_billing/transaction_spec.rb +60 -0
  90. data/spec/models/vaulted_billing_spec.rb +16 -0
  91. data/spec/requests/authorize_net_cim_spec.rb +506 -0
  92. data/spec/requests/bogus_spec.rb +144 -0
  93. data/spec/requests/ipcommerce_spec.rb +518 -0
  94. data/spec/requests/nmi_customer_vault_spec.rb +390 -0
  95. data/spec/spec_helper.rb +12 -0
  96. data/spec/support/_vaulted_billing.rb +8 -0
  97. data/spec/support/factory_girl.rb +5 -0
  98. data/spec/support/faker.rb +1 -0
  99. data/spec/support/helpers.rb +46 -0
  100. data/spec/support/logging.rb +2 -0
  101. data/spec/support/test_exception.rb +1 -0
  102. data/spec/support/vcr.rb +49 -0
  103. data/spec/support/webmock.rb +7 -0
  104. metadata +312 -37
@@ -0,0 +1,51 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://secure.nmi.com:443/api/transact.php
6
+ body: address1=25854 Hirthe Heights&ccexp=0213&ccnumber=343364053762320&city=Majorfurt&country=US&customer_vault=add_customer&email=berenice_simonis@conroy.org&first_name=Burdette&last_name=Gutmann&method=creditcard&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&phone=772.506.9498&state=Georgia&username=%{NMI_CUSTOMER_VAULT_USERNAME}&zip=51096
7
+ headers:
8
+ user-agent:
9
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - text/html
19
+ server:
20
+ - Apache
21
+ date:
22
+ - Wed, 29 Feb 2012 04:48:57 GMT
23
+ content-length:
24
+ - "203"
25
+ body: response=1&responsetext=Customer Added&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=1510967866
26
+ http_version: "1.1"
27
+ - !ruby/struct:VCR::HTTPInteraction
28
+ request: !ruby/struct:VCR::Request
29
+ method: :post
30
+ uri: https://secure.nmi.com:443/api/transact.php
31
+ body: amount=1.0&customer_vault_id=1510967866&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&type=sale&username=%{NMI_CUSTOMER_VAULT_USERNAME}
32
+ headers:
33
+ user-agent:
34
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
35
+ content-type:
36
+ - application/x-www-form-urlencoded
37
+ response: !ruby/struct:VCR::Response
38
+ status: !ruby/struct:VCR::ResponseStatus
39
+ code: 200
40
+ message: OK
41
+ headers:
42
+ content-type:
43
+ - text/html
44
+ server:
45
+ - Apache
46
+ date:
47
+ - Wed, 29 Feb 2012 04:48:58 GMT
48
+ content-length:
49
+ - "217"
50
+ body: response=1&responsetext=SUCCESS&authcode=123456&transactionid=1573007874&avsresponse=N&cvvresponse=&orderid=&type=sale&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=1510967866
51
+ http_version: "1.1"
@@ -0,0 +1,101 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://secure.nmi.com:443/api/transact.php
6
+ body: address1=393 Cristian Stravenue&ccexp=0213&ccnumber=4913379750143840&city=Spencerview&country=US&customer_vault=add_customer&email=florine@purdy.org&first_name=Gage&last_name=Konopelski&method=creditcard&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&phone=934-384-2367 x09900&state=Alaska&username=%{NMI_CUSTOMER_VAULT_USERNAME}&zip=30806
7
+ headers:
8
+ user-agent:
9
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - text/html
19
+ server:
20
+ - Apache
21
+ date:
22
+ - Wed, 29 Feb 2012 04:49:20 GMT
23
+ content-length:
24
+ - "203"
25
+ body: response=1&responsetext=Customer Added&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=1228827355
26
+ http_version: "1.1"
27
+ - !ruby/struct:VCR::HTTPInteraction
28
+ request: !ruby/struct:VCR::Request
29
+ method: :post
30
+ uri: https://secure.nmi.com:443/api/transact.php
31
+ body: amount=5.0&customer_vault_id=1228827355&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&type=auth&username=%{NMI_CUSTOMER_VAULT_USERNAME}
32
+ headers:
33
+ user-agent:
34
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
35
+ content-type:
36
+ - application/x-www-form-urlencoded
37
+ response: !ruby/struct:VCR::Response
38
+ status: !ruby/struct:VCR::ResponseStatus
39
+ code: 200
40
+ message: OK
41
+ headers:
42
+ content-type:
43
+ - text/html
44
+ server:
45
+ - Apache
46
+ date:
47
+ - Wed, 29 Feb 2012 04:49:21 GMT
48
+ content-length:
49
+ - "217"
50
+ body: response=1&responsetext=SUCCESS&authcode=123456&transactionid=1573007953&avsresponse=N&cvvresponse=&orderid=&type=auth&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=1228827355
51
+ http_version: "1.1"
52
+ - !ruby/struct:VCR::HTTPInteraction
53
+ request: !ruby/struct:VCR::Request
54
+ method: :post
55
+ uri: https://secure.nmi.com:443/api/transact.php
56
+ body: amount=3.0&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&transactionid=1573007953&type=capture&username=%{NMI_CUSTOMER_VAULT_USERNAME}
57
+ headers:
58
+ user-agent:
59
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
60
+ content-type:
61
+ - application/x-www-form-urlencoded
62
+ response: !ruby/struct:VCR::Response
63
+ status: !ruby/struct:VCR::ResponseStatus
64
+ code: 200
65
+ message: OK
66
+ headers:
67
+ content-type:
68
+ - text/html
69
+ server:
70
+ - Apache
71
+ date:
72
+ - Wed, 29 Feb 2012 04:49:24 GMT
73
+ content-length:
74
+ - "209"
75
+ body: response=1&responsetext=SUCCESS&authcode=123456&transactionid=1573007953&avsresponse=&cvvresponse=&orderid=&type=capture&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=
76
+ http_version: "1.1"
77
+ - !ruby/struct:VCR::HTTPInteraction
78
+ request: !ruby/struct:VCR::Request
79
+ method: :post
80
+ uri: https://secure.nmi.com:443/api/transact.php
81
+ body: amount=300.0&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&transactionid=1573007953&type=refund&username=%{NMI_CUSTOMER_VAULT_USERNAME}
82
+ headers:
83
+ user-agent:
84
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
85
+ content-type:
86
+ - application/x-www-form-urlencoded
87
+ response: !ruby/struct:VCR::Response
88
+ status: !ruby/struct:VCR::ResponseStatus
89
+ code: 200
90
+ message: OK
91
+ headers:
92
+ content-type:
93
+ - text/html
94
+ server:
95
+ - Apache
96
+ date:
97
+ - Wed, 29 Feb 2012 04:49:27 GMT
98
+ content-length:
99
+ - "253"
100
+ body: response=3&responsetext=Refund amount may not exceed the transaction balance REFID:327675168&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=refund&response_code=300&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=
101
+ http_version: "1.1"
@@ -0,0 +1,26 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://secure.nmi.com:443/api/transact.php
6
+ body: customer_vault=delete_customer&customer_vault_id=VERYBADIDENTIFIER!&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&username=%{NMI_CUSTOMER_VAULT_USERNAME}
7
+ headers:
8
+ user-agent:
9
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - text/html
19
+ server:
20
+ - Apache
21
+ date:
22
+ - Wed, 29 Feb 2012 04:48:57 GMT
23
+ content-length:
24
+ - "238"
25
+ body: response=3&responsetext=Invalid Customer Vault Id REFID:327675161&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=&response_code=300&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=VERYBADIDENTIFIER!
26
+ http_version: "1.1"
@@ -0,0 +1,51 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://secure.nmi.com:443/api/transact.php
6
+ body: address1=80800 Gusikowski Pine&ccexp=0213&ccnumber=4532409240022071&city=West Fabian&country=US&customer_vault=add_customer&email=estevan@smith.info&first_name=Sydney&last_name=Murray&method=creditcard&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&phone=295-717-3561&state=Oregon&username=%{NMI_CUSTOMER_VAULT_USERNAME}&zip=21704
7
+ headers:
8
+ user-agent:
9
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - text/html
19
+ server:
20
+ - Apache
21
+ date:
22
+ - Wed, 29 Feb 2012 04:48:55 GMT
23
+ content-length:
24
+ - "203"
25
+ body: response=1&responsetext=Customer Added&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=1291691702
26
+ http_version: "1.1"
27
+ - !ruby/struct:VCR::HTTPInteraction
28
+ request: !ruby/struct:VCR::Request
29
+ method: :post
30
+ uri: https://secure.nmi.com:443/api/transact.php
31
+ body: customer_vault=delete_customer&customer_vault_id=1291691702&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&username=%{NMI_CUSTOMER_VAULT_USERNAME}
32
+ headers:
33
+ user-agent:
34
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
35
+ content-type:
36
+ - application/x-www-form-urlencoded
37
+ response: !ruby/struct:VCR::Response
38
+ status: !ruby/struct:VCR::ResponseStatus
39
+ code: 200
40
+ message: OK
41
+ headers:
42
+ content-type:
43
+ - text/html
44
+ server:
45
+ - Apache
46
+ date:
47
+ - Wed, 29 Feb 2012 04:48:56 GMT
48
+ content-length:
49
+ - "205"
50
+ body: response=1&responsetext=Customer Deleted&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=1291691702
51
+ http_version: "1.1"
@@ -0,0 +1,51 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://secure.nmi.com:443/api/transact.php
6
+ body: address1=9980 Leola Glens&ccexp=0213&ccnumber=4539482164563803&city=East Erikahaven&country=US&customer_vault=add_customer&email=jakob@smithambalistreri.name&first_name=Norene&last_name=Leffler&method=creditcard&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&phone=633.300.7146 x678&state=New Mexico&username=%{NMI_CUSTOMER_VAULT_USERNAME}&zip=55257-9479
7
+ headers:
8
+ user-agent:
9
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - text/html
19
+ server:
20
+ - Apache
21
+ date:
22
+ - Wed, 29 Feb 2012 04:48:54 GMT
23
+ content-length:
24
+ - "202"
25
+ body: response=1&responsetext=Customer Added&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=623175640
26
+ http_version: "1.1"
27
+ - !ruby/struct:VCR::HTTPInteraction
28
+ request: !ruby/struct:VCR::Request
29
+ method: :post
30
+ uri: https://secure.nmi.com:443/api/transact.php
31
+ body: address1=9980 Leola Glens&ccexp=0213&ccnumber=4539482164563803&city=East Erikahaven&country=US&customer_vault=update_customer&customer_vault_id=623175640&email=jakob@smithambalistreri.name&first_name=Norene&last_name=Leffler&method=creditcard&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&phone=633.300.7146 x678&state=New Mexico&username=%{NMI_CUSTOMER_VAULT_USERNAME}&zip=55257-9479
32
+ headers:
33
+ user-agent:
34
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
35
+ content-type:
36
+ - application/x-www-form-urlencoded
37
+ response: !ruby/struct:VCR::Response
38
+ status: !ruby/struct:VCR::ResponseStatus
39
+ code: 200
40
+ message: OK
41
+ headers:
42
+ content-type:
43
+ - text/html
44
+ server:
45
+ - Apache
46
+ date:
47
+ - Wed, 29 Feb 2012 04:48:54 GMT
48
+ content-length:
49
+ - "214"
50
+ body: response=1&responsetext=Customer Update Successful&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=623175640
51
+ http_version: "1.1"
@@ -0,0 +1,26 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://secure.nmi.com:443/api/transact.php
6
+ body: "%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&transactionid=INVALIDID&type=void&username=%{NMI_CUSTOMER_VAULT_USERNAME}"
7
+ headers:
8
+ user-agent:
9
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - text/html
19
+ server:
20
+ - Apache
21
+ date:
22
+ - Wed, 29 Feb 2012 04:49:34 GMT
23
+ content-length:
24
+ - "231"
25
+ body: response=3&responsetext=Invalid Transaction ID specified REFID:327675169&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=void&response_code=300&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=
26
+ http_version: "1.1"
@@ -0,0 +1,76 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://secure.nmi.com:443/api/transact.php
6
+ body: address1=4455 Carlee Ford&ccexp=0213&ccnumber=5230002140732287&city=Cleofurt&country=US&customer_vault=add_customer&email=reba@mitchell.info&first_name=Rosalee&last_name=Leffler&method=creditcard&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&phone=069.687.2091&state=Mississippi&username=%{NMI_CUSTOMER_VAULT_USERNAME}&zip=43283
7
+ headers:
8
+ user-agent:
9
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - text/html
19
+ server:
20
+ - Apache
21
+ date:
22
+ - Wed, 29 Feb 2012 04:49:28 GMT
23
+ content-length:
24
+ - "202"
25
+ body: response=1&responsetext=Customer Added&authcode=&transactionid=&avsresponse=&cvvresponse=&orderid=&type=&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=392753311
26
+ http_version: "1.1"
27
+ - !ruby/struct:VCR::HTTPInteraction
28
+ request: !ruby/struct:VCR::Request
29
+ method: :post
30
+ uri: https://secure.nmi.com:443/api/transact.php
31
+ body: amount=5.0&customer_vault_id=392753311&%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&type=auth&username=%{NMI_CUSTOMER_VAULT_USERNAME}
32
+ headers:
33
+ user-agent:
34
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
35
+ content-type:
36
+ - application/x-www-form-urlencoded
37
+ response: !ruby/struct:VCR::Response
38
+ status: !ruby/struct:VCR::ResponseStatus
39
+ code: 200
40
+ message: OK
41
+ headers:
42
+ content-type:
43
+ - text/html
44
+ server:
45
+ - Apache
46
+ date:
47
+ - Wed, 29 Feb 2012 04:49:29 GMT
48
+ content-length:
49
+ - "216"
50
+ body: response=1&responsetext=SUCCESS&authcode=123456&transactionid=1573007988&avsresponse=N&cvvresponse=&orderid=&type=auth&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=392753311
51
+ http_version: "1.1"
52
+ - !ruby/struct:VCR::HTTPInteraction
53
+ request: !ruby/struct:VCR::Request
54
+ method: :post
55
+ uri: https://secure.nmi.com:443/api/transact.php
56
+ body: "%{NMI_CUSTOMER_VAULT_PASSWORD}=%{NMI_CUSTOMER_VAULT_PASSWORD}&transactionid=1573007988&type=void&username=%{NMI_CUSTOMER_VAULT_USERNAME}"
57
+ headers:
58
+ user-agent:
59
+ - vaulted_billing/1.2.1 (Rubygems; Ruby 1.8.7 i686-darwin11.0.0)
60
+ content-type:
61
+ - application/x-www-form-urlencoded
62
+ response: !ruby/struct:VCR::Response
63
+ status: !ruby/struct:VCR::ResponseStatus
64
+ code: 200
65
+ message: OK
66
+ headers:
67
+ content-type:
68
+ - text/html
69
+ server:
70
+ - Apache
71
+ date:
72
+ - Wed, 29 Feb 2012 04:49:31 GMT
73
+ content-length:
74
+ - "226"
75
+ body: response=1&responsetext=Transaction Void Successful&authcode=123456&transactionid=1573007988&avsresponse=&cvvresponse=&orderid=&type=void&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id=
76
+ http_version: "1.1"
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ describe VaultedBilling::Configuration do
4
+ let(:config) { VaultedBilling::Configuration.new }
5
+
6
+ context 'test_mode' do
7
+ subject { config.test_mode }
8
+
9
+ context 'by default' do
10
+ it { should be_true }
11
+ end
12
+
13
+ it { config.test_mode = true; should be_true }
14
+ it { config.test_mode = false; should be_false }
15
+ end
16
+
17
+ context 'ca_file' do
18
+ subject { config.ca_file }
19
+
20
+ context 'by default' do
21
+ it { should match %r{/ext/cacert\.pem$} }
22
+
23
+ it 'exists' do
24
+ File.exist?(config.ca_file).should be_true
25
+ end
26
+ end
27
+
28
+ it { config.ca_file = 'foo.txt'; should == 'foo.txt' }
29
+ end
30
+
31
+ [ 'authorize_net_cim',
32
+ 'ipcommerce',
33
+ 'nmi_customer_vault',
34
+ 'bogus' ].each do |gateway|
35
+ context gateway do
36
+ context 'by default' do
37
+ subject { config.send(gateway) }
38
+ its(:username) { should be_nil }
39
+ its(:password) { should be_nil }
40
+ its(:raw_options) { should be_nil }
41
+ its(:test_mode) { should be_true }
42
+ end
43
+
44
+ context 'with options set' do
45
+ let(:config) do
46
+ VaultedBilling::Configuration.new(gateway => {
47
+ :username => 'username',
48
+ :password => 'password',
49
+ :raw_options => 'x_duplicate_window=1',
50
+ :test_mode => false
51
+ })
52
+ end
53
+ subject { config.send(gateway) }
54
+
55
+ its(:username) { should == 'username' }
56
+ its(:password) { should == 'password' }
57
+ its(:raw_options) { should == 'x_duplicate_window=1' }
58
+ its(:test_mode) { should be_false }
59
+ end
60
+ end
61
+ end
62
+ end