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,33 @@
1
+ require "spec_helper"
2
+
3
+ describe PayPal::Recurring::Response::Profile do
4
+ let(:paypal) {
5
+ PayPal::Recurring.new({
6
+ :profile_id => "I-1BASBJ9C9WBS",
7
+ :transaction_id => "4GP25924UB013401J",
8
+ :reference => "12345",
9
+ :refund_type => :full,
10
+ :amount => "9.00",
11
+ :currency => "BRL"
12
+ })
13
+ }
14
+
15
+ context "when successful" do
16
+ use_vcr_cassette "refund/success"
17
+ subject { paypal.refund }
18
+
19
+ its(:transaction_id) { should eql("5MM61417CA010574T") }
20
+ its(:fee_amount) { should eql("0.71") }
21
+ its(:gross_amount) { should eql("9.00") }
22
+ its(:net_amount) { should eql("8.29") }
23
+ its(:amount) { should eql("9.00") }
24
+ its(:currency) { should eql("BRL") }
25
+ end
26
+
27
+ context "when failure" do
28
+ use_vcr_cassette "refund/failure"
29
+ subject { paypal.refund }
30
+
31
+ its(:errors) { should have(1).items }
32
+ end
33
+ end
@@ -0,0 +1,35 @@
1
+ require "spec_helper"
2
+
3
+ describe PayPal::Recurring::Response::Payment do
4
+ context "when successful" do
5
+ use_vcr_cassette "payment/success"
6
+
7
+ subject {
8
+ ppr = PayPal::Recurring.new({
9
+ :description => "Awesome - Monthly Subscription",
10
+ :amount => "9.00",
11
+ :currency => "BRL",
12
+ :payer_id => "D2U7M6PTMJBML",
13
+ :token => "EC-7DE19186NP195863W",
14
+ })
15
+ ppr.request_payment
16
+ }
17
+
18
+ it { should be_valid }
19
+ it { should be_completed }
20
+ it { should be_approved }
21
+
22
+ its(:errors) { should be_empty }
23
+ end
24
+
25
+ context "when failure" do
26
+ use_vcr_cassette("payment/failure")
27
+ subject { PayPal::Recurring.new.request_payment }
28
+
29
+ it { should_not be_valid }
30
+ it { should_not be_completed }
31
+ it { should_not be_approved }
32
+
33
+ its(:errors) { should have(2).items }
34
+ end
35
+ end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+
3
+ describe PayPal::Recurring::Response::Profile do
4
+ context "when successful" do
5
+ use_vcr_cassette "update_profile/success"
6
+
7
+ let(:paypal) {
8
+ PayPal::Recurring.new({
9
+ :description => "Awesome - Monthly Subscription (Updated)",
10
+ :amount => "10.00",
11
+ :currency => "BRL",
12
+ :note => "Changed Plan",
13
+ :profile_id => "I-6BWVV63V49JT"
14
+ })
15
+ }
16
+
17
+ subject { paypal.update_recurring_profile }
18
+
19
+ it { should be_valid }
20
+ its(:profile_id) { should == "I-6BWVV63V49JT" }
21
+ its(:errors) { should be_empty }
22
+ end
23
+
24
+ context "updated profile" do
25
+ use_vcr_cassette "update_profile/profile"
26
+
27
+ let(:paypal) { PayPal::Recurring.new(:profile_id => "I-6BWVV63V49JT") }
28
+ subject { paypal.profile }
29
+
30
+ its(:amount) { should eql("10.00") }
31
+ its(:description) { should eql("Awesome - Monthly Subscription (Updated)") }
32
+ end
33
+
34
+ context "when failure" do
35
+ use_vcr_cassette("update_profile/failure")
36
+
37
+ let(:paypal) {
38
+ PayPal::Recurring.new({
39
+ :profile_id => "I-W4FNTE6EXJ2W",
40
+ :amount => "10.00"
41
+ })
42
+ }
43
+ subject { paypal.update_recurring_profile }
44
+
45
+ it { should_not be_valid }
46
+ its(:errors) { should have(1).items }
47
+ end
48
+ end
@@ -0,0 +1,27 @@
1
+ require "bundler"
2
+ Bundler.setup(:default, :development)
3
+ Bundler.require
4
+
5
+ require "paypal-recurring"
6
+ require "vcr"
7
+ require "active_support/all"
8
+
9
+ VCR.configure do |config|
10
+ config.cassette_library_dir = File.dirname(__FILE__) + "/fixtures"
11
+ config.hook_into :fakeweb
12
+ end
13
+
14
+ RSpec.configure do |config|
15
+ config.extend VCR::RSpec::Macros
16
+
17
+ config.before do
18
+ PayPal::Recurring.configure do |config|
19
+ config.sandbox = true
20
+ config.username = "fnando.vieira+seller_api1.gmail.com"
21
+ config.password = "PRTZZX6JDACB95SA"
22
+ config.signature = "AJnjtLN0ozBP-BF2ZJrj5sfbmGAxAnf5tev1-MgK5Z8IASmtj-Fw.5pt"
23
+ config.seller_id = "F2RM85WS56YX2"
24
+ config.email = "fnando.vieira+seller.gmail.com"
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,209 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: didil-paypal-recurring
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Nando Vieira
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: vcr
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fakeweb
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: awesome_print
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: PayPal Express Checkout API Client for recurring billing.
112
+ email:
113
+ - fnando.vieira@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .rspec
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - README.rdoc
123
+ - Rakefile
124
+ - docs/PP_NVPAPI_DeveloperGuide.pdf
125
+ - docs/PP_WPP_IntegrationGuide.pdf
126
+ - lib/paypal-recurring.rb
127
+ - lib/paypal/recurring.rb
128
+ - lib/paypal/recurring/base.rb
129
+ - lib/paypal/recurring/cacert.pem
130
+ - lib/paypal/recurring/notification.rb
131
+ - lib/paypal/recurring/request.rb
132
+ - lib/paypal/recurring/response.rb
133
+ - lib/paypal/recurring/response/base.rb
134
+ - lib/paypal/recurring/response/checkout.rb
135
+ - lib/paypal/recurring/response/details.rb
136
+ - lib/paypal/recurring/response/manage_profile.rb
137
+ - lib/paypal/recurring/response/payment.rb
138
+ - lib/paypal/recurring/response/profile.rb
139
+ - lib/paypal/recurring/response/refund.rb
140
+ - lib/paypal/recurring/utils.rb
141
+ - lib/paypal/recurring/version.rb
142
+ - paypal-recurring.gemspec
143
+ - spec/fixtures/checkout/failure.yml
144
+ - spec/fixtures/checkout/success.yml
145
+ - spec/fixtures/create_profile/failure.yml
146
+ - spec/fixtures/create_profile/success.yml
147
+ - spec/fixtures/details/cancelled.yml
148
+ - spec/fixtures/details/failure.yml
149
+ - spec/fixtures/details/success.yml
150
+ - spec/fixtures/ipn/express_checkout.json
151
+ - spec/fixtures/ipn/recurring_payment.json
152
+ - spec/fixtures/ipn/recurring_payment_profile_created.json
153
+ - spec/fixtures/ipn/recurring_payment_profile_created_with_initial_amount.json
154
+ - spec/fixtures/ipn/recurring_payment_skipped.json
155
+ - spec/fixtures/ipn/recurring_payment_with_initial_amount.json
156
+ - spec/fixtures/notification/failure.yml
157
+ - spec/fixtures/notification/success.yml
158
+ - spec/fixtures/payment/failure.yml
159
+ - spec/fixtures/payment/success.yml
160
+ - spec/fixtures/profile/cancel/failure.yml
161
+ - spec/fixtures/profile/cancel/success.yml
162
+ - spec/fixtures/profile/failure.yml
163
+ - spec/fixtures/profile/reactivate/failure.yml
164
+ - spec/fixtures/profile/reactivate/success.yml
165
+ - spec/fixtures/profile/success.yml
166
+ - spec/fixtures/profile/suspend/failure.yml
167
+ - spec/fixtures/profile/suspend/success.yml
168
+ - spec/fixtures/refund/failure.yml
169
+ - spec/fixtures/refund/success.yml
170
+ - spec/fixtures/update_profile/failure.yml
171
+ - spec/fixtures/update_profile/profile.yml
172
+ - spec/fixtures/update_profile/success.yml
173
+ - spec/paypal/notification_spec.rb
174
+ - spec/paypal/recurring_spec.rb
175
+ - spec/paypal/request_spec.rb
176
+ - spec/paypal/response/base_spec.rb
177
+ - spec/paypal/response/checkout_details_spec.rb
178
+ - spec/paypal/response/checkout_spec.rb
179
+ - spec/paypal/response/create_recurring_profile_spec.rb
180
+ - spec/paypal/response/manage_profile_spec.rb
181
+ - spec/paypal/response/profile_spec.rb
182
+ - spec/paypal/response/refund_spec.rb
183
+ - spec/paypal/response/request_payment_spec.rb
184
+ - spec/paypal/response/update_recurring_profile_spec.rb
185
+ - spec/spec_helper.rb
186
+ homepage: http://rubygems.org/gems/paypal-recurring
187
+ licenses: []
188
+ metadata: {}
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - '>='
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ requirements: []
204
+ rubyforge_project:
205
+ rubygems_version: 2.4.8
206
+ signing_key:
207
+ specification_version: 4
208
+ summary: PayPal Express Checkout API Client for recurring billing.
209
+ test_files: []