paypal-sdk-rest 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paypal-sdk/core/api.rb +0 -3
- data/lib/paypal-sdk/core/config.rb +2 -8
- data/lib/paypal-sdk/rest/data_types.rb +2 -2
- data/lib/paypal-sdk/rest/version.rb +1 -1
- data/spec/README.md +7 -19
- data/spec/core/api/data_type_spec.rb +47 -47
- data/spec/core/api/rest_spec.rb +35 -35
- data/spec/core/config_spec.rb +47 -47
- data/spec/core/logging_spec.rb +2 -2
- data/spec/core/openid_connect_spec.rb +39 -39
- data/spec/invoice_examples_spec.rb +1 -1
- data/spec/log/http.log +0 -2459
- data/spec/log/rest_http.log +0 -164
- data/spec/payments_examples_spec.rb +58 -58
- data/spec/subscription_examples_spec.rb +6 -6
- data/spec/webhooks_examples_spec.rb +5 -4
- metadata +3 -4
- data/lib/paypal-sdk/core/api/ipn.rb +0 -66
data/spec/log/rest_http.log
CHANGED
@@ -1,164 +0,0 @@
|
|
1
|
-
opening connection to api.sandbox.paypal.com:443...
|
2
|
-
opened
|
3
|
-
starting SSL for api.sandbox.paypal.com:443...
|
4
|
-
SSL established
|
5
|
-
<- "POST /v1/payments/payment HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A101.oQuoc3KVurNOiLYmfugvthwJNo2H8Ux-06-9DDcCmIWFisJ29o4rHrFT6XBszvxF.ytUZV7878EeFbUxWz1KF_94OS9W\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/rest-sdk-ruby 1.4.1 (paypal-sdk-core 1.4.1; ruby 2.2.3p173-x86_64-darwin14;OpenSSL 1.0.2d 9 Jul 2015)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 286\r\n\r\n"
|
6
|
-
<- "{\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"4567516310777851\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\"}}]},\"transactions\":[{\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\"}}]}"
|
7
|
-
-> "HTTP/1.1 201 Created\r\n"
|
8
|
-
-> "Date: Wed, 02 Dec 2015 20:14:24 GMT\r\n"
|
9
|
-
-> "Server: Apache\r\n"
|
10
|
-
-> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=433\r\n"
|
11
|
-
-> "Paypal-Debug-Id: 530449554494e\r\n"
|
12
|
-
-> "CORRELATION-ID: 530449554494e\r\n"
|
13
|
-
-> "Content-Language: *\r\n"
|
14
|
-
-> "Content-Length: 1246\r\n"
|
15
|
-
-> "Paypal-Debug-Id: 530449554494e\r\n"
|
16
|
-
-> "Vary: Authorization\r\n"
|
17
|
-
-> "Content-Type: application/json\r\n"
|
18
|
-
-> "Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dplatformapiserv%26TIME%3D542203734; domain=.paypal.com; path=/; Secure; HttpOnly\r\n"
|
19
|
-
-> "Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT\r\n"
|
20
|
-
-> "Connection: close\r\n"
|
21
|
-
-> "\r\n"
|
22
|
-
reading 1246 bytes...
|
23
|
-
-> "{\"id\":\"PAY-8VM74892A5828264LKZPVCIA\",\"create_time\":\"2015-12-02T20:14:24Z\",\"update_time\":\"2015-12-02T20:14:26Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx7851\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\"}}]},\"transactions\":[{\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"7.47\"}},\"related_resources\":[{\"sale\":{\"id\":\"3RK653684G926153K\",\"create_time\":\"2015-12-02T20:14:24Z\",\"update_time\":\"2015-12-02T20:14:26Z\",\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-8VM74892A5828264LKZPVCIA\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/3RK653684G926153K\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/3RK653684G926153K/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-8VM74892A5828264LKZPVCIA\",\"rel\":\"parent_payment\",\"method\":\"GET\"}],\"fmf_details\":{},\"processor_response\":{\"avs_code\":\"X\",\"cvv_code\":\"M\"}}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-8VM74892A5828264LKZPVCIA\",\"rel\":\"self\",\"method\":\"GET\"}]}"
|
24
|
-
read 1246 bytes
|
25
|
-
Conn close
|
26
|
-
opening connection to api.sandbox.paypal.com:443...
|
27
|
-
opened
|
28
|
-
starting SSL for api.sandbox.paypal.com:443...
|
29
|
-
SSL established
|
30
|
-
<- "GET /v1/payments/payment?count=10 HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A101.oQuoc3KVurNOiLYmfugvthwJNo2H8Ux-06-9DDcCmIWFisJ29o4rHrFT6XBszvxF.ytUZV7878EeFbUxWz1KF_94OS9W\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/rest-sdk-ruby 1.4.1 (paypal-sdk-core 1.4.1; ruby 2.2.3p173-x86_64-darwin14;OpenSSL 1.0.2d 9 Jul 2015)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\n\r\n"
|
31
|
-
-> "HTTP/1.1 200 OK\r\n"
|
32
|
-
-> "Date: Wed, 02 Dec 2015 20:14:27 GMT\r\n"
|
33
|
-
-> "Server: Apache\r\n"
|
34
|
-
-> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=205145\r\n"
|
35
|
-
-> "Paypal-Debug-Id: e6ed3b9175b4\r\n"
|
36
|
-
-> "CORRELATION-ID: e6ed3b9175b4\r\n"
|
37
|
-
-> "Content-Language: *\r\n"
|
38
|
-
-> "Paypal-Debug-Id: e6ed3b9175b4\r\n"
|
39
|
-
-> "Vary: Authorization\r\n"
|
40
|
-
-> "Content-Type: application/json\r\n"
|
41
|
-
-> "Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dplatformapiserv%26TIME%3D592535382; domain=.paypal.com; path=/; Secure; HttpOnly\r\n"
|
42
|
-
-> "Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT\r\n"
|
43
|
-
-> "Connection: close\r\n"
|
44
|
-
-> "Transfer-Encoding: chunked\r\n"
|
45
|
-
-> "\r\n"
|
46
|
-
-> "2000\r\n"
|
47
|
-
reading 8192 bytes...
|
48
|
-
-> ""
|
49
|
-
-> "{\"payments\":[{\"id\":\"PAY-8VM74892A5828264LKZPVCIA\",\"create_time\":\"2015-12-02T20:14:24Z\",\"update_time\":\"2015-12-02T20:14:26Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx7851\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\"}}]},\"transactions\":[{\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"7.47\"}},\"related_resources\":[{\"sale\":{\"id\":\"3RK653684G926153K\",\"create_time\":\"2015-12-02T20:14:24Z\",\"update_time\":\"2015-12-02T20:14:26Z\",\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-8VM74892A5828264LKZPVCIA\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/3RK653684G926153K\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/3RK653684G926153K/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-8VM74892A5828264LKZPVCIA\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-8VM74892A5828264LKZPVCIA\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-86W73924U2796861CKZPVB4I\",\"create_time\":\"2015-12-02T20:13:37Z\",\"update_time\":\"2015-12-02T20:13:44Z\",\"state\":\"approved\",\"intent\":\"authorize\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card_token\":{\"credit_card_id\":\"CARD-28F73913SF697294LKZNDTOA\",\"last4\":\"0004\",\"type\":\"mastercard\",\"expire_month\":\"1\",\"expire_year\":\"2020\"}}]},\"transactions\":[{\"amount\":{\"total\":\"223.67\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"223.67\"}},\"description\":\"Bidding on Lavincis.\",\"related_resources\":[{\"authorization\":{\"id\":\"6WN8980183557881R\",\"create_time\":\"2015-12-02T20:13:37Z\",\"update_time\":\"2015-12-02T20:13:44Z\",\"amount\":{\"total\":\"223.67\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"223.67\"}},\"state\":\"voided\",\"parent_payment\":\"PAY-86W73924U2796861CKZPVB4I\",\"valid_until\":\"2015-12-31T20:13:37Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/authorization/6WN8980183557881R\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-86W73924U2796861CKZPVB4I\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-86W73924U2796861CKZPVB4I\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-9V2656907H159594BKZPVBJI\",\"create_time\":\"2015-12-02T20:12:21Z\",\"update_time\":\"2015-12-02T20:12:29Z\",\"state\":\"approved\",\"intent\":\"authorize\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card_token\":{\"credit_card_id\":\"CARD-28F73913SF697294LKZNDTOA\",\"last4\":\"0004\",\"type\":\"mastercard\",\"expire_month\":\"1\",\"expire_year\":\"2020\"}}]},\"transactions\":[{\"amount\":{\"total\":\"129.55\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"129.55\"}},\"description\":\"Bidding on Lavincis.\",\"related_resources\":[{\"authorization\":{\"id\":\"91M04075A3215221E\",\"create_time\":\"2015-12-02T20:12:21Z\",\"update_time\":\"2015-12-02T20:12:29Z\",\"amount\":{\"total\":\"129.55\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"129.55\"}},\"state\":\"voided\",\"parent_payment\":\"PAY-9V2656907H159594BKZPVBJI\",\"valid_until\":\"2015-12-31T20:12:21Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/authorization/91M04075A3215221E\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-9V2656907H159594BKZPVBJI\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-9V2656907H159594BKZPVBJI\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-861991772F435624BKZPVAUY\",\"create_time\":\"2015-12-02T20:10:59Z\",\"update_time\":\"2015-12-02T20:11:08Z\",\"state\":\"approved\",\"intent\":\"authorize\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card_token\":{\"credit_card_id\":\"CARD-28F73913SF697294LKZNDTOA\",\"last4\":\"0004\",\"type\":\"mastercard\",\"expire_month\":\"1\",\"expire_year\":\"2020\"}}]},\"transactions\":[{\"amount\":{\"total\":\"135.22\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"135.22\"}},\"description\":\"Bidding on Lavincis.\",\"related_resources\":[{\"authorization\":{\"id\":\"5PM77282DP696243L\",\"create_time\":\"2015-12-02T20:10:59Z\",\"update_time\":\"2015-12-02T20:11:08Z\",\"amount\":{\"total\":\"135.22\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"135.22\"}},\"state\":\"voided\",\"parent_payment\":\"PAY-861991772F435624BKZPVAUY\",\"valid_until\":\"2015-12-31T20:10:59Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/authorization/5PM77282DP696243L\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-861991772F435624BKZPVAUY\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-861991772F435624BKZPVAUY\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-58T67946A6097405SKZPVADI\",\"create_time\":\"2015-12-02T20:09:49Z\",\"update_time\":\"2015-12-02T20:09:56Z\",\"state\":\"approved\",\"intent\":\"authorize\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card_token\":{\"credit_card_id\":\"CARD-28F73913SF697294LKZNDTOA\",\"last4\":\"0004\",\"type\":\"mastercard\",\"expire_month\":\"1\",\"expire_year\":\"2020\"}}]},\"transactions\":[{\"amount\":{\"total\":\"129.55\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"129.55\"}},\"description\":\"Bidding on Lavincis.\",\"related_resources\":[{\"authorization\":{\"id\":\"37R47509K1026262H\",\"create_time\":\"2015-12-02T20:09:49Z\",\"update_time\":\"2015-12-02T20:09:56Z\",\"amount\":{\"total\":\"129.55\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"129.55\"}},\"state\":\"voided\",\"parent_payment\":\"PAY-58T67946A6097405SKZPVADI\",\"valid_until\":\"2015-12-31T20:09:49Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/authorization/37R47509K1026262H\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-58T67946A6097405SKZPVADI\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-58T67946A6097405SKZPVADI\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-4LH08326A1542664MKZPU7YA\",\"create_time\":\"2015-12-02T20:09:04Z\",\"update_time\":\"2015-12-02T20:09:14Z\",\"state\":\"approved\",\"intent\":\"authorize\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card_token\":{\"credit_card_id\":\"CARD-28F73913SF697294LKZNDTOA\",\"last4\":\"0004\",\"type\":\"mastercard\",\"expire_month\":\"1\",\"expire_year\":\"2020\"}}]},\"transactions\":[{\"amount\":{\"total\":\"121.61\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"121.61\"}},\"description\":\"Bidding on Lavincis.\",\"related_resources\":[{\"authorization\":{\"id\":\"11U40871XE201543J\",\"create_time\":\"2015-12-02T20:09:04Z\",\"update_time\":\"2015-12-02T20:09:14Z\",\"amount\":{\"total\":\"121.61\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"121.61\"}},\"state\":\"voided\",\"parent_payment\":\"PAY-4LH08326A1542664MKZPU7YA\",\"valid_until\":\"2015-12-31T20:09:04Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/authorization/11U40871XE201543J\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-4LH08326A1542664MKZPU7YA\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-4LH08326A1542664MKZPU7YA\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-54G45150E0154773WKZPUQ3Q\",\"create_time\":\"2015-12-02T19:37:18Z\",\"update_time\":\"2015-12-02T19:37:19Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0984\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"billing_address\":{\"line1\":\"52 N Main ST\",\"city\":\"Dallas\",\"state\":\"OH\",\"postal_code\":\"43210\",\"country_code\":\"US\"}}}]},\"transactions\":[{\"amount\":{\"total\":\"76.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"65.00\",\"tax\":\"6.00\",\"shipping\":\"5.00\"}},\"description\":\"This is the payment transaction description.\",\"related_resources\":[{\"sale\":{\"id\":\"1XD30190N3990043G\",\"create_time\":\"2015-12-02T19:37:18Z\",\"update_time\":\"2015-12-02T19:37:19Z\",\"amount\":{\"total\":\"76.00\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-54G45150E0154773WKZPUQ3Q\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/1XD30190N3990043G\",\"rel\":\"self\",\"method\":\"GE"
|
50
|
-
read 8192 bytes
|
51
|
-
reading 2 bytes...
|
52
|
-
-> ""
|
53
|
-
-> "\r\n"
|
54
|
-
read 2 bytes
|
55
|
-
-> "1203\r\n"
|
56
|
-
reading 4611 bytes...
|
57
|
-
-> ""
|
58
|
-
-> "T\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/1XD30190N3990043G/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-54G45150E0154773WKZPUQ3Q\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-54G45150E0154773WKZPUQ3Q\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-7HC80834EY831963RKZPUQ2I\",\"create_time\":\"2015-12-02T19:37:13Z\",\"update_time\":\"2015-12-02T19:37:15Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"mastercard\",\"number\":\"xxxxxxxxxxxx2850\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"billing_address\":{\"line1\":\"52 N Main ST\",\"city\":\"Houston\",\"state\":\"OH\",\"postal_code\":\"43210\",\"country_code\":\"US\"}}}]},\"transactions\":[{\"amount\":{\"total\":\"68.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"58.00\",\"tax\":\"5.00\",\"shipping\":\"5.00\"}},\"description\":\"This is the payment transaction description.\",\"related_resources\":[{\"sale\":{\"id\":\"4A396862RM967881K\",\"create_time\":\"2015-12-02T19:37:14Z\",\"update_time\":\"2015-12-02T19:37:15Z\",\"amount\":{\"total\":\"68.00\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-7HC80834EY831963RKZPUQ2I\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/4A396862RM967881K\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/4A396862RM967881K/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-7HC80834EY831963RKZPUQ2I\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-7HC80834EY831963RKZPUQ2I\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-95G879734D014233NKZPUQZQ\",\"create_time\":\"2015-12-02T19:37:10Z\",\"update_time\":\"2015-12-02T19:37:11Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"mastercard\",\"number\":\"xxxxxxxxxxxx2850\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"billing_address\":{\"line1\":\"52 N Main ST\",\"city\":\"Houston\",\"state\":\"OH\",\"postal_code\":\"43210\",\"country_code\":\"US\"}}}]},\"transactions\":[{\"amount\":{\"total\":\"63.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"53.00\",\"tax\":\"5.00\",\"shipping\":\"5.00\"}},\"description\":\"This is the payment transaction description.\",\"related_resources\":[{\"sale\":{\"id\":\"84R851521T638221Y\",\"create_time\":\"2015-12-02T19:37:10Z\",\"update_time\":\"2015-12-02T19:37:11Z\",\"amount\":{\"total\":\"63.00\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-95G879734D014233NKZPUQZQ\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/84R851521T638221Y\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/84R851521T638221Y/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-95G879734D014233NKZPUQZQ\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-95G879734D014233NKZPUQZQ\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-74552831R9925351GKZPUQYQ\",\"create_time\":\"2015-12-02T19:37:06Z\",\"update_time\":\"2015-12-02T19:37:07Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0984\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"billing_address\":{\"line1\":\"52 N Main ST\",\"city\":\"Dallas\",\"state\":\"OH\",\"postal_code\":\"43210\",\"country_code\":\"US\"}}}]},\"transactions\":[{\"amount\":{\"total\":\"100.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"87.00\",\"tax\":\"8.00\",\"shipping\":\"5.00\"}},\"description\":\"This is the payment transaction description.\",\"related_resources\":[{\"sale\":{\"id\":\"0LJ65396JT958754Y\",\"create_time\":\"2015-12-02T19:37:06Z\",\"update_time\":\"2015-12-02T19:37:07Z\",\"amount\":{\"total\":\"100.00\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-74552831R9925351GKZPUQYQ\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/0LJ65396JT958754Y\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/0LJ65396JT958754Y/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-74552831R9925351GKZPUQYQ\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-74552831R9925351GKZPUQYQ\",\"rel\":\"self\",\"method\":\"GET\"}]}],\"count\":10,\"next_id\":\"PAY-0XD56047S05435040KZPUQLY\"}"
|
59
|
-
read 4611 bytes
|
60
|
-
reading 2 bytes...
|
61
|
-
-> ""
|
62
|
-
-> "\r\n"
|
63
|
-
read 2 bytes
|
64
|
-
-> "0\r\n"
|
65
|
-
-> "\r\n"
|
66
|
-
Conn close
|
67
|
-
opening connection to api.sandbox.paypal.com:443...
|
68
|
-
opened
|
69
|
-
starting SSL for api.sandbox.paypal.com:443...
|
70
|
-
SSL established
|
71
|
-
<- "POST /v1/vault/credit-card HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A101.oQuoc3KVurNOiLYmfugvthwJNo2H8Ux-06-9DDcCmIWFisJ29o4rHrFT6XBszvxF.ytUZV7878EeFbUxWz1KF_94OS9W\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/rest-sdk-ruby 1.4.1 (paypal-sdk-core 1.4.1; ruby 2.2.3p173-x86_64-darwin14;OpenSSL 1.0.2d 9 Jul 2015)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 138\r\n\r\n"
|
72
|
-
<- "{\"type\":\"visa\",\"number\":\"4111111111111111\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"cvv2\":\"874\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\"}"
|
73
|
-
-> "HTTP/1.1 201 Created\r\n"
|
74
|
-
-> "Date: Wed, 02 Dec 2015 20:14:57 GMT\r\n"
|
75
|
-
-> "Server: Apache\r\n"
|
76
|
-
-> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=421\r\n"
|
77
|
-
-> "Paypal-Debug-Id: 7ad48abba3fd9\r\n"
|
78
|
-
-> "Content-Language: *\r\n"
|
79
|
-
-> "CORRELATION-ID: 7ad48abba3fd9\r\n"
|
80
|
-
-> "Content-Length: 667\r\n"
|
81
|
-
-> "Paypal-Debug-Id: 7ad48abba3fd9\r\n"
|
82
|
-
-> "Vary: Authorization\r\n"
|
83
|
-
-> "Content-Type: application/json\r\n"
|
84
|
-
-> "Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dplatformapiserv%26TIME%3D1095851862; domain=.paypal.com; path=/; Secure; HttpOnly\r\n"
|
85
|
-
-> "Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT\r\n"
|
86
|
-
-> "Connection: close\r\n"
|
87
|
-
-> "\r\n"
|
88
|
-
reading 667 bytes...
|
89
|
-
-> "{\"id\":\"CARD-1WK16594MT478041MKZPVCQI\",\"state\":\"ok\",\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx1111\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"valid_until\":\"2018-12-01T00:00:00Z\",\"create_time\":\"2015-12-02T20:14:57Z\",\"update_time\":\"2015-12-02T20:14:57Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-1WK16594MT478041MKZPVCQI\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-1WK16594MT478041MKZPVCQI\",\"rel\":\"delete\",\"method\":\"DELETE\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-1WK16594MT478041MKZPVCQI\",\"rel\":\"patch\",\"method\":\"PATCH\"}]}"
|
90
|
-
read 667 bytes
|
91
|
-
Conn close
|
92
|
-
opening connection to api.sandbox.paypal.com:443...
|
93
|
-
opened
|
94
|
-
starting SSL for api.sandbox.paypal.com:443...
|
95
|
-
SSL established
|
96
|
-
<- "GET /v1/vault/credit-card/CARD-1WK16594MT478041MKZPVCQI HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A101.oQuoc3KVurNOiLYmfugvthwJNo2H8Ux-06-9DDcCmIWFisJ29o4rHrFT6XBszvxF.ytUZV7878EeFbUxWz1KF_94OS9W\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/rest-sdk-ruby 1.4.1 (paypal-sdk-core 1.4.1; ruby 2.2.3p173-x86_64-darwin14;OpenSSL 1.0.2d 9 Jul 2015)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\n\r\n"
|
97
|
-
-> "HTTP/1.1 200 OK\r\n"
|
98
|
-
-> "Date: Wed, 02 Dec 2015 20:14:58 GMT\r\n"
|
99
|
-
-> "Server: Apache\r\n"
|
100
|
-
-> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=395\r\n"
|
101
|
-
-> "Paypal-Debug-Id: 9547ddf015853\r\n"
|
102
|
-
-> "Content-Language: *\r\n"
|
103
|
-
-> "CORRELATION-ID: 9547ddf015853\r\n"
|
104
|
-
-> "Content-Length: 667\r\n"
|
105
|
-
-> "Paypal-Debug-Id: 9547ddf015853\r\n"
|
106
|
-
-> "Vary: Authorization\r\n"
|
107
|
-
-> "Content-Type: application/json\r\n"
|
108
|
-
-> "Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dplatformapiserv%26TIME%3D1112629078; domain=.paypal.com; path=/; Secure; HttpOnly\r\n"
|
109
|
-
-> "Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT\r\n"
|
110
|
-
-> "Connection: close\r\n"
|
111
|
-
-> "\r\n"
|
112
|
-
reading 667 bytes...
|
113
|
-
-> "{\"id\":\"CARD-1WK16594MT478041MKZPVCQI\",\"state\":\"ok\",\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx1111\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"valid_until\":\"2018-12-01T00:00:00Z\",\"create_time\":\"2015-12-02T20:14:57Z\",\"update_time\":\"2015-12-02T20:14:57Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-1WK16594MT478041MKZPVCQI\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-1WK16594MT478041MKZPVCQI\",\"rel\":\"delete\",\"method\":\"DELETE\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-1WK16594MT478041MKZPVCQI\",\"rel\":\"patch\",\"method\":\"PATCH\"}]}"
|
114
|
-
read 667 bytes
|
115
|
-
Conn close
|
116
|
-
opening connection to api.sandbox.paypal.com:443...
|
117
|
-
opened
|
118
|
-
starting SSL for api.sandbox.paypal.com:443...
|
119
|
-
SSL established
|
120
|
-
<- "GET /v1/payments/payment/PAY-1234 HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A101.oQuoc3KVurNOiLYmfugvthwJNo2H8Ux-06-9DDcCmIWFisJ29o4rHrFT6XBszvxF.ytUZV7878EeFbUxWz1KF_94OS9W\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/rest-sdk-ruby 1.4.1 (paypal-sdk-core 1.4.1; ruby 2.2.3p173-x86_64-darwin14;OpenSSL 1.0.2d 9 Jul 2015)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\n\r\n"
|
121
|
-
-> "HTTP/1.1 404 Not Found\r\n"
|
122
|
-
-> "Date: Wed, 02 Dec 2015 20:14:58 GMT\r\n"
|
123
|
-
-> "Server: Apache\r\n"
|
124
|
-
-> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=211451\r\n"
|
125
|
-
-> "Paypal-Debug-Id: eec09213732c4\r\n"
|
126
|
-
-> "CORRELATION-ID: eec09213732c4\r\n"
|
127
|
-
-> "Content-Language: *\r\n"
|
128
|
-
-> "Content-Length: 207\r\n"
|
129
|
-
-> "Paypal-Debug-Id: eec09213732c4\r\n"
|
130
|
-
-> "Vary: Authorization\r\n"
|
131
|
-
-> "Content-Type: application/json\r\n"
|
132
|
-
-> "Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dplatformapiserv%26TIME%3D1112629078; domain=.paypal.com; path=/; Secure; HttpOnly\r\n"
|
133
|
-
-> "Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT\r\n"
|
134
|
-
-> "Connection: close\r\n"
|
135
|
-
-> "\r\n"
|
136
|
-
reading 207 bytes...
|
137
|
-
-> "{\"name\":\"INVALID_RESOURCE_ID\",\"message\":\"The requested resource ID was not found\",\"information_link\":\"https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID\",\"debug_id\":\"eec09213732c4\"}"
|
138
|
-
read 207 bytes
|
139
|
-
Conn close
|
140
|
-
opening connection to api.sandbox.paypal.com:443...
|
141
|
-
opened
|
142
|
-
starting SSL for api.sandbox.paypal.com:443...
|
143
|
-
SSL established
|
144
|
-
<- "POST /v1/payments/payment HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A101.oQuoc3KVurNOiLYmfugvthwJNo2H8Ux-06-9DDcCmIWFisJ29o4rHrFT6XBszvxF.ytUZV7878EeFbUxWz1KF_94OS9W\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/rest-sdk-ruby 1.4.1 (paypal-sdk-core 1.4.1; ruby 2.2.3p173-x86_64-darwin14;OpenSSL 1.0.2d 9 Jul 2015)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 2\r\n\r\n"
|
145
|
-
<- "{}"
|
146
|
-
-> "HTTP/1.1 500 Internal Server Error\r\n"
|
147
|
-
-> "Date: Wed, 02 Dec 2015 20:14:58 GMT\r\n"
|
148
|
-
-> "Server: Apache\r\n"
|
149
|
-
-> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=205112\r\n"
|
150
|
-
-> "Paypal-Debug-Id: 799f718d8668\r\n"
|
151
|
-
-> "CORRELATION-ID: 799f718d8668\r\n"
|
152
|
-
-> "Content-Language: *\r\n"
|
153
|
-
-> "Content-Length: 211\r\n"
|
154
|
-
-> "Paypal-Debug-Id: 799f718d8668\r\n"
|
155
|
-
-> "Vary: Authorization\r\n"
|
156
|
-
-> "Content-Type: application/json\r\n"
|
157
|
-
-> "Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dplatformapiserv%26TIME%3D1112629078; domain=.paypal.com; path=/; Secure; HttpOnly\r\n"
|
158
|
-
-> "Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT\r\n"
|
159
|
-
-> "Connection: close\r\n"
|
160
|
-
-> "\r\n"
|
161
|
-
reading 211 bytes...
|
162
|
-
-> "{\"name\":\"INTERNAL_SERVICE_ERROR\",\"message\":\"An internal service error has occurred\",\"information_link\":\"https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR\",\"debug_id\":\"799f718d8668\"}"
|
163
|
-
read 211 bytes
|
164
|
-
Conn close
|
@@ -35,7 +35,7 @@ describe "Payments" do
|
|
35
35
|
"description" => "This is the payment transaction description." } ] }
|
36
36
|
|
37
37
|
it "Validate user-agent", :unit => true do
|
38
|
-
PayPal::SDK::REST::API.user_agent.
|
38
|
+
expect(PayPal::SDK::REST::API.user_agent).to match "PayPalSDK/PayPal-Ruby-SDK"
|
39
39
|
end
|
40
40
|
|
41
41
|
describe "Examples" do
|
@@ -43,9 +43,9 @@ describe "Payments" do
|
|
43
43
|
it "Modifiy global configuration" do
|
44
44
|
backup_config = PayPal::SDK::REST.api.config
|
45
45
|
PayPal::SDK::REST.set_config( :client_id => "XYZ" )
|
46
|
-
PayPal::SDK::REST.api.config.client_id.
|
46
|
+
expect(PayPal::SDK::REST.api.config.client_id).to eql "XYZ"
|
47
47
|
PayPal::SDK::REST.set_config(backup_config)
|
48
|
-
PayPal::SDK::REST.api.config.client_id.
|
48
|
+
expect(PayPal::SDK::REST.api.config.client_id).not_to eql "XYZ"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -54,53 +54,53 @@ describe "Payments" do
|
|
54
54
|
payment = Payment.new(PaymentAttributes)
|
55
55
|
# Create
|
56
56
|
payment.create
|
57
|
-
payment.error.
|
58
|
-
payment.id.
|
57
|
+
expect(payment.error).to be_nil
|
58
|
+
expect(payment.id).not_to be_nil
|
59
59
|
end
|
60
60
|
|
61
61
|
it "Create with request_id" do
|
62
62
|
payment = Payment.new(PaymentAttributes)
|
63
63
|
payment.create
|
64
|
-
payment.error.
|
64
|
+
expect(payment.error).to be_nil
|
65
65
|
|
66
66
|
request_id = payment.request_id
|
67
67
|
|
68
68
|
new_payment = Payment.new(PaymentAttributes.merge( :request_id => request_id ))
|
69
69
|
new_payment.create
|
70
|
-
new_payment.error.
|
70
|
+
expect(new_payment.error).to be_nil
|
71
71
|
|
72
|
-
payment.id.
|
72
|
+
expect(payment.id).to eql new_payment.id
|
73
73
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "Create with token" do
|
77
77
|
api = API.new
|
78
78
|
payment = Payment.new(PaymentAttributes.merge( :token => api.token ))
|
79
|
-
Payment.api.
|
79
|
+
expect(Payment.api).not_to eql payment.api
|
80
80
|
payment.create
|
81
|
-
payment.error.
|
82
|
-
payment.id.
|
81
|
+
expect(payment.error).to be_nil
|
82
|
+
expect(payment.id).not_to be_nil
|
83
83
|
end
|
84
84
|
|
85
85
|
it "Create with client_id and client_secret" do
|
86
86
|
api = API.new
|
87
87
|
payment = Payment.new(PaymentAttributes.merge( :client_id => api.config.client_id, :client_secret => api.config.client_secret))
|
88
|
-
Payment.api.
|
88
|
+
expect(Payment.api).not_to eql payment.api
|
89
89
|
payment.create
|
90
|
-
payment.error.
|
91
|
-
payment.id.
|
90
|
+
expect(payment.error).to be_nil
|
91
|
+
expect(payment.id).not_to be_nil
|
92
92
|
end
|
93
93
|
|
94
94
|
it "List" do
|
95
95
|
payment_history = Payment.all( "count" => 5 )
|
96
|
-
payment_history.error.
|
97
|
-
payment_history.count.
|
96
|
+
expect(payment_history.error).to be_nil
|
97
|
+
expect(payment_history.count).to eql 5
|
98
98
|
end
|
99
99
|
|
100
100
|
it "Find" do
|
101
101
|
payment_history = Payment.all( "count" => 1 )
|
102
102
|
payment = Payment.find(payment_history.payments[0].id)
|
103
|
-
payment.error.
|
103
|
+
expect(payment.error).to be_nil
|
104
104
|
end
|
105
105
|
|
106
106
|
describe "Validation", :integration => true do
|
@@ -111,29 +111,29 @@ describe "Payments" do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
it "Find with invalid ID" do
|
114
|
-
|
114
|
+
expect {
|
115
115
|
payment = Payment.find("Invalid")
|
116
|
-
}.
|
116
|
+
}.to raise_error PayPal::SDK::Core::Exceptions::ResourceNotFound
|
117
117
|
end
|
118
118
|
|
119
119
|
it "Find with nil" do
|
120
|
-
|
120
|
+
expect{
|
121
121
|
payment = Payment.find(nil)
|
122
|
-
}.
|
122
|
+
}.to raise_error ArgumentError
|
123
123
|
end
|
124
124
|
|
125
125
|
it "Find with empty string" do
|
126
|
-
|
126
|
+
expect{
|
127
127
|
payment = Payment.find("")
|
128
|
-
}.
|
128
|
+
}.to raise_error ArgumentError
|
129
129
|
end
|
130
130
|
|
131
131
|
it "Find record with expired token" do
|
132
|
-
|
132
|
+
expect {
|
133
133
|
Payment.api.token
|
134
134
|
Payment.api.token.sub!(/^/, "Expired")
|
135
135
|
Payment.all(:count => 1)
|
136
|
-
}.
|
136
|
+
}.not_to raise_error
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
@@ -156,8 +156,8 @@ describe "Payments" do
|
|
156
156
|
|
157
157
|
if auth_code != ''
|
158
158
|
tokeninfo = FuturePayment.exch_token(auth_code)
|
159
|
-
tokeninfo.access_token.
|
160
|
-
tokeninfo.refresh_token.
|
159
|
+
expect(tokeninfo.access_token).not_to be_nil
|
160
|
+
expect(tokeninfo.refresh_token).not_to be_nil
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
@@ -166,8 +166,8 @@ describe "Payments" do
|
|
166
166
|
correlation_id = ''
|
167
167
|
@future_payment = FuturePayment.new(FuturePaymentAttributes.merge( :token => access_token ))
|
168
168
|
@future_payment.create(correlation_id)
|
169
|
-
@future_payment.error.
|
170
|
-
@future_payment.id.
|
169
|
+
expect(@future_payment.error).to be_nil
|
170
|
+
expect(@future_payment.id).not_to be_nil
|
171
171
|
end
|
172
172
|
|
173
173
|
end
|
@@ -176,24 +176,24 @@ describe "Payments" do
|
|
176
176
|
before :each do
|
177
177
|
@payment = Payment.new(PaymentAttributes)
|
178
178
|
@payment.create
|
179
|
-
@payment.
|
179
|
+
expect(@payment).to be_success
|
180
180
|
end
|
181
181
|
|
182
182
|
it "Find" do
|
183
183
|
sale = Sale.find(@payment.transactions[0].related_resources[0].sale.id)
|
184
|
-
sale.error.
|
185
|
-
sale.
|
184
|
+
expect(sale.error).to be_nil
|
185
|
+
expect(sale).to be_a Sale
|
186
186
|
end
|
187
187
|
|
188
188
|
describe "instance method" do
|
189
189
|
it "Refund" do
|
190
190
|
sale = @payment.transactions[0].related_resources[0].sale
|
191
191
|
refund = sale.refund( :amount => { :total => "1.00", :currency => "USD" } )
|
192
|
-
refund.error.
|
192
|
+
expect(refund.error).to be_nil
|
193
193
|
|
194
194
|
refund = Refund.find(refund.id)
|
195
|
-
refund.error.
|
196
|
-
refund.
|
195
|
+
expect(refund.error).to be_nil
|
196
|
+
expect(refund).to be_a Refund
|
197
197
|
end
|
198
198
|
end
|
199
199
|
end
|
@@ -244,32 +244,32 @@ describe "Payments" do
|
|
244
244
|
before :each do
|
245
245
|
@payment = Payment.new(PaymentAttributes.merge( "intent" => "authorize" ))
|
246
246
|
@payment.create
|
247
|
-
@payment.error.
|
247
|
+
expect(@payment.error).to be_nil
|
248
248
|
end
|
249
249
|
|
250
250
|
it "Find" do
|
251
251
|
authorize = Authorization.find(@payment.transactions[0].related_resources[0].authorization.id)
|
252
|
-
authorize.error.
|
253
|
-
authorize.
|
252
|
+
expect(authorize.error).to be_nil
|
253
|
+
expect(authorize).to be_a Authorization
|
254
254
|
end
|
255
255
|
|
256
256
|
it "Capture" do
|
257
257
|
authorize = @payment.transactions[0].related_resources[0].authorization
|
258
258
|
capture = authorize.capture({:amount => { :currency => "USD", :total => "1.00" } })
|
259
|
-
capture.error.
|
259
|
+
expect(capture.error).to be_nil
|
260
260
|
end
|
261
261
|
|
262
262
|
it "Void" do
|
263
263
|
authorize = @payment.transactions[0].related_resources[0].authorization
|
264
264
|
authorize.void()
|
265
|
-
authorize.error.
|
265
|
+
expect(authorize.error).to be_nil
|
266
266
|
end
|
267
267
|
|
268
268
|
it "Reauthorization" do
|
269
269
|
authorize = Authorization.find("7GH53639GA425732B");
|
270
270
|
authorize.amount = { :currency => "USD", :total => "1.00" }
|
271
271
|
authorize.reauthorize
|
272
|
-
authorize.error.
|
272
|
+
expect(authorize.error).not_to be_nil
|
273
273
|
end
|
274
274
|
end
|
275
275
|
|
@@ -277,21 +277,21 @@ describe "Payments" do
|
|
277
277
|
before :each do
|
278
278
|
@payment = Payment.new(PaymentAttributes.merge( "intent" => "authorize" ))
|
279
279
|
@payment.create
|
280
|
-
@payment.error.
|
280
|
+
expect(@payment.error).to be_nil
|
281
281
|
authorize = @payment.transactions[0].related_resources[0].authorization
|
282
282
|
@capture = authorize.capture({:amount => { :currency => "USD", :total => "1.00" } })
|
283
|
-
@capture.error.
|
283
|
+
expect(@capture.error).to be_nil
|
284
284
|
end
|
285
285
|
|
286
286
|
it "Find" do
|
287
287
|
capture = Capture.find(@capture.id)
|
288
|
-
capture.error.
|
289
|
-
capture.
|
288
|
+
expect(capture.error).to be_nil
|
289
|
+
expect(capture).to be_a Capture
|
290
290
|
end
|
291
291
|
|
292
292
|
it "Refund" do
|
293
293
|
refund = @capture.refund({})
|
294
|
-
refund.error.
|
294
|
+
expect(refund.error).to be_nil
|
295
295
|
end
|
296
296
|
end
|
297
297
|
|
@@ -309,12 +309,12 @@ describe "Payments" do
|
|
309
309
|
"state" => "OH",
|
310
310
|
"postal_code" => "43210", "country_code" => "US" }})
|
311
311
|
credit_card.create
|
312
|
-
credit_card.error.
|
313
|
-
credit_card.id.
|
312
|
+
expect(credit_card.error).to be_nil
|
313
|
+
expect(credit_card.id).not_to be_nil
|
314
314
|
|
315
315
|
credit_card = CreditCard.find(credit_card.id)
|
316
|
-
credit_card.
|
317
|
-
credit_card.error.
|
316
|
+
expect(credit_card).to be_a CreditCard
|
317
|
+
expect(credit_card.error).to be_nil
|
318
318
|
end
|
319
319
|
|
320
320
|
it "Delete" do
|
@@ -332,17 +332,17 @@ describe "Payments" do
|
|
332
332
|
"type" => "visa",
|
333
333
|
"number" => "4111111111111111" })
|
334
334
|
credit_card.create
|
335
|
-
credit_card.error.
|
335
|
+
expect(credit_card.error).not_to be_nil
|
336
336
|
|
337
|
-
credit_card.error.name.
|
338
|
-
credit_card.error["name"].
|
337
|
+
expect(credit_card.error.name).to eql "VALIDATION_ERROR"
|
338
|
+
expect(credit_card.error["name"]).to eql "VALIDATION_ERROR"
|
339
339
|
|
340
|
-
credit_card.error.details[0].field.
|
341
|
-
credit_card.error.details[0].issue.
|
342
|
-
credit_card.error.details[1].field.
|
343
|
-
credit_card.error.details[1].issue.
|
340
|
+
expect(credit_card.error.details[0].field).to eql "expire_year"
|
341
|
+
expect(credit_card.error.details[0].issue).to eql "Required field missing"
|
342
|
+
expect(credit_card.error.details[1].field).to eql "expire_month"
|
343
|
+
expect(credit_card.error.details[1].issue).to eql "Required field missing"
|
344
344
|
|
345
|
-
credit_card.error["details"][0]["issue"].
|
345
|
+
expect(credit_card.error["details"][0]["issue"]).to eql "Required field missing"
|
346
346
|
end
|
347
347
|
end
|
348
348
|
end
|
@@ -69,13 +69,13 @@ describe "Subscription" do
|
|
69
69
|
# create access token and then create a plan
|
70
70
|
$api = API.new
|
71
71
|
plan = Plan.new(PlanAttributes.merge( :token => $api.token ))
|
72
|
-
Plan.api.
|
72
|
+
expect(Plan.api).not_to eql plan.api
|
73
73
|
plan.create
|
74
74
|
|
75
75
|
# make sure the transaction was successful
|
76
76
|
$plan_id = plan.id
|
77
|
-
plan.error.
|
78
|
-
plan.id.
|
77
|
+
expect(plan.error).to be_nil
|
78
|
+
expect(plan.id).not_to be_nil
|
79
79
|
end
|
80
80
|
|
81
81
|
it "Update" do
|
@@ -96,8 +96,8 @@ describe "Subscription" do
|
|
96
96
|
it "List" do
|
97
97
|
# list all billing plans
|
98
98
|
plan_list = Plan.all
|
99
|
-
plan_list.error.
|
100
|
-
plan_list.plans.count.
|
99
|
+
expect(plan_list.error).to be_nil
|
100
|
+
expect(plan_list.plans.count).to be > 1
|
101
101
|
end
|
102
102
|
|
103
103
|
it "Delete" do
|
@@ -117,7 +117,7 @@ describe "Subscription" do
|
|
117
117
|
|
118
118
|
# make sure the plan has been deleted
|
119
119
|
plan = Plan.find(plan_id)
|
120
|
-
plan.id.
|
120
|
+
expect(plan.id).not_to eq plan_id
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|