paypal-sdk-invoice 1.96.1 → 1.96.2
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 +112 -63
- data/Rakefile +0 -0
- data/lib/paypal-sdk-invoice.rb +0 -0
- data/lib/paypal-sdk/invoice/data_types.rb +0 -0
- data/lib/paypal-sdk/invoice/services.rb +0 -0
- data/lib/paypal-sdk/invoice/version.rb +1 -1
- data/spec/config/cert_key.pem +0 -0
- data/spec/config/paypal.yml +24 -25
- data/spec/invoice_spec.rb +27 -27
- data/spec/spec_helper.rb +6 -6
- metadata +8 -18
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTQ3N2NiYTNkZmVkMWE3MWMxNDE1MmU0MjQxNDkxZDQxMTFjYjE2YQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YWNjNjUxZWY5Nzg5MjBlMTYxOTM5MWU3ZjA4N2M4NmZjN2JmODZjZQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MjFiYzQ3NjdhMGJhOTIyZjY0OTQzMDNjMDc4MDdmMmNjNzVmZmM0NTA3NzU4
|
10
|
+
NzQzM2FmZjczNzg3MzUzMzdjZTkxYWVjNDM4ZDNhNzVlNGI5YjExNWIyOWM2
|
11
|
+
MjZkZjUzZThmZDAzZjY3ZjBhMjNhYjY0N2ZjOTNlY2M5MWQ4ZGQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MmVlZDY4N2Q2ZTg2ODVhZWE0YTRkZTk0MTRlYzM1Yzc2NjhlMWQzNzgyMWEz
|
14
|
+
YzI3YTE2NGFjYjM2MWM5MzA2ZjFkODE3OGMxZGU1ZjkyZTFkZTQ1Mjg5MjVm
|
15
|
+
NTkyZGYxZjE3NGY0OTA5MmI1YWVlZjc5ZjRkNjJjZGMxNTY3YjQ=
|
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/invoice_samples.gemspec', __FILE__)
|
8
8
|
gem 'invoice_samples', :path => 'samples', :require => false
|
9
9
|
group :test do
|
10
10
|
gem 'rspec-rails', :require => false
|
data/README.md
CHANGED
@@ -6,136 +6,179 @@ The PayPal Invoice SDK provides Ruby APIs to create and manage Invoices using th
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
|
9
|
+
```ruby
|
10
|
+
gem 'paypal-sdk-invoice'
|
11
|
+
```
|
10
12
|
|
11
13
|
And then execute:
|
12
14
|
|
13
|
-
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
14
18
|
|
15
19
|
Or install it yourself as:
|
16
20
|
|
17
|
-
|
21
|
+
```bash
|
22
|
+
$ gem install paypal-sdk-invoice
|
23
|
+
```
|
18
24
|
|
19
25
|
## Configuration
|
20
26
|
|
21
27
|
For Rails application:
|
22
28
|
|
23
|
-
|
29
|
+
```bash
|
30
|
+
$ rails g paypal:sdk:install
|
31
|
+
```
|
24
32
|
|
25
33
|
For other ruby application, create a configuration file(`config/paypal.yml`):
|
26
34
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
35
|
+
```yaml
|
36
|
+
development: &default
|
37
|
+
username: jb-us-seller_api1.paypal.com
|
38
|
+
password: WX4WTU3S8MY44S7F
|
39
|
+
signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
|
40
|
+
app_id: APP-80W284485P519543T
|
41
|
+
http_timeout: 30
|
42
|
+
mode: sandbox
|
43
|
+
# # with certificate
|
44
|
+
# cert_path: "config/cert_key.pem"
|
45
|
+
# # with token authentication
|
46
|
+
# token: ESTy2hio5WJQo1iixkH29I53RJxaS0Gvno1A6.YQXZgktxbY4I2Tdg
|
47
|
+
# token_secret: ZKPhUYuwJwYsfWdzorozWO2U9pI
|
48
|
+
# # with Proxy
|
49
|
+
# http_proxy: http://proxy-ipaddress:3129/
|
50
|
+
# # with device ip address
|
51
|
+
# device_ipaddress: "127.0.0.1"
|
52
|
+
test:
|
53
|
+
<<: *default
|
54
|
+
production:
|
55
|
+
<<: *default
|
56
|
+
mode: live
|
57
|
+
```
|
58
|
+
|
49
59
|
Load Configurations from specified file:
|
50
60
|
|
51
|
-
|
61
|
+
```ruby
|
62
|
+
PayPal::SDK::Core::Config.load('config/paypal.yml', ENV['RACK_ENV'] || 'development')
|
63
|
+
```
|
52
64
|
|
53
65
|
## Create API object
|
54
66
|
|
55
67
|
Create API object:
|
56
68
|
|
57
|
-
|
69
|
+
```ruby
|
70
|
+
api = PayPal::SDK::Invoice::API.new
|
71
|
+
```
|
58
72
|
|
59
73
|
Override configuration while creating a object:
|
60
74
|
|
61
|
-
|
62
|
-
|
63
|
-
|
75
|
+
```ruby
|
76
|
+
api = PayPal::SDK::Invoice::API.new(:development)
|
77
|
+
api = PayPal::SDK::Invoice::API.new(:development, :app_id => "XYZ")
|
78
|
+
api = PayPal::SDK::Invoice::API.new(:app_id => "XYZ") # Take default environment.
|
79
|
+
```
|
64
80
|
|
65
81
|
Change configuration:
|
66
82
|
|
67
|
-
|
68
|
-
|
83
|
+
```ruby
|
84
|
+
api.set_config :testing
|
85
|
+
api.set_config :testing, app_id => "XYZ"
|
86
|
+
```
|
69
87
|
|
70
88
|
|
71
89
|
## Build Request Object
|
72
90
|
|
73
91
|
To make api request, we need to build a request object.
|
74
92
|
|
75
|
-
|
76
|
-
|
93
|
+
```ruby
|
94
|
+
# To build a empty request object
|
95
|
+
create_invoice_request = api.build_create_invoice()
|
96
|
+
|
97
|
+
# To build a request object with default data
|
98
|
+
create_invoice_request = api.build_create_invoice( :invoice => { :merchantEmail => "jb-us-seller@paypal.com" })
|
99
|
+
```
|
77
100
|
|
78
|
-
# To build a request object with default data
|
79
|
-
create_invoice_request = api.build_create_invoice( :invoice => { :merchantEmail => "jb-us-seller@paypal.com" })
|
80
101
|
|
81
102
|
The Build method can be access with camelcase or underscore:
|
82
103
|
|
83
|
-
|
84
|
-
|
85
|
-
|
104
|
+
```ruby
|
105
|
+
api = api.build_create_invoice()
|
106
|
+
# (or)
|
107
|
+
api = api.BuildCreateInvoice()
|
108
|
+
```
|
86
109
|
|
87
110
|
## Assign value to members
|
88
111
|
|
89
112
|
Members can be access with camelcase or underscore format.
|
90
113
|
|
91
|
-
|
92
|
-
|
93
|
-
|
114
|
+
```ruby
|
115
|
+
create_invoice_request.invoice.itemList.item[0].name = "item1"
|
116
|
+
# With underscore
|
117
|
+
create_invoice_request.invoice.item_list.item[0].name = "item1"
|
118
|
+
```
|
94
119
|
|
95
120
|
To Assign multiple values:
|
96
121
|
|
97
|
-
|
122
|
+
```ruby
|
123
|
+
create_invoice_request.invoice.itemList.item[0] = { :name => "item1", :quantity => 2.0, :unitPrice => 5.0 }
|
124
|
+
```
|
98
125
|
|
99
126
|
To Get members list for the given object( For Reference ):
|
100
127
|
|
101
|
-
|
102
|
-
|
128
|
+
```ruby
|
129
|
+
create_invoice_request.members
|
130
|
+
create_invoice_request.baseAmountList.members
|
131
|
+
```
|
103
132
|
|
104
133
|
## Make API Request
|
105
134
|
|
106
135
|
Make api call with request object:
|
107
136
|
|
108
|
-
|
137
|
+
```ruby
|
138
|
+
create_invoice_response = api.create_invoice(create_invoice_request)
|
139
|
+
```
|
109
140
|
|
110
141
|
Make api call with hash:
|
111
142
|
|
112
|
-
|
143
|
+
```ruby
|
144
|
+
create_invoice_response = api.create_invoice( :invoice => { :merchantEmail => "jb-us-seller@paypal.com", :payerEmail => "sender@yahoo.com" } )
|
145
|
+
```
|
113
146
|
|
114
147
|
## Access values from response object
|
115
148
|
|
116
149
|
To get response status:
|
117
150
|
|
118
|
-
|
151
|
+
```ruby
|
152
|
+
create_invoice_response.responseEnvelope.ack
|
153
|
+
```
|
119
154
|
|
120
155
|
|
121
156
|
## Example
|
122
157
|
|
123
158
|
```ruby
|
124
159
|
require 'paypal-sdk-invoice'
|
125
|
-
@api = PayPal::SDK::Invoice::API.new
|
160
|
+
@api = PayPal::SDK::Invoice::API.new(
|
161
|
+
:mode => "sandbox", # Set "live" for production
|
162
|
+
:app_id => "APP-80W284485P519543T",
|
163
|
+
:username => "jb-us-seller_api1.paypal.com",
|
164
|
+
:password => "WX4WTU3S8MY44S7F",
|
165
|
+
:signature => "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy" )
|
126
166
|
|
127
167
|
# Build request object
|
128
|
-
@
|
129
|
-
|
130
|
-
|
131
|
-
@
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
168
|
+
@create_invoice = @api.build_create_invoice({
|
169
|
+
:invoice => {
|
170
|
+
:merchantEmail => "jb-us-seller@paypal.com",
|
171
|
+
:payerEmail => "sender@yahoo.com",
|
172
|
+
:itemList => {
|
173
|
+
:item => [{
|
174
|
+
:name => "item1",
|
175
|
+
:quantity => 2.0,
|
176
|
+
:unitPrice => 5.0 }] },
|
177
|
+
:currencyCode => "USD",
|
178
|
+
:paymentTerms => "DueOnReceipt" } })
|
136
179
|
|
137
180
|
# Make API call & get response
|
138
|
-
@create_invoice_response = @api.create_invoice(@
|
181
|
+
@create_invoice_response = @api.create_invoice(@create_invoice)
|
139
182
|
|
140
183
|
# Access Response
|
141
184
|
@create_invoice_response.responseEnvelope
|
@@ -149,15 +192,21 @@ require 'paypal-sdk-invoice'
|
|
149
192
|
|
150
193
|
Add following line in rails `Gemfile`:
|
151
194
|
|
152
|
-
|
153
|
-
|
195
|
+
```ruby
|
196
|
+
gem 'paypal-sdk-invoice'
|
197
|
+
gem 'invoice_samples', :git => "https://github.com/paypal/invoice-sdk-ruby.git", :group => :development
|
198
|
+
```
|
154
199
|
|
155
200
|
Configure routes(`config/routes.rb`):
|
156
201
|
|
157
|
-
|
202
|
+
```ruby
|
203
|
+
mount InvoiceSamples::Engine => "/samples" if Rails.env.development?
|
204
|
+
```
|
158
205
|
|
159
206
|
To get default paypal configuration execute:
|
160
207
|
|
161
|
-
|
208
|
+
```bash
|
209
|
+
$ rails g paypal:sdk:install
|
210
|
+
```
|
162
211
|
|
163
212
|
Run `rails server` and check the samples.
|
data/Rakefile
CHANGED
File without changes
|
data/lib/paypal-sdk-invoice.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/spec/config/cert_key.pem
CHANGED
File without changes
|
data/spec/config/paypal.yml
CHANGED
@@ -1,25 +1,24 @@
|
|
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
|
-
|
24
|
-
|
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
|
+
|
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
|
+
soap_end_point: "https://api.sandbox.paypal.com/2.0/"
|
20
|
+
|
21
|
+
with_oauth_token:
|
22
|
+
<<: *default
|
23
|
+
token: H2kLxjm9lCxQdnOYxkH29I53TpZyIXez4GtHhAVGpiU3DiVTz5eNPQ
|
24
|
+
token_secret: MnZ-iPdDqGLEfQIuTIfUN4uK9lU
|
data/spec/invoice_spec.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Invoice" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@client = PayPal::SDK::Invoice::API.new
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "Services" do
|
10
|
-
PayPal::SDK::Invoice::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::Invoice::DataTypes.constants.each do |const_name|
|
20
|
-
it "create object for #{const_name}" do
|
21
|
-
klass = PayPal::SDK::Invoice::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 "Invoice" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@client = PayPal::SDK::Invoice::API.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "Services" do
|
10
|
+
PayPal::SDK::Invoice::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::Invoice::DataTypes.constants.each do |const_name|
|
20
|
+
it "create object for #{const_name}" do
|
21
|
+
klass = PayPal::SDK::Invoice::DataTypes.const_get(const_name)
|
22
|
+
klass.new.should be_a klass
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
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-invoice'
|
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-invoice'
|
metadata
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-sdk-invoice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.96.
|
5
|
-
prerelease:
|
4
|
+
version: 1.96.2
|
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 Invoice SDK provides Ruby APIs to create and manage Invoices
|
31
28
|
using the PayPal's Invoicing Service API.
|
32
29
|
email:
|
@@ -48,35 +45,28 @@ files:
|
|
48
45
|
- Rakefile
|
49
46
|
- README.md
|
50
47
|
- Gemfile
|
51
|
-
homepage: https://
|
48
|
+
homepage: https://developer.paypal.com
|
52
49
|
licenses: []
|
50
|
+
metadata: {}
|
53
51
|
post_install_message:
|
54
52
|
rdoc_options: []
|
55
53
|
require_paths:
|
56
54
|
- lib
|
57
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
56
|
requirements:
|
60
57
|
- - ! '>='
|
61
58
|
- !ruby/object:Gem::Version
|
62
59
|
version: '0'
|
63
|
-
segments:
|
64
|
-
- 0
|
65
|
-
hash: 569728605
|
66
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
61
|
requirements:
|
69
62
|
- - ! '>='
|
70
63
|
- !ruby/object:Gem::Version
|
71
64
|
version: '0'
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
hash: 569728605
|
75
65
|
requirements: []
|
76
66
|
rubyforge_project:
|
77
|
-
rubygems_version:
|
67
|
+
rubygems_version: 2.0.0
|
78
68
|
signing_key:
|
79
|
-
specification_version:
|
69
|
+
specification_version: 4
|
80
70
|
summary: PayPal Invoice SDK
|
81
71
|
test_files:
|
82
72
|
- spec/invoice_spec.rb
|