paypal-sdk-merchant 1.106.0 → 1.106.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +19 -19
- 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 -5184
- data/lib/paypal-sdk/merchant/services.rb +1070 -1070
- data/lib/paypal-sdk/merchant/urls.rb +21 -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 +9 -12
@@ -1,20 +1,21 @@
|
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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, extra_params={})
|
14
|
+
token = token.Token if token.respond_to?(:Token)
|
15
|
+
params = {:cmd => "_express-checkout", :token => token.to_s}
|
16
|
+
redirect_url(params.merge!(extra_params))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module PayPal
|
2
|
-
module SDK
|
3
|
-
module Merchant
|
4
|
-
VERSION = "1.106.
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
1
|
+
module PayPal
|
2
|
+
module SDK
|
3
|
+
module Merchant
|
4
|
+
VERSION = "1.106.1"
|
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,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-sdk-merchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.106.
|
5
|
-
prerelease:
|
4
|
+
version: 1.106.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- PayPal
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-23 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
|
@@ -22,7 +20,6 @@ dependencies:
|
|
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
|
@@ -53,28 +50,28 @@ files:
|
|
53
50
|
- README.md
|
54
51
|
- Gemfile
|
55
52
|
homepage: https://developer.paypal.com
|
56
|
-
licenses:
|
53
|
+
licenses:
|
54
|
+
- PayPal SDK License
|
55
|
+
metadata: {}
|
57
56
|
post_install_message:
|
58
57
|
rdoc_options: []
|
59
58
|
require_paths:
|
60
59
|
- lib
|
61
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
63
61
|
requirements:
|
64
|
-
- -
|
62
|
+
- - '>='
|
65
63
|
- !ruby/object:Gem::Version
|
66
64
|
version: '0'
|
67
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
66
|
requirements:
|
70
|
-
- -
|
67
|
+
- - '>='
|
71
68
|
- !ruby/object:Gem::Version
|
72
69
|
version: '0'
|
73
70
|
requirements: []
|
74
71
|
rubyforge_project:
|
75
|
-
rubygems_version:
|
72
|
+
rubygems_version: 2.0.4
|
76
73
|
signing_key:
|
77
|
-
specification_version:
|
74
|
+
specification_version: 4
|
78
75
|
summary: PayPal Merchant SDK
|
79
76
|
test_files:
|
80
77
|
- spec/config/cert_key.pem
|