didil-paypal-recurring 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +2 -0
  5. data/Gemfile.lock +46 -0
  6. data/README.rdoc +144 -0
  7. data/Rakefile +5 -0
  8. data/docs/PP_NVPAPI_DeveloperGuide.pdf +0 -0
  9. data/docs/PP_WPP_IntegrationGuide.pdf +0 -0
  10. data/lib/paypal-recurring.rb +1 -0
  11. data/lib/paypal/recurring.rb +110 -0
  12. data/lib/paypal/recurring/base.rb +286 -0
  13. data/lib/paypal/recurring/cacert.pem +3987 -0
  14. data/lib/paypal/recurring/notification.rb +84 -0
  15. data/lib/paypal/recurring/request.rb +211 -0
  16. data/lib/paypal/recurring/response.rb +29 -0
  17. data/lib/paypal/recurring/response/base.rb +62 -0
  18. data/lib/paypal/recurring/response/checkout.rb +11 -0
  19. data/lib/paypal/recurring/response/details.rb +26 -0
  20. data/lib/paypal/recurring/response/manage_profile.rb +12 -0
  21. data/lib/paypal/recurring/response/payment.rb +24 -0
  22. data/lib/paypal/recurring/response/profile.rb +71 -0
  23. data/lib/paypal/recurring/response/refund.rb +23 -0
  24. data/lib/paypal/recurring/utils.rb +26 -0
  25. data/lib/paypal/recurring/version.rb +10 -0
  26. data/paypal-recurring.gemspec +27 -0
  27. data/spec/fixtures/checkout/failure.yml +38 -0
  28. data/spec/fixtures/checkout/success.yml +38 -0
  29. data/spec/fixtures/create_profile/failure.yml +38 -0
  30. data/spec/fixtures/create_profile/success.yml +38 -0
  31. data/spec/fixtures/details/cancelled.yml +38 -0
  32. data/spec/fixtures/details/failure.yml +38 -0
  33. data/spec/fixtures/details/success.yml +38 -0
  34. data/spec/fixtures/ipn/express_checkout.json +35 -0
  35. data/spec/fixtures/ipn/recurring_payment.json +44 -0
  36. data/spec/fixtures/ipn/recurring_payment_profile_created.json +31 -0
  37. data/spec/fixtures/ipn/recurring_payment_profile_created_with_initial_amount.json +33 -0
  38. data/spec/fixtures/ipn/recurring_payment_skipped.json +30 -0
  39. data/spec/fixtures/ipn/recurring_payment_with_initial_amount.json +44 -0
  40. data/spec/fixtures/notification/failure.yml +50 -0
  41. data/spec/fixtures/notification/success.yml +50 -0
  42. data/spec/fixtures/payment/failure.yml +38 -0
  43. data/spec/fixtures/payment/success.yml +38 -0
  44. data/spec/fixtures/profile/cancel/failure.yml +38 -0
  45. data/spec/fixtures/profile/cancel/success.yml +38 -0
  46. data/spec/fixtures/profile/failure.yml +38 -0
  47. data/spec/fixtures/profile/reactivate/failure.yml +38 -0
  48. data/spec/fixtures/profile/reactivate/success.yml +38 -0
  49. data/spec/fixtures/profile/success.yml +38 -0
  50. data/spec/fixtures/profile/suspend/failure.yml +38 -0
  51. data/spec/fixtures/profile/suspend/success.yml +38 -0
  52. data/spec/fixtures/refund/failure.yml +38 -0
  53. data/spec/fixtures/refund/success.yml +38 -0
  54. data/spec/fixtures/update_profile/failure.yml +38 -0
  55. data/spec/fixtures/update_profile/profile.yml +38 -0
  56. data/spec/fixtures/update_profile/success.yml +38 -0
  57. data/spec/paypal/notification_spec.rb +106 -0
  58. data/spec/paypal/recurring_spec.rb +81 -0
  59. data/spec/paypal/request_spec.rb +136 -0
  60. data/spec/paypal/response/base_spec.rb +19 -0
  61. data/spec/paypal/response/checkout_details_spec.rb +50 -0
  62. data/spec/paypal/response/checkout_spec.rb +32 -0
  63. data/spec/paypal/response/create_recurring_profile_spec.rb +41 -0
  64. data/spec/paypal/response/manage_profile_spec.rb +62 -0
  65. data/spec/paypal/response/profile_spec.rb +43 -0
  66. data/spec/paypal/response/refund_spec.rb +33 -0
  67. data/spec/paypal/response/request_payment_spec.rb +35 -0
  68. data/spec/paypal/response/update_recurring_profile_spec.rb +48 -0
  69. data/spec/spec_helper.rb +27 -0
  70. metadata +209 -0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&PROFILEID=invalid&METHOD=GetRecurringPaymentsProfileDetails
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/0.1.8
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 04:04:16 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '254'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: PROFILEID=invalid&TIMESTAMP=2012%2d04%2d23T04%3a04%3a16Z&CORRELATIONID=ba85c84dacdef&ACK=Failure&VERSION=72%2e0&BUILD=2764190&L_ERRORCODE0=11552&L_SHORTMESSAGE0=Invalid%20profile%20ID&L_LONGMESSAGE0=The%20profile%20ID%20is%20invalid&L_SEVERITYCODE0=Error
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 04:04:17 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&ACTION=Reactivate&PROFILEID=I-W4FNTE6EXJ2W&METHOD=ManageRecurringPaymentsProfileStatus
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/0.1.8
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 04:00:29 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '367'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: TIMESTAMP=2012%2d04%2d23T04%3a00%3a31Z&CORRELATIONID=2ddcc75ddcad1&ACK=Failure&VERSION=72%2e0&BUILD=2764190&L_ERRORCODE0=11558&L_SHORTMESSAGE0=Invalid%20profile%20status%20for%20reactivate%20action%3b%20profile%20should%20be%20suspended&L_LONGMESSAGE0=Invalid%20profile%20status%20for%20reactivate%20action%3b%20profile%20should%20be%20suspended&L_SEVERITYCODE0=Error
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 04:00:31 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&ACTION=Reactivate&PROFILEID=I-W4FNTE6EXJ2W&METHOD=ManageRecurringPaymentsProfileStatus
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/0.1.8
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 04:00:22 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '134'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: PROFILEID=I%2dW4FNTE6EXJ2W&TIMESTAMP=2012%2d04%2d23T04%3a00%3a25Z&CORRELATIONID=77bc3271b82a8&ACK=Success&VERSION=72%2e0&BUILD=2764190
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 04:00:26 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&PROFILEID=I-W4FNTE6EXJ2W&METHOD=GetRecurringPaymentsProfileDetails
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/0.1.8
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 04:01:53 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '939'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: PROFILEID=I%2dW4FNTE6EXJ2W&STATUS=Cancelled&AUTOBILLOUTAMT=AddToNextBilling&DESC=Awesome%20%2d%20Monthly%20Subscription&MAXFAILEDPAYMENTS=1&SUBSCRIBERNAME=Jos%c3%a9%20da%20Silva&PROFILESTARTDATE=2012%2d04%2d23T03%3a00%3a00Z&PROFILEREFERENCE=1234&NUMCYCLESCOMPLETED=0&NUMCYCLESREMAINING=0&OUTSTANDINGBALANCE=0%2e00&FAILEDPAYMENTCOUNT=0&LASTPAYMENTDATE=2012%2d04%2d23T03%3a57%3a58Z&LASTPAYMENTAMT=9%2e00&TRIALAMTPAID=0%2e00&REGULARAMTPAID=0%2e00&AGGREGATEAMT=0%2e00&AGGREGATEOPTIONALAMT=9%2e00&FINALPAYMENTDUEDATE=1970%2d01%2d01T00%3a00%3a00Z&TIMESTAMP=2012%2d04%2d23T04%3a01%3a55Z&CORRELATIONID=61fe2dc19c6f4&ACK=Success&VERSION=72%2e0&BUILD=2764190&BILLINGPERIOD=Month&BILLINGFREQUENCY=1&TOTALBILLINGCYCLES=0&CURRENCYCODE=BRL&AMT=9%2e00&SHIPPINGAMT=0%2e00&TAXAMT=0%2e00&REGULARBILLINGPERIOD=Month&REGULARBILLINGFREQUENCY=1&REGULARTOTALBILLINGCYCLES=0&REGULARCURRENCYCODE=BRL&REGULARAMT=9%2e00&REGULARSHIPPINGAMT=0%2e00&REGULARTAXAMT=0%2e00
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 04:01:55 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&ACTION=Suspend&PROFILEID=I-W4FNTE6EXJ2W&METHOD=ManageRecurringPaymentsProfileStatus
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/0.1.8
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 04:00:19 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '354'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: TIMESTAMP=2012%2d04%2d23T04%3a00%3a19Z&CORRELATIONID=50b4f36ae94e&ACK=Failure&VERSION=72%2e0&BUILD=2764190&L_ERRORCODE0=11557&L_SHORTMESSAGE0=Invalid%20profile%20status%20for%20suspend%20action%3b%20profile%20should%20be%20active&L_LONGMESSAGE0=Invalid%20profile%20status%20for%20suspend%20action%3b%20profile%20should%20be%20active&L_SEVERITYCODE0=Error
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 04:00:20 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&ACTION=Suspend&PROFILEID=I-W4FNTE6EXJ2W&METHOD=ManageRecurringPaymentsProfileStatus
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/0.1.8
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 04:00:13 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '134'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: PROFILEID=I%2dW4FNTE6EXJ2W&TIMESTAMP=2012%2d04%2d23T04%3a00%3a16Z&CORRELATIONID=ccc87f01d6607&ACK=Success&VERSION=72%2e0&BUILD=2764190
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 04:00:16 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&TRANSACTIONID=4GP25924UB013401J&PROFILEREFERENCE=12345&PAYMENTREQUEST_0_CUSTOM=12345&PAYMENTREQUEST_0_INVNUM=12345&REFUNDTYPE=Full&PAYMENTREQUEST_0_AMT=9.00&AMT=9.00&PAYMENTREQUEST_0_CURRENCYCODE=BRL&CURRENCYCODE=BRL&METHOD=RefundTransaction
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/1.0.0
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 10:55:15 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '262'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: TIMESTAMP=2012%2d04%2d23T10%3a55%3a17Z&CORRELATIONID=89f1590a7f107&ACK=Failure&VERSION=72%2e0&BUILD=2808426&L_ERRORCODE0=10009&L_SHORTMESSAGE0=Transaction%20refused&L_LONGMESSAGE0=This%20transaction%20has%20already%20been%20fully%20refunded&L_SEVERITYCODE0=Error
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 10:55:17 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&TRANSACTIONID=4GP25924UB013401J&PROFILEREFERENCE=12345&PAYMENTREQUEST_0_CUSTOM=12345&PAYMENTREQUEST_0_INVNUM=12345&REFUNDTYPE=Full&PAYMENTREQUEST_0_AMT=9.00&AMT=9.00&PAYMENTREQUEST_0_CURRENCYCODE=BRL&CURRENCYCODE=BRL&METHOD=RefundTransaction
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/1.0.0
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 10:53:04 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '251'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: REFUNDTRANSACTIONID=5MM61417CA010574T&FEEREFUNDAMT=0%2e71&GROSSREFUNDAMT=9%2e00&NETREFUNDAMT=8%2e29&CURRENCYCODE=BRL&TOTALREFUNDEDAMOUNT=9%2e00&TIMESTAMP=2012%2d04%2d23T10%3a53%3a10Z&CORRELATIONID=b902163c2d526&ACK=Success&VERSION=72%2e0&BUILD=2808426
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 10:53:10 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&PAYMENTREQUEST_0_AMT=10.00&AMT=10.00&PROFILEID=I-W4FNTE6EXJ2W&METHOD=UpdateRecurringPaymentsProfile
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/0.1.8
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 04:37:48 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '276'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: PROFILEID=I%2dW4FNTE6EXJ2W&TIMESTAMP=2012%2d04%2d23T04%3a37%3a49Z&CORRELATIONID=64801d3bcdb4&ACK=Failure&VERSION=72%2e0&BUILD=2764190&L_ERRORCODE0=11531&L_SHORTMESSAGE0=Invalid%20profile%20status%2e&L_LONGMESSAGE0=The%20profile%20status%20is%20invalid%2e&L_SEVERITYCODE0=Error
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 04:37:49 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&PROFILEID=I-6BWVV63V49JT&METHOD=GetRecurringPaymentsProfileDetails
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/0.1.8
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 04:34:46 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '989'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: PROFILEID=I%2d6BWVV63V49JT&STATUS=Active&AUTOBILLOUTAMT=NoAutoBill&DESC=Awesome%20%2d%20Monthly%20Subscription%20%28Updated%29&MAXFAILEDPAYMENTS=0&SUBSCRIBERNAME=Jos%c3%a9%20da%20Silva&PROFILESTARTDATE=2012%2d07%2d23T03%3a00%3a00Z&PROFILEREFERENCE=1234&NEXTBILLINGDATE=2012%2d07%2d23T10%3a00%3a00Z&NUMCYCLESCOMPLETED=0&NUMCYCLESREMAINING=0&OUTSTANDINGBALANCE=0%2e00&FAILEDPAYMENTCOUNT=0&LASTPAYMENTDATE=2012%2d04%2d23T04%3a31%3a15Z&LASTPAYMENTAMT=9%2e00&TRIALAMTPAID=0%2e00&REGULARAMTPAID=0%2e00&AGGREGATEAMT=0%2e00&AGGREGATEOPTIONALAMT=9%2e00&FINALPAYMENTDUEDATE=1970%2d01%2d01T00%3a00%3a00Z&TIMESTAMP=2012%2d04%2d23T04%3a34%3a47Z&CORRELATIONID=39a69e9af3257&ACK=Success&VERSION=72%2e0&BUILD=2764190&BILLINGPERIOD=Day&BILLINGFREQUENCY=1&TOTALBILLINGCYCLES=0&CURRENCYCODE=BRL&AMT=10%2e00&SHIPPINGAMT=0%2e00&TAXAMT=0%2e00&REGULARBILLINGPERIOD=Day&REGULARBILLINGFREQUENCY=1&REGULARTOTALBILLINGCYCLES=0&REGULARCURRENCYCODE=BRL&REGULARAMT=10%2e00&REGULARSHIPPINGAMT=0%2e00&REGULARTAXAMT=0%2e00
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 04:34:47 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-3t.sandbox.paypal.com/nvp
6
+ body:
7
+ encoding: US-ASCII
8
+ string: USER=fnando.vieira%2Bseller_api1.gmail.com&PWD=PRTZZX6JDACB95SA&SIGNATURE=AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt&VERSION=72.0&PAYMENTREQUEST_0_AMT=10.00&AMT=10.00&PAYMENTREQUEST_0_CURRENCYCODE=BRL&CURRENCYCODE=BRL&DESC=Awesome+-+Monthly+Subscription+%28Updated%29&PAYMENTREQUEST_0_DESC=Awesome+-+Monthly+Subscription+%28Updated%29&L_BILLINGAGREEMENTDESCRIPTION0=Awesome+-+Monthly+Subscription+%28Updated%29&NOTE=Changed+Plan&PROFILEID=I-6BWVV63V49JT&METHOD=UpdateRecurringPaymentsProfile
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - PayPal::Recurring/0.1.8
14
+ content-type:
15
+ - application/x-www-form-urlencoded
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ date:
24
+ - Mon, 23 Apr 2012 04:33:19 GMT
25
+ server:
26
+ - Apache
27
+ content-length:
28
+ - '134'
29
+ connection:
30
+ - close
31
+ content-type:
32
+ - text/plain; charset=utf-8
33
+ body:
34
+ encoding: US-ASCII
35
+ string: PROFILEID=I%2d6BWVV63V49JT&TIMESTAMP=2012%2d04%2d23T04%3a33%3a25Z&CORRELATIONID=31b9058f89254&ACK=Success&VERSION=72%2e0&BUILD=2764190
36
+ http_version: '1.1'
37
+ recorded_at: Mon, 23 Apr 2012 04:33:25 GMT
38
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,106 @@
1
+ require "spec_helper"
2
+
3
+ describe PayPal::Recurring::Notification do
4
+ it "detects express checkout" do
5
+ subject.params[:txn_type] = "express_checkout"
6
+ subject.should be_express_checkout
7
+ end
8
+
9
+ it "detects recurring payment" do
10
+ subject.params[:txn_type] = "recurring_payment"
11
+ subject.should be_recurring_payment
12
+ end
13
+
14
+ it "detects recurring payment profile" do
15
+ subject.params[:txn_type] = "recurring_payment_profile_created"
16
+ subject.should be_recurring_payment_profile
17
+ end
18
+
19
+ it "normalizes payment date" do
20
+ subject.params[:payment_date] = "20:37:06 Jul 04, 2011 PDT" # PDT = -0700
21
+ subject.paid_at.strftime("%Y-%m-%d %H:%M:%S").should == "2011-07-05 03:37:06"
22
+ end
23
+
24
+ it "normalizes creation date" do
25
+ subject.params[:time_created] = "20:37:06 Jul 04, 2011 PDT" # PDT = -0700
26
+ subject.created_at.strftime("%Y-%m-%d %H:%M:%S").should == "2011-07-05 03:37:06"
27
+ end
28
+
29
+ it "returns currency" do
30
+ subject.params[:mc_currency] = "BRL"
31
+ subject.currency.should == "BRL"
32
+ end
33
+
34
+ describe "#payment_date" do
35
+ it "returns date from payment_date field" do
36
+ subject.params[:payment_date] = "2011-07-05"
37
+ subject.payment_date.should == "2011-07-05"
38
+ end
39
+ end
40
+
41
+ describe "#fee" do
42
+ it "returns fee from mc_fee field" do
43
+ subject.params[:mc_fee] = "0.56"
44
+ subject.fee.should == "0.56"
45
+ end
46
+
47
+ it "returns fee from payment_fee field" do
48
+ subject.params[:payment_fee] = "0.56"
49
+ subject.fee.should == "0.56"
50
+ end
51
+ end
52
+
53
+ describe "#amount" do
54
+ it "returns amount from amount field" do
55
+ subject.params[:amount] = "9.00"
56
+ subject.amount.should == "9.00"
57
+ end
58
+
59
+ it "returns amount from mc_gross field" do
60
+ subject.params[:mc_gross] = "9.00"
61
+ subject.amount.should == "9.00"
62
+ end
63
+
64
+ it "returns amount from payment_gross field" do
65
+ subject.params[:payment_gross] = "9.00"
66
+ subject.amount.should == "9.00"
67
+ end
68
+ end
69
+
70
+ describe "#reference" do
71
+ it "returns from recurring IPN" do
72
+ subject.params[:rp_invoice_id] = "abc"
73
+ subject.reference.should == "abc"
74
+ end
75
+
76
+ it "returns from custom field" do
77
+ subject.params[:custom] = "abc"
78
+ subject.reference.should == "abc"
79
+ end
80
+
81
+ it "returns from invoice field" do
82
+ subject.params[:invoice] = "abc"
83
+ subject.reference.should == "abc"
84
+ end
85
+ end
86
+
87
+ context "when successful" do
88
+ use_vcr_cassette "notification/success"
89
+
90
+ it "verifies notification" do
91
+ subject.params = {"test_ipn"=>"1", "payment_type"=>"echeck", "payment_date"=>"06:16:11 Jun 27, 2011 PDT", "payment_status"=>"Completed", "pending_reason"=>"echeck", "address_status"=>"confirmed", "payer_status"=>"verified", "first_name"=>"John", "last_name"=>"Smith", "payer_email"=>"buyer@paypalsandbox.com", "payer_id"=>"TESTBUYERID01", "address_name"=>"John Smith", "address_country"=>"United States", "address_country_code"=>"US", "address_zip"=>"95131", "address_state"=>"CA", "address_city"=>"San Jose", "address_street"=>"123, any street", "business"=>"seller@paypalsandbox.com", "receiver_email"=>"seller@paypalsandbox.com", "receiver_id"=>"TESTSELLERID1", "residence_country"=>"US", "item_name"=>"something", "item_number"=>"AK-1234", "quantity"=>"1", "shipping"=>"3.04", "tax"=>"2.02", "mc_currency"=>"USD", "mc_fee"=>"0.44", "mc_gross"=>"12.34", "txn_type"=>"web_accept", "txn_id"=>"116271316", "notify_version"=>"2.1", "custom"=>"xyz123", "invoice"=>"abc1234", "charset"=>"windows-1252", "verify_sign"=>"A12AYqq6LElPcpXaQx48GiroLHnMAoQPnK0Z7aRwXUOpg1GfDaE15mFN"}
92
+ subject.should be_verified
93
+ subject.should be_completed
94
+ end
95
+ end
96
+
97
+ context "when failure" do
98
+ use_vcr_cassette "notification/failure"
99
+
100
+ it "verifies notification" do
101
+ subject.params = {}
102
+ subject.should_not be_verified
103
+ subject.should_not be_completed
104
+ end
105
+ end
106
+ end