pin_pays 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +288 -0
- data/Rakefile +8 -0
- data/lib/pin_pays/api.rb +48 -0
- data/lib/pin_pays/cards.rb +16 -0
- data/lib/pin_pays/charges.rb +42 -0
- data/lib/pin_pays/config.rb +21 -0
- data/lib/pin_pays/customers.rb +43 -0
- data/lib/pin_pays/error.rb +25 -0
- data/lib/pin_pays/refunds.rb +23 -0
- data/lib/pin_pays/version.rb +3 -0
- data/lib/pin_pays.rb +11 -0
- data/pin_pays.gemspec +21 -0
- data/spec/README.txt +12 -0
- data/spec/fixtures/vcr/cards-create.yml +53 -0
- data/spec/fixtures/vcr/charges-create.yml +52 -0
- data/spec/fixtures/vcr/charges-list.yml +79 -0
- data/spec/fixtures/vcr/charges-show.yml +52 -0
- data/spec/fixtures/vcr/customers-charges.yml +52 -0
- data/spec/fixtures/vcr/customers-create.yml +51 -0
- data/spec/fixtures/vcr/customers-list.yml +60 -0
- data/spec/fixtures/vcr/customers-show.yml +51 -0
- data/spec/fixtures/vcr/customers-update.yml +51 -0
- data/spec/fixtures/vcr/refunds-create.yml +50 -0
- data/spec/fixtures/vcr/refunds-list.yml +50 -0
- data/spec/lib/pin_pays/api_spec.rb +22 -0
- data/spec/lib/pin_pays/cards_spec.rb +40 -0
- data/spec/lib/pin_pays/charges_spec.rb +124 -0
- data/spec/lib/pin_pays/config_spec.rb +30 -0
- data/spec/lib/pin_pays/customers_spec.rb +131 -0
- data/spec/lib/pin_pays/refunds_spec.rb +79 -0
- data/spec/spec_helper.rb +22 -0
- metadata +150 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/charges
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: customer_token=cus_t0jWhn4RECbU3OYIz-B5WA&email=test%40example.com&description=Flux%20Capacitor%20(box%20of%2010)&amount=9995&ip_address=127.0.0.1&capture=true
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 201
|
13
|
+
message: Created
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- max-age=0, private, must-revalidate
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:54:01 GMT
|
21
|
+
Etag:
|
22
|
+
- '"4f98b0bc5e37114331043d3a664df9b0"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '201'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- invalidate, pass
|
35
|
+
X-Request-Id:
|
36
|
+
- 8d23c1d106b9c41aa45bc5f14cd2b686
|
37
|
+
X-Runtime:
|
38
|
+
- '0.488447'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '798'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":{"token":"ch_eAPfoQZAMZOogaCsKJA1qA","success":true,"amount":9995,"currency":"AUD","description":"Flux
|
48
|
+
Capacitor (box of 10)","reference":"","email":"test@example.com","ip_address":"127.0.0.1","created_at":"2014-04-26T03:54:01Z","status_message":"Success","error_message":null,"card":{"token":"card_j2RKCKH0RE4fhWVa0TXo3A","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
49
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"},"transfer":[],"amount_refunded":0,"total_fees":330,"merchant_entitlement":9665,"refund_pending":false,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"}}'
|
50
|
+
http_version:
|
51
|
+
recorded_at: Sat, 26 Apr 2014 03:54:02 GMT
|
52
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,79 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/charges
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- must-revalidate, private, max-age=0
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:54:02 GMT
|
21
|
+
Etag:
|
22
|
+
- '"48dc4a38b2eada292023603a1d7072e5"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '200'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- miss
|
35
|
+
X-Request-Id:
|
36
|
+
- 982570b86257b9b42bd2dbc2451b45b4
|
37
|
+
X-Runtime:
|
38
|
+
- '0.084873'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '9308'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":[{"token":"ch_eAPfoQZAMZOogaCsKJA1qA","success":true,"amount":9995,"currency":"AUD","description":"Flux
|
48
|
+
Capacitor (box of 10)","reference":"","email":"test@example.com","ip_address":"127.0.0.1","created_at":"2014-04-26T03:54:01Z","status_message":"Success","error_message":null,"card":{"token":"card_j2RKCKH0RE4fhWVa0TXo3A","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
49
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"},"transfer":[],"amount_refunded":0,"total_fees":330,"merchant_entitlement":9665,"refund_pending":false,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"},{"token":"ch_QpydE2zy2HNhsD5wYq0Kcg","success":true,"amount":9995,"currency":"AUD","description":"Flux
|
50
|
+
Capacitor (box of 10)","reference":"","email":"test@example.com","ip_address":"127.0.0.1","created_at":"2014-04-25T11:20:44Z","status_message":"Success","error_message":null,"card":{"token":"card_nsk22Yj9__pLMJk_s_3wuA","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
51
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"},"transfer":[],"amount_refunded":9995,"total_fees":330,"merchant_entitlement":9665,"refund_pending":true,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"},{"token":"ch_1qTqGP78rTDEOpRS3UqTYg","success":false,"amount":4995,"currency":"USD","description":"Flux
|
52
|
+
Capacitor","reference":"","email":"test@test.com","ip_address":"127.0.0.1","created_at":"2014-04-18T05:02:31Z","status_message":"Card
|
53
|
+
Declined","error_message":"Card Declined","card":{"token":"card_4qHBA_9YpWnNZyiro91dSA","scheme":"master","display_number":"XXXX-XXXX-XXXX-0001","expiry_month":12,"expiry_year":2016,"name":"Mr
|
54
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"},"transfer":[],"amount_refunded":0,"total_fees":null,"merchant_entitlement":null,"refund_pending":false,"authorisation_expired":false,"captured":false,"settlement_currency":"AUD"},{"token":"ch_JbiBS-psseIP0KOarnLInw","success":false,"amount":4995,"currency":"USD","description":"Flux
|
55
|
+
Capacitor","reference":"","email":"test@test.com","ip_address":"127.0.0.1","created_at":"2014-04-18T05:02:11Z","status_message":"Card
|
56
|
+
Declined","error_message":"Card Declined","card":{"token":"card_4qHBA_9YpWnNZyiro91dSA","scheme":"master","display_number":"XXXX-XXXX-XXXX-0001","expiry_month":12,"expiry_year":2016,"name":"Mr
|
57
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"},"transfer":[],"amount_refunded":0,"total_fees":null,"merchant_entitlement":null,"refund_pending":false,"authorisation_expired":false,"captured":false,"settlement_currency":"AUD"},{"token":"ch_z-aOTd7eHTAhw9N93976GA","success":false,"amount":4995,"currency":"USD","description":"Flux
|
58
|
+
Capacitor","reference":"","email":"test@test.com","ip_address":"127.0.0.1","created_at":"2014-04-18T05:01:03Z","status_message":"Card
|
59
|
+
Declined","error_message":"Card Declined","card":{"token":"card_4qHBA_9YpWnNZyiro91dSA","scheme":"master","display_number":"XXXX-XXXX-XXXX-0001","expiry_month":12,"expiry_year":2016,"name":"Mr
|
60
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"},"transfer":[],"amount_refunded":0,"total_fees":null,"merchant_entitlement":null,"refund_pending":false,"authorisation_expired":false,"captured":false,"settlement_currency":"AUD"},{"token":"ch_n54BJ6oXoYdv2-Cj-18Ovg","success":false,"amount":4000,"currency":"USD","description":"Flux
|
61
|
+
Capacitor","reference":"","email":"blah@foo.com","ip_address":"127.0.0.1","created_at":"2014-04-18T03:22:55Z","status_message":"Card
|
62
|
+
Declined","error_message":"Card Declined","card":{"token":"card_M3iCsnCZaCtv-GmfRMXQGw","scheme":"master","display_number":"XXXX-XXXX-XXXX-0001","expiry_month":12,"expiry_year":2016,"name":"Mr
|
63
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"},"transfer":[],"amount_refunded":0,"total_fees":null,"merchant_entitlement":null,"refund_pending":false,"authorisation_expired":false,"captured":false,"settlement_currency":"AUD"},{"token":"ch_ZmF4aJAo4VaOtGcPWQ0_XA","success":false,"amount":4000,"currency":"USD","description":"Flux
|
64
|
+
Capacitor","reference":"","email":"blah@foo.com","ip_address":"127.0.0.1","created_at":"2014-04-18T03:20:49Z","status_message":"Card
|
65
|
+
Declined","error_message":"Card Declined","card":{"token":"card_M3iCsnCZaCtv-GmfRMXQGw","scheme":"master","display_number":"XXXX-XXXX-XXXX-0001","expiry_month":12,"expiry_year":2016,"name":"Mr
|
66
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"},"transfer":[],"amount_refunded":0,"total_fees":null,"merchant_entitlement":null,"refund_pending":false,"authorisation_expired":false,"captured":false,"settlement_currency":"AUD"},{"token":"ch_OM3ceXiHE7tXrEIMT4A3Tg","success":true,"amount":4000,"currency":"USD","description":"Flux
|
67
|
+
Capacitor","reference":"","email":"blah@foo.com","ip_address":"127.0.0.1","created_at":"2014-04-18T03:10:14Z","status_message":"Success","error_message":null,"card":{"token":"card_vrwECj2lwc7-4jtibQwOmg","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2016,"name":"Mr
|
68
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"},"transfer":[],"amount_refunded":0,"total_fees":null,"merchant_entitlement":null,"refund_pending":false,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"},{"token":"ch_PAqm4MuomHmNFUKS5WolJg","success":true,"amount":1295,"currency":"USD","description":"250g
|
69
|
+
single origin beans","reference":"","email":"blah@foo.com","ip_address":null,"created_at":"2014-04-18T02:54:38Z","status_message":"Success","error_message":null,"card":{"token":"card_FTmy7Wmh1iv0XQkudA_ucA","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":2,"expiry_year":2015,"name":"MR
|
70
|
+
TEST CASE","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3199","address_state":"VIC","address_country":"AU"},"transfer":[],"amount_refunded":0,"total_fees":null,"merchant_entitlement":null,"refund_pending":false,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"},{"token":"ch_8Fe2Yn0JnYLHkY55zGuHjA","success":true,"amount":400,"currency":"USD","description":"Flux
|
71
|
+
Capacitor","reference":"","email":"blah@foo.com","ip_address":"127.0.0.1","created_at":"2014-04-18T02:39:39Z","status_message":"Success","error_message":null,"card":{"token":"card_vrwECj2lwc7-4jtibQwOmg","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2016,"name":"Mr
|
72
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"},"transfer":[],"amount_refunded":0,"total_fees":null,"merchant_entitlement":null,"refund_pending":false,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"},{"token":"ch_Hi9AVnuLZtvrBssyuOKSDQ","success":true,"amount":400,"currency":"AUD","description":"Flux
|
73
|
+
Capacitor","reference":"","email":"blah@foo.com","ip_address":"127.0.0.1","created_at":"2014-04-17T05:45:53Z","status_message":"Success","error_message":null,"card":{"token":"card_bfRXDsFOWN2xieEoZUY4ew","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":2,"expiry_year":2015,"name":"MR
|
74
|
+
TEST CASE","address_line1":"1 Long St","address_line2":"","address_city":"Frankston
|
75
|
+
South","address_postcode":"3199","address_state":"Vic","address_country":"Australia"},"transfer":[],"amount_refunded":0,"total_fees":42,"merchant_entitlement":358,"refund_pending":false,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"},{"token":"ch_8-FRB6RH-QZPbWGPGAjaYw","success":true,"amount":500,"currency":"AUD","description":"test","reference":"","email":"roland@example.com","ip_address":"60.242.140.170","created_at":"2014-04-10T05:09:32Z","status_message":"Success","error_message":null,"card":{"token":"card__MrnyyJ-EJQUj5x5P-j04g","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":5,"expiry_year":2015,"name":"Roland
|
76
|
+
Robot","address_line1":"42 Sevenoaks St","address_line2":"","address_city":"Lathlain","address_postcode":"6454","address_state":"WA","address_country":"Australia"},"transfer":[],"amount_refunded":0,"total_fees":45,"merchant_entitlement":455,"refund_pending":false,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"}],"count":12,"pagination":{"current":1,"previous":null,"next":null,"per_page":25,"pages":1,"count":12}}'
|
77
|
+
http_version:
|
78
|
+
recorded_at: Sat, 26 Apr 2014 03:54:03 GMT
|
79
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/charges/ch_eAPfoQZAMZOogaCsKJA1qA
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- must-revalidate, private, max-age=0
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:54:32 GMT
|
21
|
+
Etag:
|
22
|
+
- '"4f98b0bc5e37114331043d3a664df9b0"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '200'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- miss
|
35
|
+
X-Request-Id:
|
36
|
+
- a5031dab35117286a1925e3334351585
|
37
|
+
X-Runtime:
|
38
|
+
- '0.034999'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '798'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":{"token":"ch_eAPfoQZAMZOogaCsKJA1qA","success":true,"amount":9995,"currency":"AUD","description":"Flux
|
48
|
+
Capacitor (box of 10)","reference":"","email":"test@example.com","ip_address":"127.0.0.1","created_at":"2014-04-26T03:54:01Z","status_message":"Success","error_message":null,"card":{"token":"card_j2RKCKH0RE4fhWVa0TXo3A","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
49
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"},"transfer":[],"amount_refunded":0,"total_fees":330,"merchant_entitlement":9665,"refund_pending":false,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"}}'
|
50
|
+
http_version:
|
51
|
+
recorded_at: Sat, 26 Apr 2014 03:54:33 GMT
|
52
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/customers/cus_t0jWhn4RECbU3OYIz-B5WA/charges
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- must-revalidate, private, max-age=0
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:54:33 GMT
|
21
|
+
Etag:
|
22
|
+
- '"6ba10bbdf2116be595bdc68f3700d17b"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '200'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- miss
|
35
|
+
X-Request-Id:
|
36
|
+
- 9ec3ea3bf0a89f2f65bbdbace8664813
|
37
|
+
X-Runtime:
|
38
|
+
- '0.046882'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '899'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":[{"token":"ch_eAPfoQZAMZOogaCsKJA1qA","success":true,"amount":9995,"currency":"AUD","description":"Flux
|
48
|
+
Capacitor (box of 10)","reference":"","email":"test@example.com","ip_address":"127.0.0.1","created_at":"2014-04-26T03:54:01Z","status_message":"Success","error_message":null,"card":{"token":"card_j2RKCKH0RE4fhWVa0TXo3A","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
49
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"},"transfer":[],"amount_refunded":0,"total_fees":330,"merchant_entitlement":9665,"refund_pending":false,"authorisation_expired":false,"captured":true,"settlement_currency":"AUD"}],"count":1,"pagination":{"current":1,"previous":null,"next":null,"per_page":25,"pages":1,"count":1}}'
|
50
|
+
http_version:
|
51
|
+
recorded_at: Sat, 26 Apr 2014 03:54:34 GMT
|
52
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/customers
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: email=test%40example.com&card_token=card_j2RKCKH0RE4fhWVa0TXo3A
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 201
|
13
|
+
message: Created
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- max-age=0, private, must-revalidate
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:53:59 GMT
|
21
|
+
Etag:
|
22
|
+
- '"67849d320643564a8d21c4937d305c4b"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '201'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- invalidate, pass
|
35
|
+
X-Request-Id:
|
36
|
+
- 1a282097825fc0f51cf060c21f8ae627
|
37
|
+
X-Runtime:
|
38
|
+
- '0.170537'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '446'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":{"token":"cus_t0jWhn4RECbU3OYIz-B5WA","email":"test@example.com","created_at":"2014-04-26T03:53:59Z","card":{"token":"card_j2RKCKH0RE4fhWVa0TXo3A","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
48
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"}}}'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Sat, 26 Apr 2014 03:54:00 GMT
|
51
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,60 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/customers
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- must-revalidate, private, max-age=0
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:54:34 GMT
|
21
|
+
Etag:
|
22
|
+
- '"8364be48c7a44631487923f03717f83b"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '200'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- miss
|
35
|
+
X-Request-Id:
|
36
|
+
- d579df4c9b85ec16341b5f9479fb6019
|
37
|
+
X-Runtime:
|
38
|
+
- '0.022910'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '3897'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":[{"token":"cus_t0jWhn4RECbU3OYIz-B5WA","email":"test@example.com","created_at":"2014-04-26T03:53:59Z","card":{"token":"card_j2RKCKH0RE4fhWVa0TXo3A","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
48
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"}},{"token":"cus_GMGqzGW5wdBCiK78i-JWDw","email":"foo@bar.com","created_at":"2014-04-25T06:48:48Z","card":{"token":"card_nsk22Yj9__pLMJk_s_3wuA","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
49
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"}},{"token":"cus_Py2bm_ZJHSpUX0MbXMGA6A","email":"moo@foo.com","created_at":"2014-04-18T04:56:08Z","card":{"token":"card_4qHBA_9YpWnNZyiro91dSA","scheme":"master","display_number":"XXXX-XXXX-XXXX-0001","expiry_month":12,"expiry_year":2016,"name":"Mr
|
50
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"}},{"token":"cus_oiiyXakUFXv3L2uevsk3aQ","email":"test@example.com","created_at":"2014-04-18T03:19:08Z","card":{"token":"card_M3iCsnCZaCtv-GmfRMXQGw","scheme":"master","display_number":"XXXX-XXXX-XXXX-0001","expiry_month":12,"expiry_year":2016,"name":"Mr
|
51
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"}},{"token":"cus_1OaJQauIEfM5rwtyYnrUsw","email":"test@example.com","created_at":"2014-04-18T02:38:33Z","card":{"token":"card_vrwECj2lwc7-4jtibQwOmg","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2016,"name":"Mr
|
52
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"}},{"token":"cus_tFZ8Y4vGm171N5Dx6b6U1Q","email":"test@example.com","created_at":"2014-04-18T02:23:35Z","card":{"token":"card_W7FOpX4c_XzkNdzhnUoawA","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2016,"name":"Mr
|
53
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"}},{"token":"cus_PrrehUMSTSt8B0vtsJH_mw","email":"test@example.com","created_at":"2014-04-18T02:17:26Z","card":{"token":"card_-3uKYVBTpzPJDkCYH8ijDQ","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2016,"name":"Mr
|
54
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Melbourne","address_postcode":"3000","address_state":"Victoria","address_country":"AU"}},{"token":"cus_jOiRnxfQQ05Yb1kyY-e__A","email":"noodle88@mailinator.com","created_at":"2014-04-17T05:37:40Z","card":{"token":"card_bfRXDsFOWN2xieEoZUY4ew","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":2,"expiry_year":2015,"name":"MR
|
55
|
+
TEST CASE","address_line1":"1 Long St","address_line2":"","address_city":"Frankston
|
56
|
+
South","address_postcode":"3199","address_state":"Vic","address_country":"Australia"}},{"token":"cus_MK-JYcmH9VxyeK6kyGUrpA","email":"roland@example.com","created_at":"2014-04-10T03:04:04Z","card":{"token":"card__MrnyyJ-EJQUj5x5P-j04g","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":5,"expiry_year":2015,"name":"Roland
|
57
|
+
Robot","address_line1":"42 Sevenoaks St","address_line2":"","address_city":"Lathlain","address_postcode":"6454","address_state":"WA","address_country":"Australia"}}],"count":9,"pagination":{"current":1,"previous":null,"next":null,"per_page":25,"pages":1,"count":9}}'
|
58
|
+
http_version:
|
59
|
+
recorded_at: Sat, 26 Apr 2014 03:54:35 GMT
|
60
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/customers/cus_t0jWhn4RECbU3OYIz-B5WA
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- must-revalidate, private, max-age=0
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:54:35 GMT
|
21
|
+
Etag:
|
22
|
+
- '"67849d320643564a8d21c4937d305c4b"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '200'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- miss
|
35
|
+
X-Request-Id:
|
36
|
+
- d512f7830ada44768b943121ceb5e247
|
37
|
+
X-Runtime:
|
38
|
+
- '0.016630'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '446'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":{"token":"cus_t0jWhn4RECbU3OYIz-B5WA","email":"test@example.com","created_at":"2014-04-26T03:53:59Z","card":{"token":"card_j2RKCKH0RE4fhWVa0TXo3A","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
48
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"}}}'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Sat, 26 Apr 2014 03:54:36 GMT
|
51
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/customers/cus_t0jWhn4RECbU3OYIz-B5WA
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: email=foo%40bar.com
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- max-age=0, private, must-revalidate
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:54:36 GMT
|
21
|
+
Etag:
|
22
|
+
- '"d99523e6f5a5ef817c64f4c85daf8969"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '200'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- invalidate, pass
|
35
|
+
X-Request-Id:
|
36
|
+
- 5130932a794fe4ea9d4843a03763177b
|
37
|
+
X-Runtime:
|
38
|
+
- '0.060465'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '441'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":{"token":"cus_t0jWhn4RECbU3OYIz-B5WA","email":"foo@bar.com","created_at":"2014-04-26T03:53:59Z","card":{"token":"card_j2RKCKH0RE4fhWVa0TXo3A","scheme":"master","display_number":"XXXX-XXXX-XXXX-0000","expiry_month":12,"expiry_year":2020,"name":"Mr
|
48
|
+
Test Case","address_line1":"1 Long St","address_line2":"","address_city":"Somewhereville","address_postcode":"30000","address_state":"Somewherestate","address_country":"Australia"}}}'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Sat, 26 Apr 2014 03:54:37 GMT
|
51
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/charges/ch_eAPfoQZAMZOogaCsKJA1qA/refunds
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 201
|
13
|
+
message: Created
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- max-age=0, private, must-revalidate
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:54:37 GMT
|
21
|
+
Etag:
|
22
|
+
- '"1a0c8f4016c1528b454ccd480d35d569"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '201'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- invalidate, pass
|
35
|
+
X-Request-Id:
|
36
|
+
- 01e0fb27c03874953671bdeea6cea903
|
37
|
+
X-Runtime:
|
38
|
+
- '0.112245'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '217'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":{"token":"rf_dohEL_qiAT6n9bgeHqwcrQ","success":null,"amount":9995,"currency":"AUD","charge":"ch_eAPfoQZAMZOogaCsKJA1qA","created_at":"2014-04-26T03:54:37Z","error_message":null,"status_message":"Pending"}}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Sat, 26 Apr 2014 03:54:38 GMT
|
50
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<SECRET_KEY>:@test-api.pin.net.au/1/charges/ch_eAPfoQZAMZOogaCsKJA1qA/refunds
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Cache-Control:
|
16
|
+
- must-revalidate, private, max-age=0
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Date:
|
20
|
+
- Sat, 26 Apr 2014 03:54:38 GMT
|
21
|
+
Etag:
|
22
|
+
- '"9d173c94945d38c265084162a3de0f5e"'
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.20 (Ubuntu)
|
25
|
+
Status:
|
26
|
+
- '200'
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
Vary:
|
30
|
+
- User-Agent
|
31
|
+
X-Powered-By:
|
32
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
33
|
+
X-Rack-Cache:
|
34
|
+
- miss
|
35
|
+
X-Request-Id:
|
36
|
+
- da82d7ac4aedd6c8f028e866af317f20
|
37
|
+
X-Runtime:
|
38
|
+
- '0.028002'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '229'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"response":[{"token":"rf_dohEL_qiAT6n9bgeHqwcrQ","success":null,"amount":9995,"currency":"AUD","charge":"ch_eAPfoQZAMZOogaCsKJA1qA","created_at":"2014-04-26T03:54:37Z","error_message":null,"status_message":"Pending"}],"count":1}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Sat, 26 Apr 2014 03:54:38 GMT
|
50
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
# todo:
|
5
|
+
#
|
6
|
+
# - test api_get performs a request using a query string created from the
|
7
|
+
# supplied query hash
|
8
|
+
#
|
9
|
+
# - test api_post, api_put use the supplied body hash in the request body
|
10
|
+
#
|
11
|
+
# - test api_get, api_put, api_post request using basic auth generated
|
12
|
+
# from the secret key
|
13
|
+
#
|
14
|
+
# - test api_response properly converts the api's json response data into
|
15
|
+
# a hash
|
16
|
+
#
|
17
|
+
# - test api_paginated_response properly converts the api's paginated type
|
18
|
+
# responses into a hash with results and pagination keys
|
19
|
+
#
|
20
|
+
# - test symbolize_keys actually converts a hash's keys from strings to
|
21
|
+
# symbols, and does so recursively for values that are hashes, and hashes
|
22
|
+
# inside array values
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe PinPays::Cards do
|
4
|
+
|
5
|
+
before do
|
6
|
+
PinPays.configure do |config|
|
7
|
+
config.key = SECRET_KEY
|
8
|
+
config.mode = :test
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "create" do
|
14
|
+
|
15
|
+
before do
|
16
|
+
VCR.use_cassette('cards-create') do
|
17
|
+
@result = PinPays::Cards.create({
|
18
|
+
number: '5520000000000000',
|
19
|
+
expiry_month: '12',
|
20
|
+
expiry_year: '2020',
|
21
|
+
cvc: '123',
|
22
|
+
name: 'Mr Test Case',
|
23
|
+
address_line1: '1 Long St',
|
24
|
+
address_line2: '',
|
25
|
+
address_city: 'Somewhereville',
|
26
|
+
address_postcode: '30000',
|
27
|
+
address_state: 'Somewherestate',
|
28
|
+
address_country: 'Australia'
|
29
|
+
})
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "must include card token in result" do
|
34
|
+
@result[:token].wont_be_nil
|
35
|
+
@result[:token].must_be_instance_of String
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|