webpay 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +13 -0
  5. data/Rakefile +6 -0
  6. data/gemfiles/no_doc_gems +9 -0
  7. data/lib/webpay/client.rb +19 -1
  8. data/lib/webpay/version.rb +1 -1
  9. data/lib/webpay/webpay_error.rb +7 -1
  10. data/spec/resources/account/delete.txt +15 -0
  11. data/spec/resources/account/retrieve.txt +23 -0
  12. data/spec/resources/charges/all.txt +102 -0
  13. data/spec/resources/charges/capture.txt +41 -0
  14. data/spec/resources/charges/create_with_card.txt +41 -0
  15. data/spec/resources/charges/create_with_customer.txt +41 -0
  16. data/spec/resources/charges/refund.txt +41 -0
  17. data/spec/resources/charges/retrieve.txt +39 -0
  18. data/spec/resources/charges/retrieve_not_captured.txt +39 -0
  19. data/spec/resources/customers/all.txt +76 -0
  20. data/spec/resources/customers/create.txt +31 -0
  21. data/spec/resources/customers/delete.txt +16 -0
  22. data/spec/resources/customers/retrieve.txt +31 -0
  23. data/spec/resources/customers/update.txt +31 -0
  24. data/spec/resources/errors/bad_request.txt +18 -0
  25. data/spec/resources/errors/broken_json.txt +16 -0
  26. data/spec/resources/errors/card_error.txt +19 -0
  27. data/spec/resources/errors/not_found.txt +18 -0
  28. data/spec/resources/errors/unauthorized.txt +16 -0
  29. data/spec/resources/errors/unknown_api_error.txt +17 -0
  30. data/spec/resources/events/all_with_type.txt +164 -0
  31. data/spec/resources/events/retrieve.txt +41 -0
  32. data/spec/resources/tokens/create.txt +30 -0
  33. data/spec/resources/tokens/retrieve.txt +30 -0
  34. data/spec/spec_helper.rb +37 -0
  35. data/spec/webpay/account_spec.rb +24 -0
  36. data/spec/webpay/charge_spec.rb +115 -0
  37. data/spec/webpay/customer_spec.rb +94 -0
  38. data/spec/webpay/event_spec.rb +30 -0
  39. data/spec/webpay/token_spec.rb +33 -0
  40. data/spec/webpay/webpay_error_spec.rb +58 -0
  41. data/webpay.gemspec +2 -0
  42. metadata +103 -22
