paypal-sdk-adaptivepayments 1.117.1 → 1.117.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +21 -15
- data/Rakefile +1 -1
- data/lib/paypal-sdk/adaptive_payments/data_types.rb +1 -1
- data/lib/paypal-sdk/adaptive_payments/urls.rb +4 -3
- metadata +12 -23
- data/spec/adaptive_payments_examples_spec.rb +0 -119
- data/spec/config/cert_key.pem +0 -33
- data/spec/config/paypal.yml +0 -22
- data/spec/convert_currency_spec.rb +0 -39
- data/spec/spec_helper.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9172dc92bec1cc25a4db6549fe1607d2993ccdae3f0ccab1ee6d29324fcc5f22
|
4
|
+
data.tar.gz: d2f97e8b607206e7b697a48ae377e46c39c8bb1805f67ff47600582a38d53b83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acee5efc5ce359d1d03d6514e1c2cd2bab62ba7e81be3c81d604e8fe3f2f62d99bfeb644e58f8b10e169add7ffe5d01a271e85e8f0dad91e51e28f32b09858f0
|
7
|
+
data.tar.gz: e33b033f0ab45c2d3e6fd1f1cd62db4b16f424433ead4fe921a3b70b86c690f385d21e8365818730c301f76ac58a9a5438486489f3d7b4286d8d4ba7380a7f00
|
data/README.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
-
# Adaptive Payments SDK
|
1
|
+
# PayPal Ruby Adaptive Payments SDK
|
2
2
|
|
3
|
-
|
3
|
+
## NOTE: THIS REPOSITORY IS DEPRECATED. CODE PUBLISHED FOR HISTORICAL PURPOSES
|
4
|
+
|
5
|
+
#### Adaptive Payments moving to limited release
|
6
|
+
|
7
|
+
> **Important**: Adaptive Payments is now a limited release product. It is restricted to select partners for approved use cases and should not be used for new integrations without guidance from PayPal.
|
8
|
+
|
9
|
+
## Support
|
10
|
+
|
11
|
+
> Please contact [PayPal Technical Support](https://developer.paypal.com/support/) for any live or account issues.
|
4
12
|
|
5
13
|
## Installation
|
6
14
|
|
@@ -34,9 +42,9 @@ For other ruby application, create a configuration file(`config/paypal.yml`):
|
|
34
42
|
|
35
43
|
```yaml
|
36
44
|
development: &default
|
37
|
-
username:
|
38
|
-
password:
|
39
|
-
signature:
|
45
|
+
username: USERNAME
|
46
|
+
password: PASSWORD
|
47
|
+
signature: SIGNATURE
|
40
48
|
app_id: APP-80W284485P519543T
|
41
49
|
http_timeout: 30
|
42
50
|
mode: sandbox
|
@@ -44,8 +52,8 @@ development: &default
|
|
44
52
|
# # with certificate
|
45
53
|
# cert_path: "config/cert_key.pem"
|
46
54
|
# # with token authentication
|
47
|
-
# token:
|
48
|
-
# token_secret:
|
55
|
+
# token: TOKEN_AUTHENTICATION
|
56
|
+
# token_secret: TOKEN_SECRET
|
49
57
|
# # with Proxy
|
50
58
|
# http_proxy: http://proxy-ipaddress:3129/
|
51
59
|
# # with device ip address
|
@@ -72,9 +80,9 @@ Or without configuration file:
|
|
72
80
|
PayPal::SDK.configure(
|
73
81
|
:mode => "sandbox", # Set "live" for production
|
74
82
|
:app_id => "APP-80W284485P519543T",
|
75
|
-
:username => "
|
76
|
-
:password => "
|
77
|
-
:signature => "
|
83
|
+
:username => "Replace with API username",
|
84
|
+
:password => "Replace with API password",
|
85
|
+
:signature => "Replace with API signature" )
|
78
86
|
```
|
79
87
|
|
80
88
|
## Example
|
@@ -84,9 +92,9 @@ require 'paypal-sdk-adaptivepayments'
|
|
84
92
|
PayPal::SDK.configure(
|
85
93
|
:mode => "sandbox", # Set "live" for production
|
86
94
|
:app_id => "APP-80W284485P519543T",
|
87
|
-
:username => "
|
88
|
-
:password => "
|
89
|
-
:signature => "
|
95
|
+
:username => "Replace with API username",
|
96
|
+
:password => "Replace with API password",
|
97
|
+
:signature => "Replace with API signature" )
|
90
98
|
|
91
99
|
@api = PayPal::SDK::AdaptivePayments.new
|
92
100
|
|
@@ -115,8 +123,6 @@ else
|
|
115
123
|
end
|
116
124
|
```
|
117
125
|
|
118
|
-
For more samples [https://paypal-sdk-samples.herokuapp.com/adaptive_payments/](https://paypal-sdk-samples.herokuapp.com/adaptive_payments/)
|
119
|
-
|
120
126
|
## Samples App
|
121
127
|
|
122
128
|
Add following line in rails `Gemfile`:
|
data/Rakefile
CHANGED
@@ -3,11 +3,12 @@ module PayPal
|
|
3
3
|
module AdaptivePayments
|
4
4
|
module Urls
|
5
5
|
REDIRECT_ENDPOINTS = {
|
6
|
-
:live => "https://www.paypal.com
|
7
|
-
:sandbox => "https://www.sandbox.paypal.com
|
6
|
+
:live => "https://www.paypal.com",
|
7
|
+
:sandbox => "https://www.sandbox.paypal.com" }
|
8
8
|
|
9
9
|
def redirect_url(params = {})
|
10
|
-
"
|
10
|
+
locale = defined?(I18n) && "/#{I18n.locale}"
|
11
|
+
"#{REDIRECT_ENDPOINTS[api_mode]}#{locale}/webscr?#{encode_www_form(params)}"
|
11
12
|
end
|
12
13
|
|
13
14
|
def payment_url(key)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-sdk-adaptivepayments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.117.
|
4
|
+
version: 1.117.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PayPal
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paypal-sdk-core
|
@@ -24,11 +24,11 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.3.0
|
27
|
-
description: The PayPal Adaptive Payments SDK provides Ruby APIs to
|
28
|
-
and manage simple and complex (parallel and chained) payments, and
|
29
|
-
using the Adaptive Payments API.
|
27
|
+
description: "[Deprecated] The PayPal Adaptive Payments SDK provides Ruby APIs to
|
28
|
+
create, process and manage simple and complex (parallel and chained) payments, and
|
29
|
+
pre-approvals using the Adaptive Payments API."
|
30
30
|
email:
|
31
|
-
- DL-PP-Platform-Ruby-SDK@
|
31
|
+
- DL-PP-Platform-Ruby-SDK@paypal.com
|
32
32
|
executables: []
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
@@ -43,16 +43,11 @@ files:
|
|
43
43
|
- lib/paypal-sdk/adaptive_payments/services.rb
|
44
44
|
- lib/paypal-sdk/adaptive_payments/urls.rb
|
45
45
|
- lib/paypal-sdk/adaptive_payments/version.rb
|
46
|
-
- spec/adaptive_payments_examples_spec.rb
|
47
|
-
- spec/config/cert_key.pem
|
48
|
-
- spec/config/paypal.yml
|
49
|
-
- spec/convert_currency_spec.rb
|
50
|
-
- spec/spec_helper.rb
|
51
46
|
homepage: https://developer.paypal.com
|
52
47
|
licenses:
|
53
48
|
- PayPal SDK License
|
54
49
|
metadata: {}
|
55
|
-
post_install_message:
|
50
|
+
post_install_message:
|
56
51
|
rdoc_options: []
|
57
52
|
require_paths:
|
58
53
|
- lib
|
@@ -67,14 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
62
|
- !ruby/object:Gem::Version
|
68
63
|
version: '0'
|
69
64
|
requirements: []
|
70
|
-
|
71
|
-
|
72
|
-
signing_key:
|
65
|
+
rubygems_version: 3.4.10
|
66
|
+
signing_key:
|
73
67
|
specification_version: 4
|
74
|
-
summary:
|
75
|
-
test_files:
|
76
|
-
- spec/adaptive_payments_examples_spec.rb
|
77
|
-
- spec/config/cert_key.pem
|
78
|
-
- spec/config/paypal.yml
|
79
|
-
- spec/convert_currency_spec.rb
|
80
|
-
- spec/spec_helper.rb
|
68
|
+
summary: Deprecated.
|
69
|
+
test_files: []
|
@@ -1,119 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "AdaptivePayments" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@api = PayPal::SDK::AdaptivePayments::API.new
|
7
|
-
@api_with_cert = PayPal::SDK::AdaptivePayments::API.new(:with_certificate)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "Examples" do
|
11
|
-
it "Pay" do
|
12
|
-
# Build request object
|
13
|
-
@pay = @api.build_pay({
|
14
|
-
:actionType => "PAY",
|
15
|
-
:cancelUrl => "http://localhost:3000/samples/adaptive_payments/pay",
|
16
|
-
:currencyCode => "USD",
|
17
|
-
:feesPayer => "SENDER",
|
18
|
-
:ipnNotificationUrl => "http://localhost:3000/samples/adaptive_payments/ipn_notify",
|
19
|
-
:receiverList => {
|
20
|
-
:receiver => [{
|
21
|
-
:amount => 1.0,
|
22
|
-
:email => "platfo_1255612361_per@gmail.com" }] },
|
23
|
-
:returnUrl => "http://localhost:3000/samples/adaptive_payments/pay" })
|
24
|
-
|
25
|
-
# Make API call & get response
|
26
|
-
@pay_response = @api.pay(@pay)
|
27
|
-
@pay_response.should be_success
|
28
|
-
|
29
|
-
@payment_details_request = @api.build_payment_details()
|
30
|
-
@payment_details_request.payKey = @pay_response.payKey
|
31
|
-
@payment_details_response = @api.payment_details(@payment_details_request)
|
32
|
-
@payment_details_response.should be_success
|
33
|
-
|
34
|
-
# Make API call & get response
|
35
|
-
@pay_response = @api_with_cert.pay(@pay)
|
36
|
-
@pay_response.should be_success
|
37
|
-
|
38
|
-
@payment_details_request = @api_with_cert.build_payment_details()
|
39
|
-
@payment_details_request.payKey = @pay_response.payKey
|
40
|
-
@payment_details_response = @api_with_cert.payment_details(@payment_details_request)
|
41
|
-
@payment_details_response.should be_success
|
42
|
-
end
|
43
|
-
|
44
|
-
it "Get Payment details" do
|
45
|
-
@payment_details_response = @api.payment_details({
|
46
|
-
:payKey => "AP-5S482348KH512131U" })
|
47
|
-
@payment_details_response.should be_success
|
48
|
-
@payment_details_response.should_not be_failure
|
49
|
-
@payment_details_response.should_not be_warning
|
50
|
-
|
51
|
-
@payment_details_response = @api.payment_details({})
|
52
|
-
@payment_details_response.should be_failure
|
53
|
-
@payment_details_response.should_not be_success
|
54
|
-
@payment_details_response.should_not be_warning
|
55
|
-
end
|
56
|
-
|
57
|
-
it "Preapproval" do
|
58
|
-
|
59
|
-
@preapproval = @api.build_preapproval({
|
60
|
-
:cancelUrl => "http://localhost:3000/samples/adaptive_payments/preapproval",
|
61
|
-
:currencyCode => "USD",
|
62
|
-
:returnUrl => "http://localhost:3000/samples/adaptive_payments/preapproval",
|
63
|
-
:ipnNotificationUrl => "http://localhost:3000/samples/adaptive_payments/ipn_notify",
|
64
|
-
:startingDate => "2015-10-10T00:00:00+00:00" })
|
65
|
-
|
66
|
-
# Make API call & get response
|
67
|
-
@preapproval_response = @api.preapproval(@preapproval)
|
68
|
-
@preapproval_response.should be_success
|
69
|
-
|
70
|
-
@preapproval_details_request = @api.build_preapproval_details()
|
71
|
-
@preapproval_details_request.preapprovalKey = @preapproval_response.preapprovalKey
|
72
|
-
@preapproval_details_response = @api.preapproval_details(@preapproval_details_request)
|
73
|
-
@preapproval_details_response.should be_success
|
74
|
-
end
|
75
|
-
|
76
|
-
it "Cancel Preapproval" do
|
77
|
-
@cancel_preapproval_response = @api.cancel_preapproval({
|
78
|
-
:preapprovalKey => "PA-2T305990ET0354039" })
|
79
|
-
@cancel_preapproval_response.should be_success
|
80
|
-
end
|
81
|
-
|
82
|
-
it "Refund" do
|
83
|
-
@refund_response = @api.refund({
|
84
|
-
:currencyCode => "USD",
|
85
|
-
:payKey => "AP-5S482348KH512131U",
|
86
|
-
:receiverList => {
|
87
|
-
:receiver => [{
|
88
|
-
:amount => 1.0,
|
89
|
-
:email => "platfo_1255612361_per@gmail.com" }] } })
|
90
|
-
@refund_response.should be_success
|
91
|
-
end
|
92
|
-
|
93
|
-
it "Get Payment option" do
|
94
|
-
@get_payment_options_response = @api.get_payment_options({
|
95
|
-
:payKey => "AP-5S482348KH512131U" })
|
96
|
-
@get_payment_options_response.should be_success
|
97
|
-
end
|
98
|
-
|
99
|
-
it "Convert currency" do
|
100
|
-
# Build request object
|
101
|
-
@convert_currency = @api.build_convert_currency({
|
102
|
-
:baseAmountList => {
|
103
|
-
:currency => [{
|
104
|
-
:code => "USD",
|
105
|
-
:amount => 2.0 }] },
|
106
|
-
:convertToCurrencyList => {
|
107
|
-
:currencyCode => ["GBP"] } })
|
108
|
-
|
109
|
-
# Make API call & get response
|
110
|
-
@convert_currency_response = @api.convert_currency(@convert_currency)
|
111
|
-
@convert_currency_response.should be_success
|
112
|
-
end
|
113
|
-
|
114
|
-
it "Validate ipn message" do
|
115
|
-
@api.ipn_valid?("Invalid").should be_false
|
116
|
-
end
|
117
|
-
|
118
|
-
end
|
119
|
-
end
|
data/spec/config/cert_key.pem
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
MIICXAIBAAKBgQCx/rJhKDRYhs9WZj66FA+HidsrKwvep3g+YNbm1fXmjcg2rEmC
|
3
|
-
kq71+Ftw9rx0Uz7vmg6vcsASUgOyeNG7mVB1SsXc6j+JAzZsmpzxHI0QKm+nBNTS
|
4
|
-
OAp5NWn6NZQfu3BNAJ/Mok/iL3am2DWXV6dU74J66rBpwIJfzs9kmw8ZGwIDAQAB
|
5
|
-
AoGAa/V1sCQ4i7FItLjTNv3P5X+h5W74hhXBguQttFj2Ct7YHwEknQPnBt2aaMve
|
6
|
-
xhdvxtgELDpHcVU5VNifLU/yUg3+DSr/YkpBWOcNTCt1seW/z5s+jr2fQERQKbyf
|
7
|
-
SXWMTqwrQ19iQoCPYaj7Drf68JhksQCaYN650g7+B/QmSBECQQDp6r75fzDtEWrr
|
8
|
-
O4Sl9plK6CRLqQQ3LveAw4JV31N2UAqgAYtzRqD6K+SviAVtX9xxuv983qQxsfX4
|
9
|
-
ozE9sGXPAkEAwsxwR1s2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sf6yYSg0WIbPVmY+uhQPh4nbKysL3qd4PmDW5tX15o3INqxJgpKu9fhbcPa8
|
27
|
-
dFM+75oOr3LAElIDsnjRu5lQdUrF3Oo/iQM2bJqc8RyNECpvpwTU0jgKeTVp+jWU
|
28
|
-
H7twTQCfzKJP4i92ptg1l1enVO+CeuqwacCCX87PZJsPGRsCAwEAAaMNMAswCQYD
|
29
|
-
VR0TBAIwADANBgkqhkiG9w0BAQUFAAOBgQCgH3kwXMJtcAaCBQLKz5TGFogJp/C3
|
30
|
-
06MvjYzdbDrx9Rjf/252UhD8dMPUP5FhU1KXduL+KIEYawPbDQ9+lV58JgM12R0p
|
31
|
-
EhCODDI/lDvzbfxUnYgkJ5cnFhTZpcAqVzWuinUnG8jAL9XKiEyu/C73ePMPWPbt
|
32
|
-
otoWi+Tk828Qlw==
|
33
|
-
-----END CERTIFICATE-----
|
data/spec/config/paypal.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
test: &default
|
2
|
-
username: jb-us-seller_api1.paypal.com
|
3
|
-
password: WX4WTU3S8MY44S7F
|
4
|
-
signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
|
5
|
-
app_id: APP-80W284485P519543T
|
6
|
-
http_timeout: 30
|
7
|
-
mode: sandbox
|
8
|
-
development:
|
9
|
-
<<: *default
|
10
|
-
|
11
|
-
with_certificate:
|
12
|
-
<<: *default
|
13
|
-
username: platfo_1255170694_biz_api1.gmail.com
|
14
|
-
password: 2DPPKUPKB7DQLXNR
|
15
|
-
signature:
|
16
|
-
cert_path: "spec/config/cert_key.pem"
|
17
|
-
app_id: APP-80W284485P519543T
|
18
|
-
|
19
|
-
with_oauth_token:
|
20
|
-
<<: *default
|
21
|
-
token: H2kLxjm9lCxQdnOYxkH29I53TpZyIXez4GtHhAVGpiU3DiVTz5eNPQ
|
22
|
-
token_secret: MnZ-iPdDqGLEfQIuTIfUN4uK9lU
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "ConvertCurrency" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@client = PayPal::SDK::AdaptivePayments::API.new
|
7
|
-
end
|
8
|
-
|
9
|
-
it "with hash" do
|
10
|
-
response = @client.convert_currency({
|
11
|
-
"baseAmountList" => { "currency" => [ { "code" => "USD", "amount" => "2.0"} ]},
|
12
|
-
"convertToCurrencyList" => { "currencyCode" => ["GBP"] } })
|
13
|
-
response.response_envelope.ack.should eql "Success"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "with request object" do
|
17
|
-
convert_currency_request = @client.build_convert_currency()
|
18
|
-
convert_currency_request.baseAmountList.currency[0].code = "USD"
|
19
|
-
convert_currency_request.baseAmountList.currency[0].amount = 2.0
|
20
|
-
convert_currency_request.convertToCurrencyList.currencyCode = [ "GBP" ]
|
21
|
-
|
22
|
-
response = @client.convert_currency(convert_currency_request)
|
23
|
-
response.response_envelope.ack.should eql "Success"
|
24
|
-
end
|
25
|
-
|
26
|
-
it "with block" do
|
27
|
-
convert_currency_request = @client.build_convert_currency do
|
28
|
-
baseAmountList do
|
29
|
-
currency[0].code = "USD"
|
30
|
-
currency[0].amount = 2.0
|
31
|
-
end
|
32
|
-
convertToCurrencyList.currencyCode = [ "GBP" ]
|
33
|
-
end
|
34
|
-
|
35
|
-
response = @client.convert_currency(convert_currency_request)
|
36
|
-
response.response_envelope.ack.should eql "Success"
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|