paypal-sdk-merchant 1.103.0 → 1.106.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 +126 -126
- data/lib/paypal-sdk/merchant.rb +18 -18
- data/lib/paypal-sdk/merchant/api.rb +27 -27
- data/lib/paypal-sdk/merchant/data_types.rb +5184 -5066
- data/lib/paypal-sdk/merchant/services.rb +1070 -1049
- data/lib/paypal-sdk/merchant/urls.rb +20 -20
- data/lib/paypal-sdk/merchant/version.rb +7 -7
- data/spec/config/paypal.yml +23 -23
- data/spec/merchant_samples_spec.rb +123 -123
- data/spec/merchant_spec.rb +20 -20
- metadata +11 -7
- checksums.yaml +0 -7
@@ -1,20 +1,20 @@
|
|
1
|
-
module PayPal
|
2
|
-
module SDK
|
3
|
-
module Merchant
|
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 express_checkout_url(token)
|
14
|
-
token = token.Token if token.respond_to?(:Token)
|
15
|
-
redirect_url( :cmd => "_express-checkout", :token => token.to_s )
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
1
|
+
module PayPal
|
2
|
+
module SDK
|
3
|
+
module Merchant
|
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 express_checkout_url(token)
|
14
|
+
token = token.Token if token.respond_to?(:Token)
|
15
|
+
redirect_url( :cmd => "_express-checkout", :token => token.to_s )
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module PayPal
|
2
|
-
module SDK
|
3
|
-
module Merchant
|
4
|
-
VERSION = "1.
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
1
|
+
module PayPal
|
2
|
+
module SDK
|
3
|
+
module Merchant
|
4
|
+
VERSION = "1.106.0"
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
data/spec/config/paypal.yml
CHANGED
@@ -1,23 +1,23 @@
|
|
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
|
-
development:
|
10
|
-
<<: *default
|
11
|
-
|
12
|
-
with_certificate:
|
13
|
-
<<: *default
|
14
|
-
username: platfo_1255170694_biz_api1.gmail.com
|
15
|
-
password: 2DPPKUPKB7DQLXNR
|
16
|
-
signature:
|
17
|
-
cert_path: "spec/config/cert_key.pem"
|
18
|
-
app_id: APP-80W284485P519543T
|
19
|
-
|
20
|
-
with_oauth_token:
|
21
|
-
<<: *default
|
22
|
-
token: H2kLxjm9lCxQdnOYxkH29I53TpZyIXez4GtHhAVGpiU3DiVTz5eNPQ
|
23
|
-
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
|
+
|
9
|
+
development:
|
10
|
+
<<: *default
|
11
|
+
|
12
|
+
with_certificate:
|
13
|
+
<<: *default
|
14
|
+
username: platfo_1255170694_biz_api1.gmail.com
|
15
|
+
password: 2DPPKUPKB7DQLXNR
|
16
|
+
signature:
|
17
|
+
cert_path: "spec/config/cert_key.pem"
|
18
|
+
app_id: APP-80W284485P519543T
|
19
|
+
|
20
|
+
with_oauth_token:
|
21
|
+
<<: *default
|
22
|
+
token: H2kLxjm9lCxQdnOYxkH29I53TpZyIXez4GtHhAVGpiU3DiVTz5eNPQ
|
23
|
+
token_secret: MnZ-iPdDqGLEfQIuTIfUN4uK9lU
|
@@ -1,123 +1,123 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Merchant" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@api = PayPal::SDK::Merchant::API.new
|
7
|
-
@api_with_cert = PayPal::SDK::Merchant::API.new(:with_certificate)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "Examples" do
|
11
|
-
it "transaction search" do
|
12
|
-
# Build request object
|
13
|
-
@transaction_search = @api.build_transaction_search({
|
14
|
-
:StartDate => "2012-11-01T00:00:00+00:00",
|
15
|
-
:EndDate => "2012-11-01T01:00:00+00:00" })
|
16
|
-
|
17
|
-
# Make API call & get response
|
18
|
-
@transaction_search_response = @api.transaction_search(@transaction_search)
|
19
|
-
@transaction_search_response.should be_success
|
20
|
-
@transaction_search_response.should_not be_failure
|
21
|
-
|
22
|
-
@transaction_search_response = @api.transaction_search({})
|
23
|
-
@transaction_search_response.should be_failure
|
24
|
-
@transaction_search_response.should_not be_success
|
25
|
-
|
26
|
-
@transaction_search_response = @api_with_cert.transaction_search(@transaction_search)
|
27
|
-
@transaction_search_response.should be_success
|
28
|
-
@transaction_search_response.should_not be_failure
|
29
|
-
|
30
|
-
@transaction_search_response = @api_with_cert.transaction_search({})
|
31
|
-
@transaction_search_response.should be_failure
|
32
|
-
@transaction_search_response.should_not be_success
|
33
|
-
end
|
34
|
-
|
35
|
-
it "get balance" do
|
36
|
-
# Build request object
|
37
|
-
@get_balance = @api.build_get_balance({
|
38
|
-
:ReturnAllCurrencies => "0" })
|
39
|
-
|
40
|
-
# Make API call & get response
|
41
|
-
@get_balance_response = @api.get_balance(@get_balance)
|
42
|
-
|
43
|
-
@get_balance_response.should be_success
|
44
|
-
end
|
45
|
-
|
46
|
-
it "get pal detail" do
|
47
|
-
# Build request object
|
48
|
-
@get_pal_details = @api.build_get_pal_details({})
|
49
|
-
|
50
|
-
# Make API call & get response
|
51
|
-
@get_pal_details_response = @api.get_pal_details(@get_pal_details)
|
52
|
-
|
53
|
-
@get_pal_details_response.should be_success
|
54
|
-
end
|
55
|
-
|
56
|
-
it "Set auth flow param" do
|
57
|
-
@set_auth_flow_param = @api.build_set_auth_flow_param({
|
58
|
-
:SetAuthFlowParamRequestDetails => {
|
59
|
-
:ReturnURL => "http://www.example.com/",
|
60
|
-
:CancelURL => "http://www.example.com/",
|
61
|
-
:LogoutURL => "http://www.example.com/" } })
|
62
|
-
|
63
|
-
# Make API call & get response
|
64
|
-
@set_auth_flow_param_response = @api.set_auth_flow_param(@set_auth_flow_param)
|
65
|
-
|
66
|
-
@set_auth_flow_param_response.should be_success
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
it "Do direct payment" do
|
71
|
-
# Build request object
|
72
|
-
@do_direct_payment = @api.build_do_direct_payment({
|
73
|
-
:DoDirectPaymentRequestDetails => {
|
74
|
-
:PaymentAction => "Sale",
|
75
|
-
:PaymentDetails => {
|
76
|
-
:OrderTotal => {
|
77
|
-
:currencyID => "USD",
|
78
|
-
:value => "1" },
|
79
|
-
:NotifyURL => "https://paypal-sdk-samples.herokuapp.com/merchant/ipn_notify",
|
80
|
-
:ShipToAddress => {
|
81
|
-
:Name => "John Doe",
|
82
|
-
:Street1 => "1 Main St",
|
83
|
-
:CityName => "San Jose",
|
84
|
-
:StateOrProvince => "CA",
|
85
|
-
:Country => "US",
|
86
|
-
:PostalCode => "95131" } },
|
87
|
-
:CreditCard => {
|
88
|
-
:CreditCardType => "Visa",
|
89
|
-
:CreditCardNumber => "4904202183894535",
|
90
|
-
:ExpMonth => 12,
|
91
|
-
:ExpYear => 2022,
|
92
|
-
:CVV2 => "962" } } })
|
93
|
-
|
94
|
-
# Make API call & get response
|
95
|
-
@do_direct_payment_response = @api.do_direct_payment(@do_direct_payment)
|
96
|
-
@do_direct_payment_response.should be_success
|
97
|
-
|
98
|
-
# Make API call & get response
|
99
|
-
@do_direct_payment_response = @api_with_cert.do_direct_payment(@do_direct_payment)
|
100
|
-
@do_direct_payment_response.should be_success
|
101
|
-
end
|
102
|
-
|
103
|
-
it "Mass pay" do
|
104
|
-
# Build request object
|
105
|
-
@mass_pay = @api.build_mass_pay({
|
106
|
-
:ReceiverType => "EmailAddress",
|
107
|
-
:MassPayItem => [{
|
108
|
-
:ReceiverEmail => "enduser_biz@gmail.com",
|
109
|
-
:Amount => {
|
110
|
-
:currencyID => "USD",
|
111
|
-
:value => "3.00" } }] })
|
112
|
-
|
113
|
-
# Make API call & get response
|
114
|
-
@mass_pay_response = @api.mass_pay(@mass_pay)
|
115
|
-
@mass_pay_response.should be_success
|
116
|
-
end
|
117
|
-
|
118
|
-
it "Validate ipn message" do
|
119
|
-
@api.ipn_valid?("Invalid").should be_false
|
120
|
-
end
|
121
|
-
|
122
|
-
end
|
123
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Merchant" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@api = PayPal::SDK::Merchant::API.new
|
7
|
+
@api_with_cert = PayPal::SDK::Merchant::API.new(:with_certificate)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "Examples" do
|
11
|
+
it "transaction search" do
|
12
|
+
# Build request object
|
13
|
+
@transaction_search = @api.build_transaction_search({
|
14
|
+
:StartDate => "2012-11-01T00:00:00+00:00",
|
15
|
+
:EndDate => "2012-11-01T01:00:00+00:00" })
|
16
|
+
|
17
|
+
# Make API call & get response
|
18
|
+
@transaction_search_response = @api.transaction_search(@transaction_search)
|
19
|
+
@transaction_search_response.should be_success
|
20
|
+
@transaction_search_response.should_not be_failure
|
21
|
+
|
22
|
+
@transaction_search_response = @api.transaction_search({})
|
23
|
+
@transaction_search_response.should be_failure
|
24
|
+
@transaction_search_response.should_not be_success
|
25
|
+
|
26
|
+
@transaction_search_response = @api_with_cert.transaction_search(@transaction_search)
|
27
|
+
@transaction_search_response.should be_success
|
28
|
+
@transaction_search_response.should_not be_failure
|
29
|
+
|
30
|
+
@transaction_search_response = @api_with_cert.transaction_search({})
|
31
|
+
@transaction_search_response.should be_failure
|
32
|
+
@transaction_search_response.should_not be_success
|
33
|
+
end
|
34
|
+
|
35
|
+
it "get balance" do
|
36
|
+
# Build request object
|
37
|
+
@get_balance = @api.build_get_balance({
|
38
|
+
:ReturnAllCurrencies => "0" })
|
39
|
+
|
40
|
+
# Make API call & get response
|
41
|
+
@get_balance_response = @api.get_balance(@get_balance)
|
42
|
+
|
43
|
+
@get_balance_response.should be_success
|
44
|
+
end
|
45
|
+
|
46
|
+
it "get pal detail" do
|
47
|
+
# Build request object
|
48
|
+
@get_pal_details = @api.build_get_pal_details({})
|
49
|
+
|
50
|
+
# Make API call & get response
|
51
|
+
@get_pal_details_response = @api.get_pal_details(@get_pal_details)
|
52
|
+
|
53
|
+
@get_pal_details_response.should be_success
|
54
|
+
end
|
55
|
+
|
56
|
+
it "Set auth flow param" do
|
57
|
+
@set_auth_flow_param = @api.build_set_auth_flow_param({
|
58
|
+
:SetAuthFlowParamRequestDetails => {
|
59
|
+
:ReturnURL => "http://www.example.com/",
|
60
|
+
:CancelURL => "http://www.example.com/",
|
61
|
+
:LogoutURL => "http://www.example.com/" } })
|
62
|
+
|
63
|
+
# Make API call & get response
|
64
|
+
@set_auth_flow_param_response = @api.set_auth_flow_param(@set_auth_flow_param)
|
65
|
+
|
66
|
+
@set_auth_flow_param_response.should be_success
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
it "Do direct payment" do
|
71
|
+
# Build request object
|
72
|
+
@do_direct_payment = @api.build_do_direct_payment({
|
73
|
+
:DoDirectPaymentRequestDetails => {
|
74
|
+
:PaymentAction => "Sale",
|
75
|
+
:PaymentDetails => {
|
76
|
+
:OrderTotal => {
|
77
|
+
:currencyID => "USD",
|
78
|
+
:value => "1" },
|
79
|
+
:NotifyURL => "https://paypal-sdk-samples.herokuapp.com/merchant/ipn_notify",
|
80
|
+
:ShipToAddress => {
|
81
|
+
:Name => "John Doe",
|
82
|
+
:Street1 => "1 Main St",
|
83
|
+
:CityName => "San Jose",
|
84
|
+
:StateOrProvince => "CA",
|
85
|
+
:Country => "US",
|
86
|
+
:PostalCode => "95131" } },
|
87
|
+
:CreditCard => {
|
88
|
+
:CreditCardType => "Visa",
|
89
|
+
:CreditCardNumber => "4904202183894535",
|
90
|
+
:ExpMonth => 12,
|
91
|
+
:ExpYear => 2022,
|
92
|
+
:CVV2 => "962" } } })
|
93
|
+
|
94
|
+
# Make API call & get response
|
95
|
+
@do_direct_payment_response = @api.do_direct_payment(@do_direct_payment)
|
96
|
+
@do_direct_payment_response.should be_success
|
97
|
+
|
98
|
+
# Make API call & get response
|
99
|
+
@do_direct_payment_response = @api_with_cert.do_direct_payment(@do_direct_payment)
|
100
|
+
@do_direct_payment_response.should be_success
|
101
|
+
end
|
102
|
+
|
103
|
+
it "Mass pay" do
|
104
|
+
# Build request object
|
105
|
+
@mass_pay = @api.build_mass_pay({
|
106
|
+
:ReceiverType => "EmailAddress",
|
107
|
+
:MassPayItem => [{
|
108
|
+
:ReceiverEmail => "enduser_biz@gmail.com",
|
109
|
+
:Amount => {
|
110
|
+
:currencyID => "USD",
|
111
|
+
:value => "3.00" } }] })
|
112
|
+
|
113
|
+
# Make API call & get response
|
114
|
+
@mass_pay_response = @api.mass_pay(@mass_pay)
|
115
|
+
@mass_pay_response.should be_success
|
116
|
+
end
|
117
|
+
|
118
|
+
it "Validate ipn message" do
|
119
|
+
@api.ipn_valid?("Invalid").should be_false
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
end
|
data/spec/merchant_spec.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Merchant" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@client = PayPal::SDK::Merchant::API.new
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "Services" do
|
10
|
-
actions = PayPal::SDK::Merchant::Services.instance_methods.select{|s| s =~ /^[A-Z]/ and s !~ /^Build/ } -
|
11
|
-
[ :GetIncentiveEvaluation, "GetIncentiveEvaluation" ]
|
12
|
-
actions.each do |service_method|
|
13
|
-
it "make empty request to #{service_method}" do
|
14
|
-
response = @client.send(service_method, {})
|
15
|
-
response.ack.should_not be_nil
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Merchant" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@client = PayPal::SDK::Merchant::API.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "Services" do
|
10
|
+
actions = PayPal::SDK::Merchant::Services.instance_methods.select{|s| s =~ /^[A-Z]/ and s !~ /^Build/ } -
|
11
|
+
[ :GetIncentiveEvaluation, "GetIncentiveEvaluation" ]
|
12
|
+
actions.each do |service_method|
|
13
|
+
it "make empty request to #{service_method}" do
|
14
|
+
response = @client.send(service_method, {})
|
15
|
+
response.ack.should_not be_nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-sdk-merchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.106.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-26 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
|
@@ -51,26 +54,27 @@ files:
|
|
51
54
|
- Gemfile
|
52
55
|
homepage: https://developer.paypal.com
|
53
56
|
licenses: []
|
54
|
-
metadata: {}
|
55
57
|
post_install_message:
|
56
58
|
rdoc_options: []
|
57
59
|
require_paths:
|
58
60
|
- lib
|
59
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
60
63
|
requirements:
|
61
|
-
- - '>='
|
64
|
+
- - ! '>='
|
62
65
|
- !ruby/object:Gem::Version
|
63
66
|
version: '0'
|
64
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
65
69
|
requirements:
|
66
|
-
- - '>='
|
70
|
+
- - ! '>='
|
67
71
|
- !ruby/object:Gem::Version
|
68
72
|
version: '0'
|
69
73
|
requirements: []
|
70
74
|
rubyforge_project:
|
71
|
-
rubygems_version:
|
75
|
+
rubygems_version: 1.8.24
|
72
76
|
signing_key:
|
73
|
-
specification_version:
|
77
|
+
specification_version: 3
|
74
78
|
summary: PayPal Merchant SDK
|
75
79
|
test_files:
|
76
80
|
- spec/config/cert_key.pem
|