paypal-sdk-adaptivepayments 1.103.0 → 1.105.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +19 -17
- data/README.md +141 -141
- data/lib/paypal-sdk/adaptive_payments.rb +17 -17
- data/lib/paypal-sdk/adaptive_payments/api.rb +27 -27
- data/lib/paypal-sdk/adaptive_payments/data_types.rb +1214 -1168
- data/lib/paypal-sdk/adaptive_payments/services.rb +343 -343
- data/lib/paypal-sdk/adaptive_payments/urls.rb +26 -26
- data/lib/paypal-sdk/adaptive_payments/version.rb +7 -7
- data/spec/adaptive_payments_examples_spec.rb +119 -119
- data/spec/config/paypal.yml +22 -22
- metadata +11 -7
- checksums.yaml +0 -7
@@ -1,26 +1,26 @@
|
|
1
|
-
module PayPal
|
2
|
-
module SDK
|
3
|
-
module AdaptivePayments
|
4
|
-
module Urls
|
5
|
-
REDIRECT_ENDPOINTS = {
|
6
|
-
:live => "https://www.paypal.com/webscr",
|
7
|
-
:sandbox => "https://www.sandbox.paypal.com/webscr" }
|
8
|
-
|
9
|
-
def redirect_url(params = {})
|
10
|
-
"#{REDIRECT_ENDPOINTS[api_mode]}?#{encode_www_form(params)}"
|
11
|
-
end
|
12
|
-
|
13
|
-
def payment_url(key)
|
14
|
-
key = key.payKey if key.respond_to?(:payKey)
|
15
|
-
redirect_url(:cmd => "_ap-payment", :paykey => key.to_s)
|
16
|
-
end
|
17
|
-
alias_method :pay_url, :payment_url
|
18
|
-
|
19
|
-
def preapproval_url(key)
|
20
|
-
key = key.preapprovalKey if key.respond_to?(:preapprovalKey)
|
21
|
-
redirect_url(:cmd => "_ap-preapproval", :preapprovalkey => key.to_s)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
1
|
+
module PayPal
|
2
|
+
module SDK
|
3
|
+
module AdaptivePayments
|
4
|
+
module Urls
|
5
|
+
REDIRECT_ENDPOINTS = {
|
6
|
+
:live => "https://www.paypal.com/webscr",
|
7
|
+
:sandbox => "https://www.sandbox.paypal.com/webscr" }
|
8
|
+
|
9
|
+
def redirect_url(params = {})
|
10
|
+
"#{REDIRECT_ENDPOINTS[api_mode]}?#{encode_www_form(params)}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def payment_url(key)
|
14
|
+
key = key.payKey if key.respond_to?(:payKey)
|
15
|
+
redirect_url(:cmd => "_ap-payment", :paykey => key.to_s)
|
16
|
+
end
|
17
|
+
alias_method :pay_url, :payment_url
|
18
|
+
|
19
|
+
def preapproval_url(key)
|
20
|
+
key = key.preapprovalKey if key.respond_to?(:preapprovalKey)
|
21
|
+
redirect_url(:cmd => "_ap-preapproval", :preapprovalkey => key.to_s)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module PayPal
|
2
|
-
module SDK
|
3
|
-
module AdaptivePayments
|
4
|
-
VERSION = "1.
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
1
|
+
module PayPal
|
2
|
+
module SDK
|
3
|
+
module AdaptivePayments
|
4
|
+
VERSION = "1.105.0"
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
@@ -1,119 +1,119 @@
|
|
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
|
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/paypal.yml
CHANGED
@@ -1,22 +1,22 @@
|
|
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
|
+
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
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-sdk-adaptivepayments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.105.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- PayPal
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: paypal-sdk-core
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -50,26 +53,27 @@ files:
|
|
50
53
|
- Gemfile
|
51
54
|
homepage: https://developer.paypal.com
|
52
55
|
licenses: []
|
53
|
-
metadata: {}
|
54
56
|
post_install_message:
|
55
57
|
rdoc_options: []
|
56
58
|
require_paths:
|
57
59
|
- lib
|
58
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
59
62
|
requirements:
|
60
|
-
- - '>='
|
63
|
+
- - ! '>='
|
61
64
|
- !ruby/object:Gem::Version
|
62
65
|
version: '0'
|
63
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
64
68
|
requirements:
|
65
|
-
- - '>='
|
69
|
+
- - ! '>='
|
66
70
|
- !ruby/object:Gem::Version
|
67
71
|
version: '0'
|
68
72
|
requirements: []
|
69
73
|
rubyforge_project:
|
70
|
-
rubygems_version:
|
74
|
+
rubygems_version: 1.8.24
|
71
75
|
signing_key:
|
72
|
-
specification_version:
|
76
|
+
specification_version: 3
|
73
77
|
summary: PayPal Adaptive Payments SDK
|
74
78
|
test_files:
|
75
79
|
- spec/adaptive_payments_examples_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 298528d0634dd6f8f3c4d1f55900e1bf09ca1179
|
4
|
-
data.tar.gz: cdba3e235373199c5fa1f249022061f42b0420ae
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 25c942f96c7d06a6ef30b0eb007d308ee71bc05c9aba7d98563a83847b5b75da07600ff7c4a96181cb5661a34c3390d157d8345f480ee7b5353f54c49d271949
|
7
|
-
data.tar.gz: 0441d98494667f3b8d1a41c16c576e6acdeaabf1c443a0cc7a6d4ed7cb943437492f3af844a9b94863743a0a28faa18897c0be7e6d954a01246dfd34e0b4dbdf
|