paypal-sdk-adaptivepayments 1.96.2 → 1.96.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +1 -1
- data/README.md +18 -12
- data/Rakefile +0 -0
- data/lib/paypal-sdk-adaptivepayments.rb +0 -0
- data/lib/paypal-sdk/adaptive_payments/data_types.rb +0 -0
- data/lib/paypal-sdk/adaptive_payments/services.rb +0 -0
- data/lib/paypal-sdk/adaptive_payments/version.rb +1 -1
- data/spec/adaptive_payments_examples_spec.rb +76 -0
- data/spec/adaptive_payments_spec.rb +27 -27
- data/spec/config/cert_key.pem +0 -0
- data/spec/config/paypal.yml +22 -25
- data/spec/convert_currency_spec.rb +39 -39
- data/spec/spec_helper.rb +6 -6
- metadata +10 -18
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZmQ3YjNiMmE3YzBhMzFkMTczNmYxZGQ1MmU1YTkyY2M0MGQwMWJjZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTViZDdhMTA4OTlmMjFhOWNjNDllNmExYWYzYTRiNWJlYzEwZWM0MA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MWNhOTMyY2M2NzZmZmZlMzQzYjVjZmQ5ZTJjZTU3NjJhMDBjOGNkN2UxZDAw
|
10
|
+
MDJmMjUzN2RmZGU4NTVmZGU0NzcwZTIwNDEwODNmZjUxZDhhZTBhYzQ3OThj
|
11
|
+
OGNmYmU4ZjlkZWYxYTA1Y2ZmZjYxNjU2MjU1ZDUyODJiODAzMWE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTc3ODEyNTUxZmRkNmVjY2I4YzVmMGQzNTEzNGQ0ZGQ2MzZkZDBlYTBmN2E2
|
14
|
+
YmUyY2Y2NjAzMzlhNGUxMWIzODA1NmY0NmFhOTQ1OTQwM2E5ZTJhZDNmMWQ5
|
15
|
+
Y2UyY2VkZmYyMDFkNGFmOWFhMGVjNDZhZGViNGY0YTY5ZDc0MDU=
|
data/Gemfile
CHANGED
@@ -4,7 +4,7 @@ gemspec
|
|
4
4
|
|
5
5
|
gem 'paypal-sdk-core', :git => "https://github.com/paypal/sdk-core-ruby.git"
|
6
6
|
|
7
|
-
if
|
7
|
+
if File.exist? File.expand_path('../samples/adaptive_payments_samples.gemspec', __FILE__)
|
8
8
|
gem 'adaptive_payments_samples', :path => 'samples', :require => false
|
9
9
|
group :test do
|
10
10
|
gem 'rspec-rails', :require => false
|
data/README.md
CHANGED
@@ -123,22 +123,28 @@ To get response status:
|
|
123
123
|
|
124
124
|
```ruby
|
125
125
|
require 'paypal-sdk-adaptivepayments'
|
126
|
-
@api = PayPal::SDK::AdaptivePayments::API.new
|
126
|
+
@api = PayPal::SDK::AdaptivePayments::API.new(
|
127
|
+
:mode => "sandbox", # Set "live" for production
|
128
|
+
:app_id => "APP-80W284485P519543T",
|
129
|
+
:username => "jb-us-seller_api1.paypal.com",
|
130
|
+
:password => "WX4WTU3S8MY44S7F",
|
131
|
+
:signature => "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy" )
|
127
132
|
|
128
133
|
# Build request object
|
129
|
-
@
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
134
|
+
@pay = @api.build_pay({
|
135
|
+
:actionType => "PAY",
|
136
|
+
:cancelUrl => "http://localhost:3000/samples/adaptive_payments/pay",
|
137
|
+
:currencyCode => "USD",
|
138
|
+
:feesPayer => "SENDER",
|
139
|
+
:ipnNotificationUrl => "http://localhost:3000/samples/adaptive_payments/ipn_notify",
|
140
|
+
:receiverList => {
|
141
|
+
:receiver => [{
|
142
|
+
:amount => 1.0,
|
143
|
+
:email => "platfo_1255612361_per@gmail.com" }] },
|
144
|
+
:returnUrl => "http://localhost:3000/samples/adaptive_payments/pay" })
|
139
145
|
|
140
146
|
# Make API call & get response
|
141
|
-
@pay_response = @api.pay(@
|
147
|
+
@pay_response = @api.pay(@pay)
|
142
148
|
|
143
149
|
# Access response
|
144
150
|
@pay_response.responseEnvelope.ack
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,76 @@
|
|
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_request = @api.build_pay()
|
14
|
+
@pay_request.actionType = "PAY"
|
15
|
+
@pay_request.cancelUrl = "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/pay"
|
16
|
+
@pay_request.currencyCode = "USD"
|
17
|
+
@pay_request.feesPayer = "SENDER"
|
18
|
+
@pay_request.ipnNotificationUrl = "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/ipn_notify"
|
19
|
+
@pay_request.receiverList.receiver[0].amount = 1.0
|
20
|
+
@pay_request.receiverList.receiver[0].email = "platfo_1255612361_per@gmail.com"
|
21
|
+
@pay_request.returnUrl = "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/pay"
|
22
|
+
|
23
|
+
# Make API call & get response
|
24
|
+
@pay_response = @api.pay(@pay_request)
|
25
|
+
@pay_response.responseEnvelope.ack.should eql "Success"
|
26
|
+
|
27
|
+
@payment_details_request = @api.build_payment_details()
|
28
|
+
@payment_details_request.payKey = @pay_response.payKey
|
29
|
+
@payment_details_response = @api.payment_details(@payment_details_request)
|
30
|
+
@payment_details_response.responseEnvelope.ack.should eql "Success"
|
31
|
+
|
32
|
+
# Make API call & get response
|
33
|
+
@pay_response = @api_with_cert.pay(@pay_request)
|
34
|
+
@pay_response.responseEnvelope.ack.should eql "Success"
|
35
|
+
|
36
|
+
@payment_details_request = @api_with_cert.build_payment_details()
|
37
|
+
@payment_details_request.payKey = @pay_response.payKey
|
38
|
+
@payment_details_response = @api_with_cert.payment_details(@payment_details_request)
|
39
|
+
@payment_details_response.responseEnvelope.ack.should eql "Success"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "Preapproval" do
|
43
|
+
# Build request object
|
44
|
+
@preapproval_request = @api.build_preapproval()
|
45
|
+
@preapproval_request.cancelUrl = "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/preapproval"
|
46
|
+
@preapproval_request.currencyCode = "USD"
|
47
|
+
@preapproval_request.returnUrl = "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/preapproval"
|
48
|
+
@preapproval_request.ipnNotificationUrl = "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/ipn_notify"
|
49
|
+
@preapproval_request.startingDate = "2015-10-10T00:00:00+00:00"
|
50
|
+
|
51
|
+
# Make API call & get response
|
52
|
+
@preapproval_response = @api.preapproval(@preapproval_request)
|
53
|
+
@preapproval_response.responseEnvelope.ack.should eql "Success"
|
54
|
+
|
55
|
+
@preapproval_details_request = @api.build_preapproval_details()
|
56
|
+
@preapproval_details_request.preapprovalKey = @preapproval_response.preapprovalKey
|
57
|
+
@preapproval_details_response = @api.preapproval_details(@preapproval_details_request)
|
58
|
+
@preapproval_details_response.responseEnvelope.ack.should eql "Success"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "Convert currency" do
|
62
|
+
# Build request object
|
63
|
+
@convert_currency_request = @api.build_convert_currency()
|
64
|
+
@convert_currency_request.baseAmountList.currency[0].code = "USD"
|
65
|
+
@convert_currency_request.baseAmountList.currency[0].amount = 2.0
|
66
|
+
@convert_currency_request.convertToCurrencyList.currencyCode = ["GBP"]
|
67
|
+
|
68
|
+
# Make API call & get response
|
69
|
+
@convert_currency_response = @api.convert_currency(@convert_currency_request)
|
70
|
+
@convert_currency_response.responseEnvelope.ack.should eql "Success"
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "AdaptivePayments" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@client = PayPal::SDK::AdaptivePayments::API.new
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "Services" do
|
10
|
-
PayPal::SDK::AdaptivePayments::Services.instance_methods.select{|s| s =~ /^[A-Z]/ and s !~ /^Build/ }.each do |service_method|
|
11
|
-
it "make empty request to #{service_method}" do
|
12
|
-
response = @client.send(service_method, {})
|
13
|
-
response.response_envelope.ack.should_not be_nil
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "DataTypes" do
|
19
|
-
PayPal::SDK::AdaptivePayments::DataTypes.constants.each do |const_name|
|
20
|
-
it "create object for #{const_name}" do
|
21
|
-
klass = PayPal::SDK::AdaptivePayments::DataTypes.const_get(const_name)
|
22
|
-
klass.new.should be_a klass
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "AdaptivePayments" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@client = PayPal::SDK::AdaptivePayments::API.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "Services" do
|
10
|
+
PayPal::SDK::AdaptivePayments::Services.instance_methods.select{|s| s =~ /^[A-Z]/ and s !~ /^Build/ }.each do |service_method|
|
11
|
+
it "make empty request to #{service_method}" do
|
12
|
+
response = @client.send(service_method, {})
|
13
|
+
response.response_envelope.ack.should_not be_nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "DataTypes" do
|
19
|
+
PayPal::SDK::AdaptivePayments::DataTypes.constants.each do |const_name|
|
20
|
+
it "create object for #{const_name}" do
|
21
|
+
klass = PayPal::SDK::AdaptivePayments::DataTypes.const_get(const_name)
|
22
|
+
klass.new.should be_a klass
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/spec/config/cert_key.pem
CHANGED
File without changes
|
data/spec/config/paypal.yml
CHANGED
@@ -1,25 +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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
<<: *default
|
24
|
-
token: H2kLxjm9lCxQdnOYxkH29I53TpZyIXez4GtHhAVGpiU3DiVTz5eNPQ
|
25
|
-
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
|
@@ -1,39 +1,39 @@
|
|
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
|
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
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
|
3
|
-
Bundler.require :default, :test
|
4
|
-
PayPal::SDK::Core::Config.load('spec/config/paypal.yml', 'test')
|
5
|
-
|
6
|
-
require 'paypal-sdk-adaptivepayments'
|
1
|
+
require 'bundler/setup'
|
2
|
+
|
3
|
+
Bundler.require :default, :test
|
4
|
+
PayPal::SDK::Core::Config.load('spec/config/paypal.yml', 'test')
|
5
|
+
|
6
|
+
require 'paypal-sdk-adaptivepayments'
|
metadata
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-sdk-adaptivepayments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.96.
|
5
|
-
prerelease:
|
4
|
+
version: 1.96.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- PayPal
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: paypal-sdk-core
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
19
|
+
version: 0.2.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
26
|
+
version: 0.2.0
|
30
27
|
description: The PayPal Adaptive Payments SDK provides Ruby APIs to create, process
|
31
28
|
and manage simple and complex (parallel and chained) payments, and pre-approvals
|
32
29
|
using the Adaptive Payments API.
|
@@ -36,6 +33,7 @@ executables: []
|
|
36
33
|
extensions: []
|
37
34
|
extra_rdoc_files: []
|
38
35
|
files:
|
36
|
+
- spec/adaptive_payments_examples_spec.rb
|
39
37
|
- spec/spec_helper.rb
|
40
38
|
- spec/convert_currency_spec.rb
|
41
39
|
- spec/config/paypal.yml
|
@@ -50,37 +48,31 @@ files:
|
|
50
48
|
- Rakefile
|
51
49
|
- README.md
|
52
50
|
- Gemfile
|
53
|
-
homepage: https://
|
51
|
+
homepage: https://developer.paypal.com
|
54
52
|
licenses: []
|
53
|
+
metadata: {}
|
55
54
|
post_install_message:
|
56
55
|
rdoc_options: []
|
57
56
|
require_paths:
|
58
57
|
- lib
|
59
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
59
|
requirements:
|
62
60
|
- - ! '>='
|
63
61
|
- !ruby/object:Gem::Version
|
64
62
|
version: '0'
|
65
|
-
segments:
|
66
|
-
- 0
|
67
|
-
hash: 734193505
|
68
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
64
|
requirements:
|
71
65
|
- - ! '>='
|
72
66
|
- !ruby/object:Gem::Version
|
73
67
|
version: '0'
|
74
|
-
segments:
|
75
|
-
- 0
|
76
|
-
hash: 734193505
|
77
68
|
requirements: []
|
78
69
|
rubyforge_project:
|
79
|
-
rubygems_version:
|
70
|
+
rubygems_version: 2.0.0
|
80
71
|
signing_key:
|
81
|
-
specification_version:
|
72
|
+
specification_version: 4
|
82
73
|
summary: PayPal Adaptive Payments SDK
|
83
74
|
test_files:
|
75
|
+
- spec/adaptive_payments_examples_spec.rb
|
84
76
|
- spec/spec_helper.rb
|
85
77
|
- spec/convert_currency_spec.rb
|
86
78
|
- spec/config/paypal.yml
|