@@ -0,0 +1,39 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx/1.4.1
3
+ Date: Sun, 08 Sep 2013 04:22:03 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Transfer-Encoding: chunked
6
+ Connection: keep-alive
7
+ Status: 200 OK
8
+ X-UA-Compatible: IE=Edge,chrome=1
9
+ ETag: "e1d70d19ea7666f4a7016055b3274b43"
10
+ Cache-Control: must-revalidate, private, max-age=0
11
+ X-Request-Id: 8ea33d9a3dc18348206d68f2408c7866
12
+
13
+ {
14
+ "id": "ch_2X01NDedxdrRcA3",
15
+ "object": "charge",
16
+ "livemode": false,
17
+ "currency": "jpy",
18
+ "description": "Test Charge from Java",
19
+ "amount": 1000,
20
+ "amount_refunded": 0,
21
+ "customer": "cus_fgR4vI92r54I6oK",
22
+ "created": 1378617627,
23
+ "paid": false,
24
+ "refunded": false,
25
+ "failure_message": null,
26
+ "card": {
27
+ "object": "card",
28
+ "exp_year": 2014,
29
+ "exp_month": 11,
30
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
31
+ "name": "KEI KUBO",
32
+ "country": "JP",
33
+ "type": "Visa",
34
+ "cvc_check": "pass",
35
+ "last4": "4242"
36
+ },
37
+ "captured": false,
38
+ "expire_time": 1379222427
39
+ }
@@ -0,0 +1,76 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Etag: "ed93eccf489db26fcb3db4b53d8671a0"
5
+ Cache-Control: max-age=0, private, must-revalidate
6
+ X-Request-Id: 69e72c7bde02381be8423eb0dbc33c9a
7
+ X-Runtime: 0.018180
8
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
9
+ Date: Tue, 10 Sep 2013 14:28:35 GMT
10
+ Content-Length: 1660
11
+ Connection: Keep-Alive
12
+
13
+ {
14
+ "object": "list",
15
+ "url": "/v1/customers",
16
+ "count": 4,
17
+ "data": [
18
+ {
19
+ "id": "cus_39o9oU1N1dRm4LZ",
20
+ "object": "customer",
21
+ "livemode": false,
22
+ "created": 1378823309,
23
+ "email": "customer@example.com",
24
+ "description": "Test Customer from Java",
25
+ "active_card": {
26
+ "object": "card",
27
+ "exp_year": 2015,
28
+ "exp_month": 12,
29
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
30
+ "name": "YUUKO SHIONJI",
31
+ "country": "JP",
32
+ "type": "Visa",
33
+ "cvc_check": "pass",
34
+ "last4": "4242"
35
+ }
36
+ },
37
+ {
38
+ "id": "cus_39o9gEeyUdvU8z8",
39
+ "object": "customer",
40
+ "livemode": false,
41
+ "created": 1378823307,
42
+ "email": "customer@example.com",
43
+ "description": "Test Customer from Java",
44
+ "active_card": {
45
+ "object": "card",
46
+ "exp_year": 2015,
47
+ "exp_month": 12,
48
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
49
+ "name": "YUUKO SHIONJI",
50
+ "country": "JP",
51
+ "type": "Visa",
52
+ "cvc_check": "pass",
53
+ "last4": "4242"
54
+ }
55
+ },
56
+ {
57
+ "id": "cus_39o84k2hng8P87Q",
58
+ "object": "customer",
59
+ "livemode": false,
60
+ "created": 1378823289,
61
+ "email": "customer@example.com",
62
+ "description": "Test Customer from Java",
63
+ "active_card": {
64
+ "object": "card",
65
+ "exp_year": 2015,
66
+ "exp_month": 12,
67
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
68
+ "name": "YUUKO SHIONJI",
69
+ "country": "JP",
70
+ "type": "Visa",
71
+ "cvc_check": "pass",
72
+ "last4": "4242"
73
+ }
74
+ }
75
+ ]
76
+ }
@@ -0,0 +1,31 @@
1
+ HTTP/1.1 201 Created
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Etag: "473096d7961bec9bc228fe5d423c79b5"
5
+ Cache-Control: max-age=0, private, must-revalidate
6
+ X-Request-Id: e439ee26c479cc5c50d54d2d5b8d6af5
7
+ X-Runtime: 0.254780
8
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
9
+ Date: Tue, 10 Sep 2013 13:23:18 GMT
10
+ Content-Length: 450
11
+ Connection: Keep-Alive
12
+
13
+ {
14
+ "id": "cus_39o4Fv82E1et5Xb",
15
+ "object": "customer",
16
+ "livemode": false,
17
+ "created": 1378819398,
18
+ "email": "customer@example.com",
19
+ "description": "Test Customer from Java",
20
+ "active_card": {
21
+ "object": "card",
22
+ "exp_year": 2015,
23
+ "exp_month": 12,
24
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
25
+ "name": "YUUKO SHIONJI",
26
+ "country": "JP",
27
+ "type": "Visa",
28
+ "cvc_check": "pass",
29
+ "last4": "4242"
30
+ }
31
+ }
@@ -0,0 +1,16 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Etag: "ce0dfdb0b03bbfd1305c7796daf025b8"
5
+ Cache-Control: max-age=0, private, must-revalidate
6
+ X-Request-Id: 7f54a12147016e584221c8064cd0300e
7
+ X-Runtime: 0.057258
8
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
9
+ Date: Tue, 10 Sep 2013 14:11:40 GMT
10
+ Content-Length: 53
11
+ Connection: Keep-Alive
12
+
13
+ {
14
+ "id": "cus_39o4Fv82E1et5Xb",
15
+ "deleted": true
16
+ }
@@ -0,0 +1,31 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Etag: "473096d7961bec9bc228fe5d423c79b5"
5
+ Cache-Control: max-age=0, private, must-revalidate
6
+ X-Request-Id: 5bd63e86dd328c8a0351531d01443648
7
+ X-Runtime: 0.009103
8
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
9
+ Date: Tue, 10 Sep 2013 13:48:32 GMT
10
+ Content-Length: 450
11
+ Connection: Keep-Alive
12
+
13
+ {
14
+ "id": "cus_39o4Fv82E1et5Xb",
15
+ "object": "customer",
16
+ "livemode": false,
17
+ "created": 1378819398,
18
+ "email": "customer@example.com",
19
+ "description": "Test Customer from Java",
20
+ "active_card": {
21
+ "object": "card",
22
+ "exp_year": 2015,
23
+ "exp_month": 12,
24
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
25
+ "name": "YUUKO SHIONJI",
26
+ "country": "JP",
27
+ "type": "Visa",
28
+ "cvc_check": "pass",
29
+ "last4": "4242"
30
+ }
31
+ }
@@ -0,0 +1,31 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Etag: "1404018ce07fd2f8e981d83abeec47e4"
5
+ Cache-Control: max-age=0, private, must-revalidate
6
+ X-Request-Id: 549d609daca5ce3e6b4de6c72112acf4
7
+ X-Runtime: 0.046486
8
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
9
+ Date: Tue, 10 Sep 2013 14:01:50 GMT
10
+ Content-Length: 441
11
+ Connection: Keep-Alive
12
+
13
+ {
14
+ "id": "cus_39o4Fv82E1et5Xb",
15
+ "object": "customer",
16
+ "livemode": false,
17
+ "created": 1378819398,
18
+ "email": "newmail@example.com",
19
+ "description": "New description",
20
+ "active_card": {
21
+ "object": "card",
22
+ "exp_year": 2016,
23
+ "exp_month": 12,
24
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
25
+ "name": "YUUKO SHIONJI",
26
+ "country": "JP",
27
+ "type": "Visa",
28
+ "cvc_check": "pass",
29
+ "last4": "4242"
30
+ }
31
+ }
@@ -0,0 +1,18 @@
1
+ HTTP/1.1 400 Bad Request
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Cache-Control: no-cache
5
+ X-Request-Id: b434ca28f6241d107aaeac961c8aa225
6
+ X-Runtime: 0.323214
7
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
8
+ Date: Sun, 08 Sep 2013 08:53:39 GMT
9
+ Content-Length: 133
10
+ Connection: Keep-Alive
11
+
12
+ {
13
+ "error": {
14
+ "type": "invalid_request_error",
15
+ "message": "Missing required param: currency",
16
+ "param": "currency"
17
+ }
18
+ }
@@ -0,0 +1,16 @@
1
+ HTTP/1.1 402 Payment Required
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Cache-Control: no-cache
5
+ X-Request-Id: 2d444b6f410907d8df24e45cd374e9b9
6
+ X-Runtime: 0.005541
7
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
8
+ Date: Sun, 08 Sep 2013 09:00:11 GMT
9
+ Content-Length: 96
10
+ Connection: Keep-Alive
11
+
12
+ {
13
+ "error": {
14
+ "type": "card_error",
15
+ "message": "Your card number is incorrect",
16
+ "c
@@ -0,0 +1,19 @@
1
+ HTTP/1.1 402 Payment Required
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Cache-Control: no-cache
5
+ X-Request-Id: 2d444b6f410907d8df24e45cd374e9b9
6
+ X-Runtime: 0.005541
7
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
8
+ Date: Sun, 08 Sep 2013 09:00:11 GMT
9
+ Content-Length: 149
10
+ Connection: Keep-Alive
11
+
12
+ {
13
+ "error": {
14
+ "type": "card_error",
15
+ "message": "Your card number is incorrect",
16
+ "code": "incorrect_number",
17
+ "param": "number"
18
+ }
19
+ }
@@ -0,0 +1,18 @@
1
+ HTTP/1.1 404 Not Found
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Cache-Control: no-cache
5
+ X-Request-Id: 806414eeeded602ef27448b69a5aec78
6
+ X-Runtime: 0.015164
7
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
8
+ Date: Sun, 08 Sep 2013 08:55:39 GMT
9
+ Content-Length: 115
10
+ Connection: Keep-Alive
11
+
12
+ {
13
+ "error": {
14
+ "type": "invalid_request_error",
15
+ "message": "No such charge: foo",
16
+ "param": "id"
17
+ }
18
+ }
@@ -0,0 +1,16 @@
1
+ HTTP/1.1 401 Unauthorized
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Cache-Control: no-cache
5
+ X-Request-Id: 4c321f268697f5afa416d4a54e511806
6
+ X-Runtime: 0.009466
7
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
8
+ Date: Sun, 08 Sep 2013 08:58:07 GMT
9
+ Content-Length: 95
10
+ Connection: Keep-Alive
11
+
12
+ {
13
+ "error": {
14
+ "message": "Invalid API key provided. Check your API key is correct."
15
+ }
16
+ }
@@ -0,0 +1,17 @@
1
+ HTTP/1.1 500 Internal Server Error
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Cache-Control: no-cache
5
+ X-Request-Id: 15d19c85ac922f11b266c05ec0fb2021
6
+ X-Runtime: 0.011584
7
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
8
+ Date: Sun, 08 Sep 2013 08:41:16 GMT
9
+ Content-Length: 84
10
+ Connection: Keep-Alive
11
+
12
+ {
13
+ "error": {
14
+ "type": "api_error",
15
+ "message": "Unknown error occurred"
16
+ }
17
+ }
@@ -0,0 +1,164 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: application/json; charset=utf-8
3
+ X-Ua-Compatible: IE=Edge
4
+ Etag: "7d53b76d2237158c0fc7b5f5459d714d"
5
+ Cache-Control: max-age=0, private, must-revalidate
6
+ X-Request-Id: fcd29143ad3497fc0d82d62d95bbdf99
7
+ X-Runtime: 0.020917
8
+ Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
9
+ Date: Wed, 11 Sep 2013 12:11:21 GMT
10
+ Content-Length: 4165
11
+ Connection: Keep-Alive
12
+
13
+ {
14
+ "object": "list",
15
+ "url": "/v1/events",
16
+ "count": 5,
17
+ "data": [
18
+ {
19
+ "id": "evt_39o9oUevb5NCeM1",
20
+ "object": "event",
21
+ "livemode": false,
22
+ "type": "customer.created",
23
+ "created": 1378823309,
24
+ "data": {
25
+ "object": {
26
+ "id": "cus_39o9oU1N1dRm4LZ",
27
+ "object": "customer",
28
+ "livemode": false,
29
+ "created": 1378823309,
30
+ "email": "customer@example.com",
31
+ "description": "Test Customer from Java",
32
+ "active_card": {
33
+ "object": "card",
34
+ "exp_year": 2015,
35
+ "exp_month": 12,
36
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
37
+ "name": "YUUKO SHIONJI",
38
+ "country": "JP",
39
+ "type": "Visa",
40
+ "cvc_check": "pass",
41
+ "last4": "4242"
42
+ }
43
+ }
44
+ },
45
+ "pending_webhooks": 0
46
+ },
47
+ {
48
+ "id": "evt_39o9gEcCZ7SRfFA",
49
+ "object": "event",
50
+ "livemode": false,
51
+ "type": "customer.created",
52
+ "created": 1378823307,
53
+ "data": {
54
+ "object": {
55
+ "id": "cus_39o9gEeyUdvU8z8",
56
+ "object": "customer",
57
+ "livemode": false,
58
+ "created": 1378823307,
59
+ "email": "customer@example.com",
60
+ "description": "Test Customer from Java",
61
+ "active_card": {
62
+ "object": "card",
63
+ "exp_year": 2015,
64
+ "exp_month": 12,
65
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
66
+ "name": "YUUKO SHIONJI",
67
+ "country": "JP",
68
+ "type": "Visa",
69
+ "cvc_check": "pass",
70
+ "last4": "4242"
71
+ }
72
+ }
73
+ },
74
+ "pending_webhooks": 0
75
+ },
76
+ {
77
+ "id": "evt_39o84k5JA4dJ16q",
78
+ "object": "event",
79
+ "livemode": false,
80
+ "type": "customer.created",
81
+ "created": 1378823289,
82
+ "data": {
83
+ "object": {
84
+ "id": "cus_39o84k2hng8P87Q",
85
+ "object": "customer",
86
+ "livemode": false,
87
+ "created": 1378823289,
88
+ "email": "customer@example.com",
89
+ "description": "Test Customer from Java",
90
+ "active_card": {
91
+ "object": "card",
92
+ "exp_year": 2015,
93
+ "exp_month": 12,
94
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
95
+ "name": "YUUKO SHIONJI",
96
+ "country": "JP",
97
+ "type": "Visa",
98
+ "cvc_check": "pass",
99
+ "last4": "4242"
100
+ }
101
+ }
102
+ },
103
+ "pending_webhooks": 0
104
+ },
105
+ {
106
+ "id": "evt_39o4Fv8fCeOccr0",
107
+ "object": "event",
108
+ "livemode": false,
109
+ "type": "customer.created",
110
+ "created": 1378819398,
111
+ "data": {
112
+ "object": {
113
+ "id": "cus_39o4Fv82E1et5Xb",
114
+ "object": "customer",
115
+ "livemode": false,
116
+ "created": 1378819398,
117
+ "email": "customer@example.com",
118
+ "description": "Test Customer from Java",
119
+ "active_card": {
120
+ "object": "card",
121
+ "exp_year": 2015,
122
+ "exp_month": 12,
123
+ "fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
124
+ "name": "YUUKO SHIONJI",
125
+ "country": "JP",
126
+ "type": "Visa",
127
+ "cvc_check": "pass",
128
+ "last4": "4242"
129
+ }
130
+ }
131
+ },
132
+ "pending_webhooks": 0
133
+ },
134
+ {
135
+ "id": "evt_2CmdiFe912ypb8z",
136
+ "object": "event",
137
+ "livemode": false,
138
+ "type": "customer.created",
139
+ "created": 1378335175,
140
+ "data": {
141
+ "object": {
142
+ "id": "cus_2CmdiF58G3Ok0Ia",
143
+ "object": "customer",
144
+ "livemode": false,
145
+ "created": 1378335175,
146
+ "email": null,
147
+ "description": null,
148
+ "active_card": {
149
+ "object": "card",
150
+ "exp_year": 2017,
151
+ "exp_month": 4,
152
+ "fingerprint": "032c9ed7343b5947cfcb28510bc3f32e0621cd74",
153
+ "name": "DEE EMMERICH",
154
+ "country": "JP",
155
+ "type": "Visa",
156
+ "cvc_check": "pass",
157
+ "last4": "4242"
158
+ }
159
+ }
160
+ },
161
+ "pending_webhooks": 0
162
+ }
163
+ ]
164
+ }