paypal-sdk-rest 1.4.9 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/lib/paypal-sdk/core/api/rest.rb +13 -1
- data/lib/paypal-sdk/core/openid_connect.rb +1 -1
- data/lib/paypal-sdk/rest/data_types.rb +234 -58
- data/lib/paypal-sdk/rest/version.rb +1 -1
- data/spec/payments_examples_spec.rb +48 -1
- data/spec/spec_helper.rb +2 -0
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b3439f7dc0c9f865a7cc7815422c6b9bc81d050
|
4
|
+
data.tar.gz: bf6283b0d9c0f1fdc37093839b44dba33801324e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77823b3d706673505b29aae207be9faf1d2c8a25525a3e2177cd5c6e18eb710bd7c250c39373f2af43e975b9d4b61fd7a9a83ad394ec1edfa5602fff2575bbd9
|
7
|
+
data.tar.gz: 5f2710b9aa5e78c3785e36ba496b139484cc0367ab83887ed6815fcab67c2cb3877165719ac5467f0e3efdc58fd7ebcb80824841065c90bd62b565a464df0409
|
data/Gemfile
CHANGED
@@ -143,7 +143,7 @@ module PayPal::SDK::Core
|
|
143
143
|
if response.code >= "200" and response.code <= "299"
|
144
144
|
response.body && response.content_type == "application/json" ? MultiJson.load(response.body) : {}
|
145
145
|
elsif response.content_type == "application/json"
|
146
|
-
{ "error" => MultiJson.load(response.body) }
|
146
|
+
{ "error" => flat_hash(MultiJson.load(response.body)) }
|
147
147
|
else
|
148
148
|
{ "error" => { "name" => response.code, "message" => response.message,
|
149
149
|
"developer_msg" => response } }
|
@@ -151,6 +151,18 @@ module PayPal::SDK::Core
|
|
151
151
|
payload
|
152
152
|
end
|
153
153
|
|
154
|
+
def flat_hash(h)
|
155
|
+
new_hash = {}
|
156
|
+
h.each_pair do |key, val|
|
157
|
+
if val.is_a?(Hash)
|
158
|
+
new_hash.merge!(flat_hash(val))
|
159
|
+
else
|
160
|
+
new_hash[key] = val
|
161
|
+
end
|
162
|
+
end
|
163
|
+
new_hash
|
164
|
+
end
|
165
|
+
|
154
166
|
# Log PayPal-Request-Id header
|
155
167
|
def log_http_call(payload)
|
156
168
|
if payload[:header] and payload[:header]["PayPal-Request-Id"]
|
@@ -20,7 +20,7 @@ module PayPal::SDK
|
|
20
20
|
end
|
21
21
|
alias_method :config=, :set_config
|
22
22
|
|
23
|
-
AUTHORIZATION_URL = "paypal.com/
|
23
|
+
AUTHORIZATION_URL = "paypal.com/signin/authorize"
|
24
24
|
ENDSESSION_URL = "paypal.com/webapps/auth/protocol/openidconnect/v1/endsession"
|
25
25
|
DEFAULT_SCOPE = "openid"
|
26
26
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'paypal-sdk-core'
|
2
|
-
require '
|
2
|
+
require 'securerandom'
|
3
3
|
require 'multi_json'
|
4
4
|
require 'open-uri'
|
5
5
|
require 'zlib'
|
@@ -17,7 +17,7 @@ module PayPal::SDK
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def request_id
|
20
|
-
@request_id ||=
|
20
|
+
@request_id ||= SecureRandom.uuid
|
21
21
|
end
|
22
22
|
|
23
23
|
def http_header
|
@@ -1122,30 +1122,39 @@ module PayPal::SDK
|
|
1122
1122
|
class Invoice < Base
|
1123
1123
|
def self.load_members
|
1124
1124
|
object_of :id, String
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1125
|
+
object_of :number, String
|
1126
|
+
object_of :template_id, String
|
1127
|
+
object_of :uri, String
|
1128
|
+
object_of :status, String
|
1129
|
+
object_of :merchant_info, MerchantInfo
|
1130
|
+
array_of :billing_info, BillingInfo
|
1131
|
+
array_of :cc_info, Participant
|
1132
|
+
object_of :shipping_info, ShippingInfo
|
1133
|
+
array_of :items, InvoiceItem
|
1134
|
+
object_of :invoice_date, String
|
1135
|
+
object_of :payment_term, PaymentTerm
|
1136
|
+
object_of :reference, String
|
1137
|
+
object_of :discount, Cost
|
1138
|
+
object_of :shipping_cost, ShippingCost
|
1139
|
+
object_of :custom, CustomAmount
|
1140
|
+
object_of :allow_partial_payment, Boolean
|
1141
|
+
object_of :minimum_amount_due, Currency
|
1142
|
+
object_of :tax_calculated_after_discount, Boolean
|
1143
|
+
object_of :tax_inclusive, Boolean
|
1144
|
+
object_of :terms, String
|
1145
|
+
object_of :note, String
|
1146
|
+
object_of :merchant_memo, String
|
1147
|
+
object_of :logo_url, String
|
1148
|
+
object_of :total_amount, Currency
|
1146
1149
|
array_of :payments, PaymentDetail
|
1147
|
-
array_of :
|
1148
|
-
|
1150
|
+
array_of :refunds, RefundDetail
|
1151
|
+
object_of :metadata, Metadata
|
1152
|
+
object_of :additional_data, String
|
1153
|
+
object_of :gratuity, Currency
|
1154
|
+
object_of :paid_amount, PaymentSummary
|
1155
|
+
object_of :refunded_amount, PaymentSummary
|
1156
|
+
array_of :attachments, FileAttachment
|
1157
|
+
array_of :links, Links
|
1149
1158
|
end
|
1150
1159
|
|
1151
1160
|
include RequestDataType
|
@@ -1213,7 +1222,6 @@ module PayPal::SDK
|
|
1213
1222
|
raise_on_api_error :create, :send_invoice, :remind, :cancel,
|
1214
1223
|
:record_payment, :record_refund, :update, :delete
|
1215
1224
|
|
1216
|
-
|
1217
1225
|
#
|
1218
1226
|
class << self
|
1219
1227
|
def search(options, access_token = nil)
|
@@ -1235,11 +1243,157 @@ module PayPal::SDK
|
|
1235
1243
|
api.token = access_token unless access_token.nil?
|
1236
1244
|
Invoices.new(api.get(path, options))
|
1237
1245
|
end
|
1246
|
+
|
1247
|
+
def qr_code(options = {})
|
1248
|
+
path = "v1/invoicing/invoices/{invoice_id}/qr-code"
|
1249
|
+
object.new(api.get(path, options))
|
1250
|
+
end
|
1251
|
+
|
1252
|
+
def self.generate_number(options)
|
1253
|
+
path = "v1/invoicing/invoices/next-invoice-number"
|
1254
|
+
response = api.post(path, options)
|
1255
|
+
object.new(response)
|
1256
|
+
end
|
1238
1257
|
end
|
1239
1258
|
end
|
1240
1259
|
|
1241
|
-
class
|
1260
|
+
class Participant < Base
|
1261
|
+
def self.load_members
|
1262
|
+
object_of :email, String
|
1263
|
+
object_of :first_name, String
|
1264
|
+
object_of :last_name, String
|
1265
|
+
object_of :business_name, String
|
1266
|
+
object_of :phone, Phone
|
1267
|
+
object_of :fax, Phone
|
1268
|
+
object_of :website, String
|
1269
|
+
object_of :additional_info, String
|
1270
|
+
object_of :address, Address
|
1271
|
+
end
|
1272
|
+
end
|
1273
|
+
|
1274
|
+
class Template < Base
|
1275
|
+
|
1276
|
+
def self.load_members
|
1277
|
+
object_of :template_id, String
|
1278
|
+
object_of :name, String
|
1279
|
+
object_of :default, Boolean
|
1280
|
+
object_of :template_data, TemplateData
|
1281
|
+
array_of :settings, TemplateSettings
|
1282
|
+
object_of :unit_of_measure, String
|
1283
|
+
object_of :custom, Boolean
|
1284
|
+
array_of :links, Links
|
1285
|
+
end
|
1286
|
+
|
1287
|
+
include RequestDataType
|
1288
|
+
|
1289
|
+
def delete()
|
1290
|
+
path = "v1/invoicing/templates/#{self.template_id}"
|
1291
|
+
response = api.delete(path, {})
|
1292
|
+
self.merge!(response)
|
1293
|
+
success?
|
1294
|
+
end
|
1295
|
+
|
1296
|
+
def update()
|
1297
|
+
path = "v1/invoicing/templates/#{self.template_id}"
|
1298
|
+
response = api.put(path, self.to_hash, http_header)
|
1299
|
+
self.merge!(response)
|
1300
|
+
Template.new(response)
|
1301
|
+
end
|
1302
|
+
|
1303
|
+
def create()
|
1304
|
+
path = "v1/invoicing/templates"
|
1305
|
+
response = api.post(path, self.to_hash, http_header)
|
1306
|
+
self.merge!(response)
|
1307
|
+
Template.new(response)
|
1308
|
+
end
|
1309
|
+
|
1310
|
+
class << self
|
1311
|
+
def get(template_id, options = {})
|
1312
|
+
raise ArgumentError.new("template_id required") if template_id.to_s.strip.empty?
|
1313
|
+
path = "v1/invoicing/templates/#{template_id}"
|
1314
|
+
self.new(api.get(path, options))
|
1315
|
+
end
|
1316
|
+
end
|
1317
|
+
end
|
1318
|
+
|
1319
|
+
class TemplateData < Base
|
1242
1320
|
|
1321
|
+
def self.load_members
|
1322
|
+
object_of :merchant_info, MerchantInfo
|
1323
|
+
array_of :billing_info, BillingInfo
|
1324
|
+
array_of :cc_info, String
|
1325
|
+
object_of :shipping_info, ShippingInfo
|
1326
|
+
array_of :items, InvoiceItem
|
1327
|
+
object_of :payment_term, PaymentTerm
|
1328
|
+
object_of :reference, String
|
1329
|
+
object_of :discount, Cost
|
1330
|
+
object_of :shipping_cost, ShippingCost
|
1331
|
+
object_of :custom, CustomAmount
|
1332
|
+
object_of :allow_partial_payment, Boolean
|
1333
|
+
object_of :minimum_amount_due, Currency
|
1334
|
+
object_of :tax_calculated_after_discount, Boolean
|
1335
|
+
object_of :tax_inclusive, Boolean
|
1336
|
+
object_of :terms, String
|
1337
|
+
object_of :note, String
|
1338
|
+
object_of :merchant_memo, String
|
1339
|
+
object_of :logo_url, String
|
1340
|
+
object_of :total_amount, Currency
|
1341
|
+
array_of :attachments, FileAttachment
|
1342
|
+
end
|
1343
|
+
|
1344
|
+
end
|
1345
|
+
|
1346
|
+
class TemplateSettings < Base
|
1347
|
+
|
1348
|
+
def self.load_members
|
1349
|
+
object_of :field_name, String
|
1350
|
+
object_of :display_preference, TemplateSettingsMetadata
|
1351
|
+
end
|
1352
|
+
end
|
1353
|
+
|
1354
|
+
class TemplateSettingsMetadata < Base
|
1355
|
+
|
1356
|
+
def self.load_members
|
1357
|
+
object_of :hidden, Boolean
|
1358
|
+
end
|
1359
|
+
|
1360
|
+
end
|
1361
|
+
|
1362
|
+
class PaymentSummary < Base
|
1363
|
+
def self.load_members
|
1364
|
+
object_of :paypal, Currency
|
1365
|
+
object_of :other, Currency
|
1366
|
+
end
|
1367
|
+
end
|
1368
|
+
class FileAttachment < Base
|
1369
|
+
|
1370
|
+
def self.load_members
|
1371
|
+
object_of :name, String
|
1372
|
+
object_of :url, String
|
1373
|
+
end
|
1374
|
+
|
1375
|
+
end
|
1376
|
+
class Templates < Base
|
1377
|
+
|
1378
|
+
def self.load_members
|
1379
|
+
array_of :addresses, Address
|
1380
|
+
array_of :emails, String
|
1381
|
+
array_of :phones, Phone
|
1382
|
+
array_of :templates, Template
|
1383
|
+
array_of :links, Links
|
1384
|
+
end
|
1385
|
+
|
1386
|
+
include RequestDataType
|
1387
|
+
|
1388
|
+
class << self
|
1389
|
+
def get_all(options = {})
|
1390
|
+
path = "v1/invoicing/templates/"
|
1391
|
+
Templates.new(api.get(path, options))
|
1392
|
+
end
|
1393
|
+
end
|
1394
|
+
end
|
1395
|
+
|
1396
|
+
class WebhooksEventType < Base
|
1243
1397
|
def self.load_members
|
1244
1398
|
array_of :event_types, EventType
|
1245
1399
|
end
|
@@ -1270,6 +1424,7 @@ module PayPal::SDK
|
|
1270
1424
|
def self.load_members
|
1271
1425
|
object_of :name, String
|
1272
1426
|
object_of :description, String
|
1427
|
+
object_of :status, String
|
1273
1428
|
end
|
1274
1429
|
end
|
1275
1430
|
|
@@ -1286,10 +1441,12 @@ module PayPal::SDK
|
|
1286
1441
|
object_of :id, String
|
1287
1442
|
object_of :create_time, String
|
1288
1443
|
object_of :resource_type, String
|
1444
|
+
object_of :event_version, String
|
1289
1445
|
object_of :event_type, String
|
1290
1446
|
object_of :summary, String
|
1447
|
+
object_of :status, String
|
1291
1448
|
object_of :resource, Hash
|
1292
|
-
array_of
|
1449
|
+
array_of :links, Links
|
1293
1450
|
end
|
1294
1451
|
|
1295
1452
|
def resend()
|
@@ -1384,9 +1541,20 @@ module PayPal::SDK
|
|
1384
1541
|
end
|
1385
1542
|
|
1386
1543
|
def get(webhook_event_id)
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1544
|
+
WebhookEvent.find(webhook_event_id)
|
1545
|
+
end
|
1546
|
+
|
1547
|
+
class << self
|
1548
|
+
def find(resource_id)
|
1549
|
+
raise ArgumentError.new("webhook_event_id required") if resource_id.to_s.strip.empty?
|
1550
|
+
path = "v1/notifications/webhooks-events/#{resource_id}"
|
1551
|
+
self.new(api.get(path))
|
1552
|
+
end
|
1553
|
+
|
1554
|
+
def all(options = {})
|
1555
|
+
path = "v1/notifications/webhooks-events"
|
1556
|
+
WebhookEventList.new(api.get(path, options))
|
1557
|
+
end
|
1390
1558
|
end
|
1391
1559
|
end
|
1392
1560
|
end
|
@@ -1396,8 +1564,8 @@ module PayPal::SDK
|
|
1396
1564
|
def self.load_members
|
1397
1565
|
object_of :id, String
|
1398
1566
|
object_of :url, String
|
1399
|
-
array_of
|
1400
|
-
array_of
|
1567
|
+
array_of :event_types, EventType
|
1568
|
+
array_of :links, Links
|
1401
1569
|
end
|
1402
1570
|
|
1403
1571
|
include RequestDataType
|
@@ -1433,11 +1601,13 @@ module PayPal::SDK
|
|
1433
1601
|
path = "v1/notifications/webhooks/#{webhook_id}"
|
1434
1602
|
Webhook.new(api.get(path))
|
1435
1603
|
end
|
1604
|
+
|
1436
1605
|
def get_event_types(webhook_id)
|
1437
1606
|
raise ArgumentError.new("webhook_id required") if webhook_id.to_s.strip.empty?
|
1438
1607
|
path = "v1/notifications/webhooks/#{webhook_id}/event-types"
|
1439
1608
|
EventTypeList.new(api.get(path))
|
1440
1609
|
end
|
1610
|
+
|
1441
1611
|
def all(options={})
|
1442
1612
|
path = "v1/notifications/webhooks"
|
1443
1613
|
WebhookList.new(api.get(path))
|
@@ -1559,28 +1729,31 @@ module PayPal::SDK
|
|
1559
1729
|
|
1560
1730
|
class InvoiceItem < Base
|
1561
1731
|
def self.load_members
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1732
|
+
object_of :name, String
|
1733
|
+
object_of :description, String
|
1734
|
+
object_of :quantity, Number
|
1735
|
+
object_of :unit_price, Currency
|
1736
|
+
object_of :tax, Tax
|
1737
|
+
object_of :date, String
|
1738
|
+
object_of :discount, Cost
|
1739
|
+
object_of :image_url, String
|
1740
|
+
object_of :unit_of_measure, String
|
1569
1741
|
end
|
1570
1742
|
end
|
1571
1743
|
|
1572
1744
|
class MerchantInfo < Base
|
1573
1745
|
def self.load_members
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1746
|
+
object_of :email, String
|
1747
|
+
object_of :first_name, String
|
1748
|
+
object_of :last_name, String
|
1749
|
+
object_of :address, Address
|
1750
|
+
object_of :business_name, String
|
1751
|
+
object_of :phone, Phone
|
1752
|
+
object_of :fax, Phone
|
1753
|
+
object_of :website, String
|
1754
|
+
object_of :tax_id, String
|
1755
|
+
object_of :additional_info_label, String
|
1756
|
+
object_of :additional_info, String
|
1584
1757
|
end
|
1585
1758
|
end
|
1586
1759
|
|
@@ -1593,6 +1766,8 @@ module PayPal::SDK
|
|
1593
1766
|
object_of :address, Address
|
1594
1767
|
object_of :language, String
|
1595
1768
|
object_of :additional_info, String
|
1769
|
+
object_of :notification_channel, String
|
1770
|
+
object_of :phone, Phone
|
1596
1771
|
end
|
1597
1772
|
end
|
1598
1773
|
|
@@ -1611,6 +1786,7 @@ module PayPal::SDK
|
|
1611
1786
|
object_of :subject, String
|
1612
1787
|
object_of :note, String
|
1613
1788
|
object_of :send_to_merchant, Boolean
|
1789
|
+
array_of :cc_emails, String
|
1614
1790
|
end
|
1615
1791
|
end
|
1616
1792
|
|
@@ -1668,6 +1844,7 @@ module PayPal::SDK
|
|
1668
1844
|
object_of :page, Number
|
1669
1845
|
object_of :page_size, Number
|
1670
1846
|
object_of :total_count_required, Boolean
|
1847
|
+
object_of :archived, Boolean
|
1671
1848
|
end
|
1672
1849
|
end
|
1673
1850
|
|
@@ -2109,10 +2286,10 @@ module PayPal::SDK
|
|
2109
2286
|
def self.load_members
|
2110
2287
|
object_of :id, String
|
2111
2288
|
object_of :name, String
|
2289
|
+
object_of :temporary, Boolean
|
2112
2290
|
object_of :flow_config, FlowConfig
|
2113
2291
|
object_of :input_fields, InputFields
|
2114
2292
|
object_of :presentation, Presentation
|
2115
|
-
object_of :temporary, Boolean
|
2116
2293
|
end
|
2117
2294
|
|
2118
2295
|
include RequestDataType
|
@@ -2132,8 +2309,9 @@ module PayPal::SDK
|
|
2132
2309
|
end
|
2133
2310
|
|
2134
2311
|
def partial_update(patch_request)
|
2312
|
+
patch_request = PatchRequest.new(patch_request) unless patch_request.is_a? PatchRequest
|
2135
2313
|
path = "v1/payment-experience/web-profiles/#{self.id}"
|
2136
|
-
response = api.patch(path, patch_request, http_header)
|
2314
|
+
response = api.patch(path, patch_request.to_hash, http_header)
|
2137
2315
|
self.merge!(response)
|
2138
2316
|
success?
|
2139
2317
|
end
|
@@ -2173,6 +2351,8 @@ module PayPal::SDK
|
|
2173
2351
|
def self.load_members
|
2174
2352
|
object_of :landing_page_type, String
|
2175
2353
|
object_of :bank_txn_pending_url, String
|
2354
|
+
object_of :user_action, String
|
2355
|
+
object_of :return_uri_http_method, String
|
2176
2356
|
end
|
2177
2357
|
end
|
2178
2358
|
|
@@ -2189,12 +2369,8 @@ module PayPal::SDK
|
|
2189
2369
|
object_of :brand_name, String
|
2190
2370
|
object_of :logo_image, String
|
2191
2371
|
object_of :locale_code, String
|
2192
|
-
|
2193
|
-
|
2194
|
-
|
2195
|
-
class CreateProfileResponse < Base
|
2196
|
-
def self.load_members
|
2197
|
-
object_of :id, String
|
2372
|
+
object_of :return_url_label, String
|
2373
|
+
object_of :note_to_seller_label, String
|
2198
2374
|
end
|
2199
2375
|
end
|
2200
2376
|
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
require 'webmock/rspec'
|
2
4
|
|
3
5
|
describe "Payments" do
|
4
6
|
|
@@ -49,6 +51,18 @@ describe "Payments" do
|
|
49
51
|
"currency" => "USD" },
|
50
52
|
"description" => "This is the payment transaction description." } ] }
|
51
53
|
|
54
|
+
ProcessorErrorResponse = {
|
55
|
+
"name" => "INSTRUMENT_DECLINED",
|
56
|
+
"message" => "The instrument presented was either declined by the processor or bank, or it can't be used for this payment.",
|
57
|
+
"information_link" => "https://developer.paypal.com/docs/api/#INSTRUMENT_DECLINED",
|
58
|
+
"debug_id" => "20dcd4f71107c",
|
59
|
+
"another_thing" => {
|
60
|
+
"avs_code" => "Y",
|
61
|
+
"cvv_code" => "N",
|
62
|
+
"response_code" => "0051"
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
52
66
|
it "Validate user-agent", :unit => true do
|
53
67
|
expect(PayPal::SDK::REST::API.user_agent).to match "PayPalSDK/PayPal-Ruby-SDK"
|
54
68
|
end
|
@@ -62,6 +76,40 @@ describe "Payments" do
|
|
62
76
|
PayPal::SDK::REST.set_config(backup_config)
|
63
77
|
expect(PayPal::SDK::REST.api.config.client_id).not_to eql "XYZ"
|
64
78
|
end
|
79
|
+
|
80
|
+
it "Create - does not return true when error not provided in response" do
|
81
|
+
oauth_response = {
|
82
|
+
:scope => "https://uri.paypal.com/services/subscriptions https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card https://uri.paypal.com/services/applications/webhooks openid https://uri.paypal.com/payments/payouts https://api.paypal.com/v1/vault/credit-card/.*",
|
83
|
+
:nonce => "2016-10-04T18:00:00ZP3PcGAv5XAncoc8Zt4MF5cRLlaEBW3OAoLEhMIFk--g",
|
84
|
+
:access_token => "A101.tp_sF5GHqWnnqEQA13Ua5ABnIhRWgd-G9LhRnJdgOvJHc_L08zlfD9WgPF4I3kre.mShauuOGxWyw8ikViItmxkWmX78",
|
85
|
+
:token_type => "Bearer",
|
86
|
+
:app_id => "APP-80W284485P519543T",
|
87
|
+
:expires_in => 30695
|
88
|
+
}
|
89
|
+
|
90
|
+
response_headers = {
|
91
|
+
"date" => ["Fri, 09 Sep 2016 17:44:23 GMT"],
|
92
|
+
"server" => ["Apache"],
|
93
|
+
"proxy_server_info" => ["host=dcg12javapapi8768.dcg12.slc.paypalinc.com;threadId=1177"],
|
94
|
+
"paypal-debug-id" => ["20dcd4f71107c", "20dcd4f71107c"],
|
95
|
+
"correlation-id" => ["20dcd4f71107c"],
|
96
|
+
"content-language" => ["*"],
|
97
|
+
"connection" => ["close", "close"],
|
98
|
+
"set-cookie" => ["X-PP-SILOVER=name%3DLIVE3.API.1%26silo_version%3D880%26app%3Dplatformapiserv%26TIME%3D4160016983%26HTTP_X_PP_AZ_LOCATOR%3Ddcg12.slc; Expires=Fri, 09 Sep 2016 18:14:25 GMT; domain=.paypal.com; path=/; Secure; HttpOnly", "X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT"],
|
99
|
+
"vary" => ["Authorization"],
|
100
|
+
"content-length" => ["335"],
|
101
|
+
"content-type"=>["application/json"]
|
102
|
+
}
|
103
|
+
|
104
|
+
stub_request(:post, "https://api.sandbox.paypal.com/v1/oauth2/token")
|
105
|
+
.to_return(:body => oauth_response.to_json)
|
106
|
+
|
107
|
+
stub_request(:post, "https://api.sandbox.paypal.com/v1/payments/payment")
|
108
|
+
.to_return(:body => ProcessorErrorResponse.to_json, :status => 400, :headers => response_headers)
|
109
|
+
|
110
|
+
payment = Payment.new(PaymentAttributes)
|
111
|
+
expect(payment.create).to be_falsey
|
112
|
+
end
|
65
113
|
end
|
66
114
|
|
67
115
|
describe "Payment", :integration => true do
|
@@ -87,7 +135,6 @@ describe "Payments" do
|
|
87
135
|
expect(new_payment.error).to be_nil
|
88
136
|
|
89
137
|
expect(payment.id).to eql new_payment.id
|
90
|
-
|
91
138
|
end
|
92
139
|
|
93
140
|
it "Create with token" do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-sdk-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PayPal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: uuidtools
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.1'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.1'
|
69
55
|
description: The PayPal REST SDK provides Ruby APIs to create, process and manage
|
70
56
|
payment.
|
71
57
|
email:
|