paypal-sdk-rest 1.4.1 → 1.4.2
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.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a50371cdb348785506ff61ef88aba02f119e99aa
|
4
|
+
data.tar.gz: d84d2eb117fca72ff6f50ac299cadaa1f8585331
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfd06b69e27819ab06fc612695e0ac1967cf50566866a759f64eab4cb046c35776b5d37eb383ca06c00c7deccbc82a155cf57b5a4fd5a42a834d700e77b47b4b
|
7
|
+
data.tar.gz: c34219a3a6436564f26910c22399807e45d4a7b3bba0babe851a2c6f9c4b8ab562b62c750794ebb762eca1ab074c6f27188498f7b640a7eb96e8f45196f37edf
|
data/lib/paypal-sdk/core/api.rb
CHANGED
@@ -3,10 +3,7 @@ module PayPal
|
|
3
3
|
module Core
|
4
4
|
module API
|
5
5
|
autoload :Base, "paypal-sdk/core/api/base"
|
6
|
-
autoload :Merchant, "paypal-sdk/core/api/merchant"
|
7
|
-
autoload :Platform, "paypal-sdk/core/api/platform"
|
8
6
|
autoload :REST, "paypal-sdk/core/api/rest"
|
9
|
-
autoload :IPN, "paypal-sdk/core/api/ipn"
|
10
7
|
|
11
8
|
module DataTypes
|
12
9
|
autoload :Base, "paypal-sdk/core/api/data_types/base"
|
@@ -72,19 +72,13 @@ module PayPal::SDK::Core
|
|
72
72
|
:token, :token_secret, :subject,
|
73
73
|
:http_timeout, :http_proxy,
|
74
74
|
:device_ipaddress, :sandbox_email_address,
|
75
|
-
:mode, :endpoint,
|
75
|
+
:mode, :endpoint,
|
76
76
|
:rest_endpoint, :rest_token_endpoint, :client_id, :client_secret,
|
77
77
|
:openid_endpoint, :openid_redirect_uri, :openid_client_id, :openid_client_secret,
|
78
78
|
:verbose_logging
|
79
79
|
|
80
80
|
alias_method :end_point=, :endpoint=
|
81
81
|
alias_method :end_point, :endpoint
|
82
|
-
alias_method :platform_end_point=, :platform_endpoint=
|
83
|
-
alias_method :platform_end_point, :platform_endpoint
|
84
|
-
alias_method :merchant_end_point=, :merchant_endpoint=
|
85
|
-
alias_method :merchant_end_point, :merchant_endpoint
|
86
|
-
alias_method :ipn_end_point=, :ipn_endpoint=
|
87
|
-
alias_method :ipn_end_point, :ipn_endpoint
|
88
82
|
alias_method :rest_end_point, :rest_endpoint
|
89
83
|
alias_method :rest_end_point=, :rest_endpoint=
|
90
84
|
alias_method :rest_token_end_point, :rest_token_endpoint
|
@@ -221,7 +215,7 @@ module PayPal::SDK::Core
|
|
221
215
|
# Get logger
|
222
216
|
def logger
|
223
217
|
if @@configurations[:mode] == 'live' and Logging.logger.level == Logger::DEBUG
|
224
|
-
Logging.logger.warn "DEBUG log level not allowed in
|
218
|
+
Logging.logger.warn "DEBUG log level not allowed in live mode for security of confidential information. Changing log level to INFO..."
|
225
219
|
Logging.logger.level = Logger::INFO
|
226
220
|
end
|
227
221
|
Logging.logger
|
@@ -1262,8 +1262,8 @@ module PayPal::SDK
|
|
1262
1262
|
end
|
1263
1263
|
|
1264
1264
|
def get_cert_chain()
|
1265
|
-
root_cert =
|
1266
|
-
intermediate_cert =
|
1265
|
+
root_cert = File.expand_path(File.join(File.dirname(__FILE__), '../../../data/DigiCertHighAssuranceEVRootCA.pem'))
|
1266
|
+
intermediate_cert = File.expand_path(File.join(File.dirname(__FILE__), '../../../data/DigiCertSHA2ExtendedValidationServerCA.pem'))
|
1267
1267
|
|
1268
1268
|
cert_store = OpenSSL::X509::Store.new
|
1269
1269
|
cert_store.add_file(root_cert)
|
data/spec/README.md
CHANGED
@@ -4,31 +4,19 @@ How to run tests
|
|
4
4
|
The SDK tests are composed of two groups: unit test group and integration (functional) test group. Integration test group is by default set not to run.
|
5
5
|
|
6
6
|
- run a single test
|
7
|
-
-
|
8
|
-
$ bundle exec rspec <test-file>:<line-number>
|
9
|
-
```
|
7
|
+
- `$ bundle exec rspec <test-file>:<line-number>`
|
10
8
|
- e.g., to run payment create test,
|
11
|
-
-
|
12
|
-
$ bundle exec rspec spec/payments_examples_spec.rb:53
|
13
|
-
```
|
9
|
+
- `$ bundle exec rspec spec/payments_examples_spec.rb:53`
|
14
10
|
|
15
11
|
- run multiple tests in the same file
|
16
|
-
- Add
|
17
|
-
-
|
18
|
-
$ bundle exec rspec spec/payments_examples_spec.rb:53:95
|
19
|
-
```
|
12
|
+
- Add `:<line-number>` to the above command. For example, in order to execute payment create and payment list tests,
|
13
|
+
- `$ bundle exec rspec spec/payments_examples_spec.rb:53:95`
|
20
14
|
|
21
15
|
- run integration tests
|
22
16
|
- This will set the 'integration' flag and will execute functional tests against sandbox.
|
23
|
-
-
|
24
|
-
$ bundle exec rspec --tag integration
|
25
|
-
```
|
17
|
+
- `$ bundle exec rspec --tag integration`
|
26
18
|
|
27
19
|
- run tests with a specific String
|
28
|
-
-
|
29
|
-
$ bundle exec rspec -e "<string>"
|
30
|
-
```
|
20
|
+
- `$ bundle exec rspec -e "<string>"`
|
31
21
|
- e.g., to run any tests with "Sa" in test description (for the time being, it will be "Sale" tests)
|
32
|
-
-
|
33
|
-
$ bundle exec rspec -e "Sa"
|
34
|
-
```
|
22
|
+
- `$ bundle exec rspec -e "Sa"`
|
@@ -31,29 +31,29 @@ describe PayPal::SDK::Core::API::DataTypes::Base do
|
|
31
31
|
|
32
32
|
it "should allow content key" do
|
33
33
|
message = Message.new("Testing message")
|
34
|
-
message.value.
|
34
|
+
expect(message.value).to eql "Testing message"
|
35
35
|
|
36
36
|
message = Message.new(:value => "Testing message")
|
37
|
-
message.value.
|
37
|
+
expect(message.value).to eql "Testing message"
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should create member object automatically" do
|
41
41
|
test_type = TestType.new
|
42
|
-
test_type.fromCurrency.
|
43
|
-
test_type.toCurrency.
|
44
|
-
test_type.toCurrency[0].
|
45
|
-
test_type.toCurrency[1].
|
46
|
-
test_type.toCurrency[0].amount.
|
47
|
-
test_type.fromCurrency.amount.
|
48
|
-
test_type.fromCurrency.desciption.
|
49
|
-
test_type.fromCurrency.currencyID.
|
42
|
+
expect(test_type.fromCurrency).to be_a TestCurrency
|
43
|
+
expect(test_type.toCurrency).to be_a Array
|
44
|
+
expect(test_type.toCurrency[0]).to be_a TestCurrency
|
45
|
+
expect(test_type.toCurrency[1]).to be_a TestCurrency
|
46
|
+
expect(test_type.toCurrency[0].amount).to eql nil
|
47
|
+
expect(test_type.fromCurrency.amount).to eql nil
|
48
|
+
expect(test_type.fromCurrency.desciption).to eql nil
|
49
|
+
expect(test_type.fromCurrency.currencyID).to eql nil
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should convert the given data to configured type" do
|
53
53
|
test_type = TestType.new( :fromCurrency => { :currencyID => "USD", :amount => "50.0"})
|
54
|
-
test_type.fromCurrency.
|
55
|
-
test_type.fromCurrency.currencyID.
|
56
|
-
test_type.fromCurrency.amount.
|
54
|
+
expect(test_type.fromCurrency).to be_a TestCurrency
|
55
|
+
expect(test_type.fromCurrency.currencyID).to eql "USD"
|
56
|
+
expect(test_type.fromCurrency.amount).to eql "50.0"
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should allow block with initializer" do
|
@@ -63,8 +63,8 @@ describe PayPal::SDK::Core::API::DataTypes::Base do
|
|
63
63
|
self.amount = "50.0"
|
64
64
|
end
|
65
65
|
end
|
66
|
-
test_type.fromCurrency.currencyID.
|
67
|
-
test_type.fromCurrency.amount.
|
66
|
+
expect(test_type.fromCurrency.currencyID).to eql "USD"
|
67
|
+
expect(test_type.fromCurrency.amount).to eql "50.0"
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should allow block with member" do
|
@@ -73,116 +73,116 @@ describe PayPal::SDK::Core::API::DataTypes::Base do
|
|
73
73
|
self.currencyID = "USD"
|
74
74
|
self.amount = "50.0"
|
75
75
|
end
|
76
|
-
test_type.fromCurrency.currencyID.
|
77
|
-
test_type.fromCurrency.amount.
|
76
|
+
expect(test_type.fromCurrency.currencyID).to eql "USD"
|
77
|
+
expect(test_type.fromCurrency.amount).to eql "50.0"
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should assign value to attribute" do
|
81
81
|
test_currency = TestCurrency.new( :@currencyID => "USD", :amount => "50" )
|
82
|
-
test_currency.currencyID.
|
82
|
+
expect(test_currency.currencyID).to eql "USD"
|
83
83
|
end
|
84
84
|
|
85
85
|
it "should allow configured Class object" do
|
86
86
|
test_currency = TestCurrency.new( :currencyID => "USD", :amount => "50" )
|
87
87
|
test_type = TestType.new( :fromCurrency => test_currency )
|
88
|
-
test_type.fromCurrency.
|
88
|
+
expect(test_type.fromCurrency).to eql test_currency
|
89
89
|
end
|
90
90
|
|
91
91
|
it "should allow snakecase" do
|
92
92
|
test_type = TestType.new( :from_currency => {} )
|
93
|
-
test_type.from_currency.
|
94
|
-
test_type.from_currency.
|
93
|
+
expect(test_type.from_currency).to be_a TestCurrency
|
94
|
+
expect(test_type.from_currency).to eql test_type.fromCurrency
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should allow array" do
|
98
98
|
test_type = TestType.new( :toCurrency => [{ :currencyID => "USD", :amount => "50.0" }] )
|
99
|
-
test_type.toCurrency.
|
100
|
-
test_type.toCurrency.first.
|
101
|
-
test_type.toCurrency.first.currencyID.
|
99
|
+
expect(test_type.toCurrency).to be_a Array
|
100
|
+
expect(test_type.toCurrency.first).to be_a TestCurrency
|
101
|
+
expect(test_type.toCurrency.first.currencyID).to eql "USD"
|
102
102
|
end
|
103
103
|
|
104
104
|
it "should skip undefind members on initializer" do
|
105
105
|
test_type = TestType.new( :notExist => "testing")
|
106
|
-
|
106
|
+
expect do
|
107
107
|
test_type.notExist
|
108
|
-
end.
|
109
|
-
|
108
|
+
end.to raise_error NoMethodError
|
109
|
+
expect do
|
110
110
|
test_type.notExist = "Value"
|
111
|
-
end.
|
111
|
+
end.to raise_error NoMethodError
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should not convert empty hash" do
|
115
115
|
test_type = TestType.new( :fromCurrency => {} )
|
116
|
-
test_type.to_hash.
|
116
|
+
expect(test_type.to_hash).to eql({})
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should not convert empty array" do
|
120
120
|
test_type = TestType.new( :toCurrency => [] )
|
121
|
-
test_type.to_hash.
|
121
|
+
expect(test_type.to_hash).to eql({})
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should not convert array of empty hash" do
|
125
125
|
test_type = TestType.new( :toCurrency => [ {} ] )
|
126
|
-
test_type.to_hash.
|
126
|
+
expect(test_type.to_hash).to eql({})
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should return empty hash" do
|
130
130
|
test_type = TestType.new
|
131
|
-
test_type.to_hash.
|
131
|
+
expect(test_type.to_hash).to eql({})
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should convert to hash" do
|
135
135
|
test_currency = TestCurrency.new(:amount => "500")
|
136
|
-
test_currency.to_hash.
|
136
|
+
expect(test_currency.to_hash).to eql("amount" => "500")
|
137
137
|
end
|
138
138
|
|
139
139
|
it "should convert to hash with key as symbol" do
|
140
140
|
test_currency = TestCurrency.new(:amount => "500")
|
141
|
-
test_currency.to_hash(:symbol => true).
|
141
|
+
expect(test_currency.to_hash(:symbol => true)).to eql(:amount => "500")
|
142
142
|
end
|
143
143
|
|
144
144
|
it "should convert attribute key with @" do
|
145
145
|
test_currency = TestCurrency.new( :currencyID => "USD", :amount => "50" )
|
146
|
-
test_currency.to_hash["@currencyID"].
|
146
|
+
expect(test_currency.to_hash["@currencyID"]).to eql "USD"
|
147
147
|
end
|
148
148
|
|
149
149
|
it "should convert attribute key without @" do
|
150
150
|
test_currency = TestCurrency.new( :currencyID => "USD", :amount => "50" )
|
151
|
-
test_currency.to_hash(:attribute => false)["currencyID"].
|
151
|
+
expect(test_currency.to_hash(:attribute => false)["currencyID"]).to eql "USD"
|
152
152
|
end
|
153
153
|
|
154
154
|
it "should convert to hash with namespace" do
|
155
155
|
test_currency = TestCurrency.new(:currencyID => "USD", :amount => "500", :desciption => "Testing" )
|
156
156
|
hash = test_currency.to_hash
|
157
|
-
hash["amount"].
|
158
|
-
hash["ns:desciption"].
|
159
|
-
hash["@currencyID"].
|
157
|
+
expect(hash["amount"]).to eql "500"
|
158
|
+
expect(hash["ns:desciption"]).to eql "Testing"
|
159
|
+
expect(hash["@currencyID"]).to eql "USD"
|
160
160
|
hash = test_currency.to_hash(:namespace => false)
|
161
|
-
hash["amount"].
|
162
|
-
hash["desciption"].
|
163
|
-
hash["@currencyID"].
|
161
|
+
expect(hash["amount"]).to eql "500"
|
162
|
+
expect(hash["desciption"]).to eql "Testing"
|
163
|
+
expect(hash["@currencyID"]).to eql "USD"
|
164
164
|
end
|
165
165
|
|
166
166
|
it "should allow namespace" do
|
167
167
|
test_currency = TestCurrency.new(:amount => "500", :"ns:desciption" => "Testing" )
|
168
|
-
test_currency.desciption.
|
168
|
+
expect(test_currency.desciption).to eql "Testing"
|
169
169
|
end
|
170
170
|
|
171
171
|
it "should use name option in members" do
|
172
172
|
test_type = TestType.new( :firstname => "FirstName")
|
173
|
-
test_type.to_hash.
|
173
|
+
expect(test_type.to_hash).to eql({"first-name" => "FirstName" })
|
174
174
|
end
|
175
175
|
|
176
176
|
it "should allow date" do
|
177
177
|
date_time = "2010-10-10T10:10:10"
|
178
178
|
test_simple_type = TestSimpleType.new( :created_on => date_time, :created_at => date_time )
|
179
|
-
test_simple_type.created_on.
|
180
|
-
test_simple_type.created_at.
|
179
|
+
expect(test_simple_type.created_on).to be_a Date
|
180
|
+
expect(test_simple_type.created_at).to be_a DateTime
|
181
181
|
end
|
182
182
|
|
183
183
|
it "should allow date with value 0" do
|
184
184
|
test_simple_type = TestSimpleType.new( :created_at => "0" )
|
185
|
-
test_simple_type.created_at.
|
185
|
+
expect(test_simple_type.created_at).to be_a DateTime
|
186
186
|
end
|
187
187
|
|
188
188
|
end
|
data/spec/core/api/rest_spec.rb
CHANGED
@@ -22,68 +22,68 @@ describe PayPal::SDK::Core::API::REST do
|
|
22
22
|
describe "Configuration" do
|
23
23
|
it "create api with prefix" do
|
24
24
|
api = create_api("v1/payments")
|
25
|
-
api.uri.path.
|
25
|
+
expect(api.uri.path).to eql "/v1/payments"
|
26
26
|
end
|
27
27
|
|
28
28
|
it "service endpoint for sandbox" do
|
29
29
|
api = create_api
|
30
|
-
api.service_endpoint.
|
31
|
-
api.token_endpoint.
|
30
|
+
expect(api.service_endpoint).to eql "https://api.sandbox.paypal.com"
|
31
|
+
expect(api.token_endpoint).to eql "https://api.sandbox.paypal.com"
|
32
32
|
api = create_api( :mode => "sandbox" )
|
33
|
-
api.service_endpoint.
|
34
|
-
api.token_endpoint.
|
33
|
+
expect(api.service_endpoint).to eql "https://api.sandbox.paypal.com"
|
34
|
+
expect(api.token_endpoint).to eql "https://api.sandbox.paypal.com"
|
35
35
|
api = create_api( :mode => :sandbox )
|
36
|
-
api.service_endpoint.
|
37
|
-
api.token_endpoint.
|
36
|
+
expect(api.service_endpoint).to eql "https://api.sandbox.paypal.com"
|
37
|
+
expect(api.token_endpoint).to eql "https://api.sandbox.paypal.com"
|
38
38
|
api = create_api( :mode => "invalid" )
|
39
|
-
api.service_endpoint.
|
40
|
-
api.token_endpoint.
|
39
|
+
expect(api.service_endpoint).to eql "https://api.sandbox.paypal.com"
|
40
|
+
expect(api.token_endpoint).to eql "https://api.sandbox.paypal.com"
|
41
41
|
api = create_api( :mode => nil )
|
42
|
-
api.service_endpoint.
|
43
|
-
api.token_endpoint.
|
42
|
+
expect(api.service_endpoint).to eql "https://api.sandbox.paypal.com"
|
43
|
+
expect(api.token_endpoint).to eql "https://api.sandbox.paypal.com"
|
44
44
|
end
|
45
45
|
|
46
46
|
it "service endpoint for live" do
|
47
47
|
api = create_api( :mode => "live" )
|
48
|
-
api.service_endpoint.
|
49
|
-
api.token_endpoint.
|
48
|
+
expect(api.service_endpoint).to eql "https://api.paypal.com"
|
49
|
+
expect(api.token_endpoint).to eql "https://api.paypal.com"
|
50
50
|
api = create_api( :mode => :live )
|
51
|
-
api.service_endpoint.
|
52
|
-
api.token_endpoint.
|
51
|
+
expect(api.service_endpoint).to eql "https://api.paypal.com"
|
52
|
+
expect(api.token_endpoint).to eql "https://api.paypal.com"
|
53
53
|
end
|
54
54
|
|
55
55
|
it "override service endpoint" do
|
56
56
|
api = create_api( :rest_endpoint => "https://testing.api.paypal.com" )
|
57
|
-
api.service_endpoint.
|
58
|
-
api.token_endpoint.
|
57
|
+
expect(api.service_endpoint).to eql "https://testing.api.paypal.com"
|
58
|
+
expect(api.token_endpoint).to eql "https://testing.api.paypal.com"
|
59
59
|
api = create_api( :endpoint => "https://testing.api.paypal.com" )
|
60
|
-
api.service_endpoint.
|
61
|
-
api.token_endpoint.
|
60
|
+
expect(api.service_endpoint).to eql "https://testing.api.paypal.com"
|
61
|
+
expect(api.token_endpoint).to eql "https://testing.api.paypal.com"
|
62
62
|
end
|
63
63
|
|
64
64
|
it "override token endpoint" do
|
65
65
|
api = create_api( :rest_token_endpoint => "https://testing.api.paypal.com" )
|
66
|
-
api.service_endpoint.
|
67
|
-
api.token_endpoint.
|
66
|
+
expect(api.service_endpoint).to eql "https://api.sandbox.paypal.com"
|
67
|
+
expect(api.token_endpoint).to eql "https://testing.api.paypal.com"
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
describe "Validation" do
|
72
72
|
it "Invalid client_id and client_secret" do
|
73
73
|
api = create_api(:with_authentication, :client_id => "XYZ", :client_secret => "ABC")
|
74
|
-
|
74
|
+
expect {
|
75
75
|
api.token
|
76
|
-
}.
|
76
|
+
}.to raise_error PayPal::SDK::Core::Exceptions::UnauthorizedAccess
|
77
77
|
end
|
78
78
|
|
79
79
|
xit "Should handle expired token" do
|
80
80
|
old_token = @api.token
|
81
81
|
@api.token_hash[:expires_in] = 0
|
82
|
-
@api.token.
|
82
|
+
expect(@api.token).not_to eql old_token
|
83
83
|
end
|
84
84
|
|
85
85
|
it "Get token" do
|
86
|
-
@api.token.
|
86
|
+
expect(@api.token).not_to be_nil
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -104,13 +104,13 @@ describe PayPal::SDK::Core::API::REST do
|
|
104
104
|
"amount" => {
|
105
105
|
"total" => "7.47",
|
106
106
|
"currency" => "USD" }}]})
|
107
|
-
response["error"].
|
107
|
+
expect(response["error"]).to be_nil
|
108
108
|
end
|
109
109
|
|
110
110
|
it "List Payments" do
|
111
111
|
response = @api.get("payment", { "count" => 10 })
|
112
|
-
response["error"].
|
113
|
-
response["count"].
|
112
|
+
expect(response["error"]).to be_nil
|
113
|
+
expect(response["count"]).not_to be_nil
|
114
114
|
end
|
115
115
|
|
116
116
|
it "Execute Payment"
|
@@ -122,26 +122,26 @@ describe PayPal::SDK::Core::API::REST do
|
|
122
122
|
"expire_month" => "11", "expire_year" => "2018",
|
123
123
|
"cvv2" => "874",
|
124
124
|
"first_name" => "Joe", "last_name" => "Shopper" })
|
125
|
-
new_funding_instrument["error"].
|
126
|
-
new_funding_instrument["id"].
|
125
|
+
expect(new_funding_instrument["error"]).to be_nil
|
126
|
+
expect(new_funding_instrument["id"]).not_to be_nil
|
127
127
|
|
128
128
|
funding_instrument = @vault_api.get("credit-card/#{new_funding_instrument["id"]}")
|
129
|
-
funding_instrument["error"].
|
130
|
-
funding_instrument["id"].
|
129
|
+
expect(funding_instrument["error"]).to be_nil
|
130
|
+
expect(funding_instrument["id"]).to eql new_funding_instrument["id"]
|
131
131
|
end
|
132
132
|
|
133
133
|
end
|
134
134
|
|
135
135
|
describe "Failure request", :integration => true do
|
136
136
|
it "Invalid Resource ID" do
|
137
|
-
|
137
|
+
expect {
|
138
138
|
response = @api.get("payment/PAY-1234")
|
139
|
-
}.
|
139
|
+
}.to raise_error PayPal::SDK::Core::Exceptions::ResourceNotFound
|
140
140
|
end
|
141
141
|
|
142
142
|
it "Invalid parameters" do
|
143
143
|
response = @api.post("payment")
|
144
|
-
response["error"]["name"].
|
144
|
+
expect(response["error"]["name"]).to eql "VALIDATION_ERROR"
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|