paypal-sdk-invoice 1.106.0 → 1.117.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +17 -17
- data/README.md +104 -125
- data/Rakefile +9 -14
- data/lib/paypal-sdk/invoice/api.rb +21 -21
- data/lib/paypal-sdk/invoice/data_types.rb +988 -871
- data/lib/paypal-sdk/invoice/services.rb +267 -248
- data/lib/paypal-sdk/invoice/version.rb +7 -7
- data/lib/paypal-sdk/invoice.rb +16 -16
- data/lib/paypal-sdk-invoice.rb +2 -2
- data/spec/config/paypal.yml +24 -24
- data/spec/invoice_spec.rb +18 -18
- data/spec/spec_helper.rb +6 -6
- metadata +26 -31
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6cc36afb984070bcf832f2fba6acf962becda1ff611b8ec59d2d1910f649f886
|
4
|
+
data.tar.gz: 5d0d800685c54d1d8fe962cc41132581285ebf68489cbf2679621c7e8b0e5ba8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 98bc45df0faf6da59baa83d09b2756cb285cdfebb727261a8177f098029c80f9561b9ec79f5f94fb6b3f8d41b7c56d114e1a33ae60ad3bb1c5fe8a6de21a7f49
|
7
|
+
data.tar.gz: fe3b2011a5e9e9fb96ed1feb6aa0eeeae3f6013d0de7be58866c42bb94c866a6f8b92f151063d1499c12bc98ba23cc8b0a4c826258aa1814a1c50007aded396e
|
data/Gemfile
CHANGED
@@ -1,17 +1,17 @@
|
|
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
|
-
if File.exist? File.expand_path('../samples/invoice_samples.gemspec', __FILE__)
|
8
|
-
gem 'invoice_samples', :path => 'samples', :require => false
|
9
|
-
group :test do
|
10
|
-
gem 'rspec-rails', :require => false
|
11
|
-
gem 'capybara', '~> 2.0.3', :require => false
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
group :test do
|
16
|
-
gem 'rspec'
|
17
|
-
end
|
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
|
+
if File.exist? File.expand_path('../samples/invoice_samples.gemspec', __FILE__)
|
8
|
+
gem 'invoice_samples', :path => 'samples', :require => false
|
9
|
+
group :test do
|
10
|
+
gem 'rspec-rails', :require => false
|
11
|
+
gem 'capybara', '~> 2.0.3', :require => false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem 'rspec'
|
17
|
+
end
|
data/README.md
CHANGED
@@ -1,125 +1,104 @@
|
|
1
|
-
# Invoice SDK
|
2
|
-
|
3
|
-
The PayPal Invoice SDK provides Ruby APIs to create and manage Invoices using the PayPal's Invoicing Service API.
|
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
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
@create_invoice_response.
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
Add following line in rails `Gemfile`:
|
107
|
-
|
108
|
-
```ruby
|
109
|
-
gem 'paypal-sdk-invoice'
|
110
|
-
gem 'invoice_samples', :git => "https://github.com/paypal/invoice-sdk-ruby.git", :group => :development
|
111
|
-
```
|
112
|
-
|
113
|
-
Configure routes(`config/routes.rb`):
|
114
|
-
|
115
|
-
```ruby
|
116
|
-
mount InvoiceSamples::Engine => "/samples" if Rails.env.development?
|
117
|
-
```
|
118
|
-
|
119
|
-
To get default paypal configuration execute:
|
120
|
-
|
121
|
-
```bash
|
122
|
-
$ rails g paypal:sdk:install
|
123
|
-
```
|
124
|
-
|
125
|
-
Run `rails server` and check the samples.
|
1
|
+
# Invoice SDK
|
2
|
+
|
3
|
+
The PayPal Invoice SDK provides Ruby APIs to create and manage Invoices using the PayPal's Invoicing Service API.
|
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-invoice'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
$ bundle
|
21
|
+
```
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ gem install paypal-sdk-invoice
|
27
|
+
```
|
28
|
+
|
29
|
+
## Configuration
|
30
|
+
|
31
|
+
For Rails application:
|
32
|
+
|
33
|
+
```bash
|
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
|
+
# # with certificate
|
48
|
+
# cert_path: "config/cert_key.pem"
|
49
|
+
# # with token authentication
|
50
|
+
# token: ESTy2hio5WJQo1iixkH29I53RJxaS0Gvno1A6.YQXZgktxbY4I2Tdg
|
51
|
+
# token_secret: ZKPhUYuwJwYsfWdzorozWO2U9pI
|
52
|
+
# # with Proxy
|
53
|
+
# http_proxy: http://proxy-ipaddress:3129/
|
54
|
+
# # with device ip address
|
55
|
+
# device_ipaddress: "127.0.0.1"
|
56
|
+
test:
|
57
|
+
<<: *default
|
58
|
+
production:
|
59
|
+
<<: *default
|
60
|
+
mode: live
|
61
|
+
```
|
62
|
+
|
63
|
+
Load Configurations from specified file:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
PayPal::SDK::Core::Config.load('config/paypal.yml', ENV['RACK_ENV'] || 'development')
|
67
|
+
```
|
68
|
+
|
69
|
+
## Example
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
require 'paypal-sdk-invoice'
|
73
|
+
@api = PayPal::SDK::Invoice::API.new(
|
74
|
+
:mode => "sandbox", # Set "live" for production
|
75
|
+
:app_id => "APP-80W284485P519543T",
|
76
|
+
:username => "jb-us-seller_api1.paypal.com",
|
77
|
+
:password => "WX4WTU3S8MY44S7F",
|
78
|
+
:signature => "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy" )
|
79
|
+
|
80
|
+
# Build request object
|
81
|
+
@create_invoice = @api.build_create_invoice({
|
82
|
+
:invoice => {
|
83
|
+
:merchantEmail => "jb-us-seller@paypal.com",
|
84
|
+
:payerEmail => "sender@yahoo.com",
|
85
|
+
:itemList => {
|
86
|
+
:item => [{
|
87
|
+
:name => "item1",
|
88
|
+
:quantity => 2.0,
|
89
|
+
:unitPrice => 5.0 }] },
|
90
|
+
:currencyCode => "USD",
|
91
|
+
:paymentTerms => "DueOnReceipt" } })
|
92
|
+
|
93
|
+
# Make API call & get response
|
94
|
+
@create_invoice_response = @api.create_invoice(@create_invoice)
|
95
|
+
|
96
|
+
# Access Response
|
97
|
+
if @create_invoice_response.success?
|
98
|
+
@create_invoice_response.invoiceID
|
99
|
+
@create_invoice_response.invoiceNumber
|
100
|
+
@create_invoice_response.invoiceURL
|
101
|
+
else
|
102
|
+
@create_invoice_response.error
|
103
|
+
end
|
104
|
+
```
|
data/Rakefile
CHANGED
@@ -1,14 +1,9 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
|
3
|
-
desc "Run tests"
|
4
|
-
task :rspec do
|
5
|
-
cmd = "bundle exec rspec
|
6
|
-
system(cmd) || raise("#{cmd} failed")
|
7
|
-
end
|
8
|
-
|
9
|
-
|
10
|
-
task :samples do
|
11
|
-
system("cd samples/spec/dummy && bundle exec rails server")
|
12
|
-
end
|
13
|
-
|
14
|
-
task :default => :rspec
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
desc "Run tests"
|
4
|
+
task :rspec do
|
5
|
+
cmd = "bundle exec rspec"
|
6
|
+
system(cmd) || raise("#{cmd} failed")
|
7
|
+
end
|
8
|
+
|
9
|
+
task :default => :rspec
|
@@ -1,21 +1,21 @@
|
|
1
|
-
require 'paypal-sdk-core'
|
2
|
-
|
3
|
-
module PayPal
|
4
|
-
module SDK
|
5
|
-
module Invoice
|
6
|
-
class API < Core::API::Platform
|
7
|
-
include Services
|
8
|
-
|
9
|
-
def initialize(environment = nil, options = {})
|
10
|
-
super(SERVICE_NAME, environment, options)
|
11
|
-
end
|
12
|
-
|
13
|
-
INVOICE_HTTP_HEADER = { "X-PAYPAL-REQUEST-SOURCE" => "invoice-ruby-sdk-#{VERSION}" }
|
14
|
-
def default_http_header
|
15
|
-
super.merge(INVOICE_HTTP_HEADER)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
1
|
+
require 'paypal-sdk-core'
|
2
|
+
|
3
|
+
module PayPal
|
4
|
+
module SDK
|
5
|
+
module Invoice
|
6
|
+
class API < Core::API::Platform
|
7
|
+
include Services
|
8
|
+
|
9
|
+
def initialize(environment = nil, options = {})
|
10
|
+
super(SERVICE_NAME, environment, options)
|
11
|
+
end
|
12
|
+
|
13
|
+
INVOICE_HTTP_HEADER = { "X-PAYPAL-REQUEST-SOURCE" => "invoice-ruby-sdk-#{VERSION}" }
|
14
|
+
def default_http_header
|
15
|
+
super.merge(INVOICE_HTTP_HEADER)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|