paypal-sdk-buttonmanager 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 +11 -19
- data/README.md +98 -120
- data/Rakefile +1 -6
- data/lib/paypal-sdk/button_manager/api.rb +26 -26
- data/lib/paypal-sdk/button_manager/data_types.rb +5184 -5184
- data/lib/paypal-sdk/button_manager/services.rb +167 -167
- data/lib/paypal-sdk/button_manager/version.rb +7 -7
- data/spec/button_manager_spec.rb +22 -22
- data/spec/config/paypal.yml +24 -24
- metadata +26 -30
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 02a1c802d78a6ef6b36c62a1029e27c9323e8a5cb03ce3e5bb58db35272a9ef1
|
4
|
+
data.tar.gz: c6a6d8f32caa6cead401cc6fe6a87bbd51034d22d5ec0c2773d8aaa31f2e4d56
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e45fecc871cf6e8816a1a919026dae84e50326f8614c54c81e04bc75a74bc000b13b52903d0b208c9e485c7ce8c9264a24e3054fb95a041690058a32f0978969
|
7
|
+
data.tar.gz: 37eeb97f2f65c82b14cea0b8666cc1a1a5c39f14b8921e3efc0ba7b5f4cb05a6f7528d957f081baa85c2d6458fdd708e9a1e91a6ad43b3566985b40586d9e662
|
data/Gemfile
CHANGED
@@ -1,19 +1,11 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
gem 'paypal-sdk-core', :git => "https://github.com/paypal/sdk-core-ruby.git"
|
6
|
-
|
7
|
-
|
8
|
-
gem '
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
group :test do
|
16
|
-
gem 'rspec'
|
17
|
-
end
|
18
|
-
|
19
|
-
gem 'nokogiri', '~> 1.5.9', :platform => :mri_18
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'paypal-sdk-core', :git => "https://github.com/paypal/sdk-core-ruby.git"
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem 'rspec'
|
9
|
+
end
|
10
|
+
|
11
|
+
gem 'nokogiri', '~> 1.8.1', :platform => :mri_18
|
data/README.md
CHANGED
@@ -1,120 +1,98 @@
|
|
1
|
-
# Button Manager SDK
|
2
|
-
|
3
|
-
The PayPal Button Manager SDK provides Ruby APIs to create, and manage PayPal Payments Standard buttons programmatically.
|
4
|
-
|
5
|
-
##
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
```
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
```
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
```
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
```
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
```
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
:
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
:
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
@bm_create_button_response.
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
Add following line in rails `Gemfile`:
|
101
|
-
|
102
|
-
```ruby
|
103
|
-
gem 'paypal-sdk-buttonmanager'
|
104
|
-
gem 'button_manager_samples', :git => "https://github.com/paypal/buttonmanager-sdk-ruby.git", :group => :development
|
105
|
-
```
|
106
|
-
|
107
|
-
Configure routes(`config/routes.rb`):
|
108
|
-
|
109
|
-
```ruby
|
110
|
-
mount ButtonManagerSamples::Engine => "/samples" if Rails.env.development?
|
111
|
-
```
|
112
|
-
|
113
|
-
To get default paypal configuration execute:
|
114
|
-
|
115
|
-
```sh
|
116
|
-
rails g paypal:sdk:install
|
117
|
-
```
|
118
|
-
|
119
|
-
Run `rails server` and check the samples.
|
120
|
-
|
1
|
+
# Button Manager SDK
|
2
|
+
|
3
|
+
The PayPal Button Manager SDK provides Ruby APIs to create, and manage PayPal Payments Standard buttons programmatically.
|
4
|
+
|
5
|
+
## Support
|
6
|
+
|
7
|
+
> Please contact [PayPal Technical Support](https://developer.paypal.com/support/) for any live or account issues.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'paypal-sdk-buttonmanager'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
```sh
|
20
|
+
$ bundle
|
21
|
+
```
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
```sh
|
26
|
+
$ gem install paypal-sdk-buttonmanager
|
27
|
+
```
|
28
|
+
|
29
|
+
## Configuration
|
30
|
+
|
31
|
+
For Rails application:
|
32
|
+
|
33
|
+
```sh
|
34
|
+
rails g paypal:sdk:install
|
35
|
+
```
|
36
|
+
|
37
|
+
For other ruby application, create a configuration file(`config/paypal.yml`):
|
38
|
+
|
39
|
+
```yaml
|
40
|
+
development: &default
|
41
|
+
username: jb-us-seller_api1.paypal.com
|
42
|
+
password: WX4WTU3S8MY44S7F
|
43
|
+
signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
|
44
|
+
app_id: APP-80W284485P519543T
|
45
|
+
http_timeout: 30
|
46
|
+
mode: sandbox
|
47
|
+
sandbox_email_address: Platform.sdk.seller@gmail.com
|
48
|
+
# # with certificate
|
49
|
+
# cert_path: "config/cert_key.pem"
|
50
|
+
# # with token authentication
|
51
|
+
# token: ESTy2hio5WJQo1iixkH29I53RJxaS0Gvno1A6.YQXZgktxbY4I2Tdg
|
52
|
+
# token_secret: ZKPhUYuwJwYsfWdzorozWO2U9pI
|
53
|
+
# # with Proxy
|
54
|
+
# http_proxy: http://proxy-ipaddress:3129/
|
55
|
+
# # with device ip address
|
56
|
+
# device_ipaddress: "127.0.0.1"
|
57
|
+
test:
|
58
|
+
<<: *default
|
59
|
+
production:
|
60
|
+
<<: *default
|
61
|
+
mode: live
|
62
|
+
```
|
63
|
+
|
64
|
+
Load Configurations from specified file:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
PayPal::SDK::Core::Config.load('config/paypal.yml', ENV['RACK_ENV'] || 'development')
|
68
|
+
```
|
69
|
+
|
70
|
+
## Example
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
require 'paypal-sdk-buttonmanager'
|
74
|
+
@api = PayPal::SDK::ButtonManager::API.new(
|
75
|
+
:mode => "sandbox", # Set "live" for production
|
76
|
+
:app_id => "APP-80W284485P519543T",
|
77
|
+
:username => "jb-us-seller_api1.paypal.com",
|
78
|
+
:password => "WX4WTU3S8MY44S7F",
|
79
|
+
:signature => "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy" )
|
80
|
+
|
81
|
+
# Build request object
|
82
|
+
@bm_create_button = @api.build_bm_create_button({
|
83
|
+
:ButtonType => "BUYNOW",
|
84
|
+
:ButtonCode => "HOSTED",
|
85
|
+
:ButtonVar => ["item_name=Testing","amount=5","return=http://localhost:3000/samples/button_manager/bm_create_button","notify_url=http://localhost:3000/samples/button_manager/ipn_notify"] })
|
86
|
+
|
87
|
+
# Make API call & get response
|
88
|
+
@bm_create_button_response = @api.bm_create_button(@bm_create_button)
|
89
|
+
|
90
|
+
# Access Response
|
91
|
+
if @bm_create_button_response.success?
|
92
|
+
@bm_create_button_response.Website
|
93
|
+
@bm_create_button_response.Email
|
94
|
+
@bm_create_button_response.HostedButtonID
|
95
|
+
else
|
96
|
+
@bm_create_button_response.Errors
|
97
|
+
end
|
98
|
+
```
|
data/Rakefile
CHANGED
@@ -2,13 +2,8 @@ require "bundler/gem_tasks"
|
|
2
2
|
|
3
3
|
desc "Run tests"
|
4
4
|
task :rspec do
|
5
|
-
cmd = "bundle exec rspec
|
5
|
+
cmd = "bundle exec rspec"
|
6
6
|
system(cmd) || raise("#{cmd} failed")
|
7
7
|
end
|
8
8
|
|
9
|
-
desc "View samples"
|
10
|
-
task :samples do
|
11
|
-
system("cd samples/spec/dummy && bundle exec rails server")
|
12
|
-
end
|
13
|
-
|
14
9
|
task :default => :rspec
|
@@ -1,26 +1,26 @@
|
|
1
|
-
require 'paypal-sdk-core'
|
2
|
-
|
3
|
-
module PayPal
|
4
|
-
module SDK
|
5
|
-
module ButtonManager
|
6
|
-
class API < Core::API::Merchant
|
7
|
-
include Services
|
8
|
-
|
9
|
-
def initialize(environment = nil, options = {})
|
10
|
-
super("", environment, options)
|
11
|
-
end
|
12
|
-
|
13
|
-
ADAPTIVE_PAYMENTS_HTTP_HEADER = { "X-PAYPAL-REQUEST-SOURCE" => "buttonmanager-ruby-sdk-#{VERSION}" }
|
14
|
-
def default_http_header
|
15
|
-
super.merge(ADAPTIVE_PAYMENTS_HTTP_HEADER)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Validate IPN message
|
19
|
-
def ipn_valid?(raw_post_data)
|
20
|
-
Core::API::IPN.valid?(raw_post_data, config)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
1
|
+
require 'paypal-sdk-core'
|
2
|
+
|
3
|
+
module PayPal
|
4
|
+
module SDK
|
5
|
+
module ButtonManager
|
6
|
+
class API < Core::API::Merchant
|
7
|
+
include Services
|
8
|
+
|
9
|
+
def initialize(environment = nil, options = {})
|
10
|
+
super("", environment, options)
|
11
|
+
end
|
12
|
+
|
13
|
+
ADAPTIVE_PAYMENTS_HTTP_HEADER = { "X-PAYPAL-REQUEST-SOURCE" => "buttonmanager-ruby-sdk-#{VERSION}" }
|
14
|
+
def default_http_header
|
15
|
+
super.merge(ADAPTIVE_PAYMENTS_HTTP_HEADER)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Validate IPN message
|
19
|
+
def ipn_valid?(raw_post_data)
|
20
|
+
Core::API::IPN.valid?(raw_post_data, config)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|