paypal-sdk-invoice 1.96.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +17 -0
- data/README.md +163 -0
- data/Rakefile +14 -0
- data/lib/paypal-sdk-invoice.rb +2 -0
- data/lib/paypal-sdk/invoice.rb +16 -0
- data/lib/paypal-sdk/invoice/api.rb +21 -0
- data/lib/paypal-sdk/invoice/data_types.rb +784 -0
- data/lib/paypal-sdk/invoice/services.rb +211 -0
- data/lib/paypal-sdk/invoice/version.rb +7 -0
- data/spec/config/cert_key.pem +33 -0
- data/spec/config/paypal.yml +25 -0
- data/spec/invoice_spec.rb +27 -0
- data/spec/spec_helper.rb +6 -0
- metadata +84 -0
data/Gemfile
ADDED
@@ -0,0 +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 Dir.exist? File.expand_path('../samples', __FILE__)
|
8
|
+
gem 'invoice_samples', :path => 'samples', :require => false
|
9
|
+
group :test do
|
10
|
+
gem 'rspec-rails', :require => false
|
11
|
+
gem 'capybara', :require => false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem 'rspec'
|
17
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
# Invoice
|
2
|
+
|
3
|
+
SDK for Invoice.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'paypal-sdk-invoice'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install paypal-sdk-invoice
|
18
|
+
|
19
|
+
## Configuration
|
20
|
+
|
21
|
+
For Rails application:
|
22
|
+
|
23
|
+
rails g paypal:sdk:install
|
24
|
+
|
25
|
+
For other ruby application, create a configuration file(`config/paypal.yml`):
|
26
|
+
|
27
|
+
development: &default
|
28
|
+
username: jb-us-seller_api1.paypal.com
|
29
|
+
password: WX4WTU3S8MY44S7F
|
30
|
+
signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
|
31
|
+
app_id: APP-80W284485P519543T
|
32
|
+
http_timeout: 30
|
33
|
+
mode: sandbox
|
34
|
+
# # with certificate
|
35
|
+
# cert_path: "config/cert_key.pem"
|
36
|
+
# # with token authentication
|
37
|
+
# token: ESTy2hio5WJQo1iixkH29I53RJxaS0Gvno1A6.YQXZgktxbY4I2Tdg
|
38
|
+
# token_secret: ZKPhUYuwJwYsfWdzorozWO2U9pI
|
39
|
+
# # with Proxy
|
40
|
+
# http_proxy: http://proxy-ipaddress:3129/
|
41
|
+
# # with device ip address
|
42
|
+
# device_ipaddress: "127.0.0.1"
|
43
|
+
test:
|
44
|
+
<<: *default
|
45
|
+
production:
|
46
|
+
<<: *default
|
47
|
+
mode: live
|
48
|
+
|
49
|
+
Load Configurations from specified file:
|
50
|
+
|
51
|
+
PayPal::SDK::Core::Config.load('config/paypal.yml', ENV['RACK_ENV'] || 'development')
|
52
|
+
|
53
|
+
## Create API object
|
54
|
+
|
55
|
+
Create API object:
|
56
|
+
|
57
|
+
api = PayPal::SDK::Invoice::API.new
|
58
|
+
|
59
|
+
Override configuration while creating a object:
|
60
|
+
|
61
|
+
api = PayPal::SDK::Invoice::API.new(:development)
|
62
|
+
api = PayPal::SDK::Invoice::API.new(:development, :app_id => "XYZ")
|
63
|
+
api = PayPal::SDK::Invoice::API.new(:app_id => "XYZ") # Take default environment.
|
64
|
+
|
65
|
+
Change configuration:
|
66
|
+
|
67
|
+
api.set_config :testing
|
68
|
+
api.set_config :testing, app_id => "XYZ"
|
69
|
+
|
70
|
+
|
71
|
+
## Build Request Object
|
72
|
+
|
73
|
+
To make api request, we need to build a request object.
|
74
|
+
|
75
|
+
# To build a empty request object
|
76
|
+
create_invoice_request = api.build_create_invoice()
|
77
|
+
|
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
|
+
|
81
|
+
The Build method can be access with camelcase or underscore:
|
82
|
+
|
83
|
+
api = api.build_create_invoice()
|
84
|
+
# (or)
|
85
|
+
api = api.BuildCreateInvoice()
|
86
|
+
|
87
|
+
## Assign value to members
|
88
|
+
|
89
|
+
Members can be access with camelcase or underscore format.
|
90
|
+
|
91
|
+
create_invoice_request.invoice.itemList.item[0].name = "item1"
|
92
|
+
# With underscore
|
93
|
+
create_invoice_request.invoice.item_list.item[0].name = "item1"
|
94
|
+
|
95
|
+
To Assign multiple values:
|
96
|
+
|
97
|
+
create_invoice_request.invoice.itemList.item[0] = { :name => "item1", :quantity => 2.0, :unitPrice => 5.0 }
|
98
|
+
|
99
|
+
To Get members list for the given object( For Reference ):
|
100
|
+
|
101
|
+
create_invoice_request.members
|
102
|
+
create_invoice_request.baseAmountList.members
|
103
|
+
|
104
|
+
## Make API Request
|
105
|
+
|
106
|
+
Make api call with request object:
|
107
|
+
|
108
|
+
create_invoice_response = api.create_invoice(create_invoice_request)
|
109
|
+
|
110
|
+
Make api call with hash:
|
111
|
+
|
112
|
+
create_invoice_response = api.create_invoice( :invoice => { :merchantEmail => "jb-us-seller@paypal.com", :payerEmail => "sender@yahoo.com" } )
|
113
|
+
|
114
|
+
## Access values from response object
|
115
|
+
|
116
|
+
To get response status:
|
117
|
+
|
118
|
+
create_invoice_response.responseEnvelope.ack
|
119
|
+
|
120
|
+
|
121
|
+
## Example
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
require 'paypal-sdk-invoice'
|
125
|
+
@api = PayPal::SDK::Invoice::API.new
|
126
|
+
|
127
|
+
# Build request object
|
128
|
+
@create_invoice_request = @api.build_create_invoice()
|
129
|
+
@create_invoice_request.invoice.merchantEmail = "jb-us-seller@paypal.com"
|
130
|
+
@create_invoice_request.invoice.payerEmail = "sender@yahoo.com"
|
131
|
+
@create_invoice_request.invoice.itemList.item[0].name = "item1"
|
132
|
+
@create_invoice_request.invoice.itemList.item[0].quantity = 2.0
|
133
|
+
@create_invoice_request.invoice.itemList.item[0].unitPrice = 5.0
|
134
|
+
@create_invoice_request.invoice.currencyCode = "USD"
|
135
|
+
@create_invoice_request.invoice.paymentTerms = "DueOnReceipt"
|
136
|
+
|
137
|
+
# Make API call & get response
|
138
|
+
@create_invoice_response = @api.create_invoice(@create_invoice_request)
|
139
|
+
|
140
|
+
# Access Response
|
141
|
+
@create_invoice_response.responseEnvelope
|
142
|
+
@create_invoice_response.invoiceID
|
143
|
+
@create_invoice_response.invoiceNumber
|
144
|
+
@create_invoice_response.invoiceURL
|
145
|
+
@create_invoice_response.totalAmount
|
146
|
+
```
|
147
|
+
|
148
|
+
## Samples
|
149
|
+
|
150
|
+
Add following line in rails `Gemfile`:
|
151
|
+
|
152
|
+
gem 'paypal-sdk-invoice'
|
153
|
+
gem 'invoice_samples', :git => "https://github.com/paypal/invoice-sdk-ruby.git", :group => :development
|
154
|
+
|
155
|
+
Configure routes(`config/routes.rb`):
|
156
|
+
|
157
|
+
mount InvoiceSamples::Engine => "/samples" if Rails.env.development?
|
158
|
+
|
159
|
+
To get default paypal configuration execute:
|
160
|
+
|
161
|
+
rails g paypal:sdk:install
|
162
|
+
|
163
|
+
Run `rails server` and check the samples.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
desc "Run tests"
|
4
|
+
task :rspec do
|
5
|
+
cmd = "bundle exec rspec && cd samples && bundle exec rspec"
|
6
|
+
system(cmd) || raise("#{cmd} failed")
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "View samples"
|
10
|
+
task :samples do
|
11
|
+
system("cd samples/spec/dummy && bundle exec rails server")
|
12
|
+
end
|
13
|
+
|
14
|
+
task :default => :rspec
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'paypal-sdk-core'
|
2
|
+
|
3
|
+
module PayPal
|
4
|
+
module SDK
|
5
|
+
module Invoice
|
6
|
+
autoload :VERSION, "paypal-sdk/invoice/version"
|
7
|
+
autoload :Services, "paypal-sdk/invoice/services"
|
8
|
+
autoload :DataTypes, "paypal-sdk/invoice/data_types"
|
9
|
+
autoload :API, "paypal-sdk/invoice/api"
|
10
|
+
|
11
|
+
def self.new(*args)
|
12
|
+
API.new(*args)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +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
|
+
|
@@ -0,0 +1,784 @@
|
|
1
|
+
# Stub objects for Invoice
|
2
|
+
# Auto generated code
|
3
|
+
|
4
|
+
require 'paypal-sdk-core'
|
5
|
+
|
6
|
+
module PayPal::SDK
|
7
|
+
module Invoice
|
8
|
+
module DataTypes
|
9
|
+
|
10
|
+
class DataType < Core::API::DataTypes::Base
|
11
|
+
def self.load_members
|
12
|
+
add_attribute :xmlns
|
13
|
+
add_attribute :type, :namespace => :xsi
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class EnumType < Core::API::DataTypes::Enum
|
18
|
+
end
|
19
|
+
|
20
|
+
class BaseAddress < DataType
|
21
|
+
def self.load_members
|
22
|
+
object_of :line1, String, :required => true
|
23
|
+
object_of :line2, String
|
24
|
+
object_of :city, String, :required => true
|
25
|
+
object_of :state, String
|
26
|
+
object_of :postalCode, String
|
27
|
+
object_of :countryCode, String, :required => true
|
28
|
+
object_of :type, String
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
# This type contains the detailed error information resulting from the service operation.
|
35
|
+
class ErrorData < DataType
|
36
|
+
def self.load_members
|
37
|
+
object_of :errorId, Integer
|
38
|
+
object_of :domain, String
|
39
|
+
object_of :subdomain, String
|
40
|
+
object_of :severity, ErrorSeverity
|
41
|
+
object_of :category, ErrorCategory
|
42
|
+
object_of :message, String
|
43
|
+
object_of :exceptionId, String
|
44
|
+
array_of :parameter, ErrorParameter
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
class ErrorParameter < DataType
|
51
|
+
def self.load_members
|
52
|
+
add_attribute :name, :required => true
|
53
|
+
object_of :value, String, :required => true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
# This specifies a fault, encapsulating error data, with specific error codes.
|
60
|
+
class FaultMessage < DataType
|
61
|
+
def self.load_members
|
62
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
63
|
+
array_of :error, ErrorData
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
# This specifies the list of parameters with every request to the service.
|
70
|
+
class RequestEnvelope < DataType
|
71
|
+
def self.load_members
|
72
|
+
# This specifies the required detail level that is needed by a client application pertaining to a particular data component (e.g., Item, Transaction, etc.). The detail level is specified in the DetailLevelCodeType which has all the enumerated values of the detail level for each component.
|
73
|
+
object_of :detailLevel, DetailLevelCode
|
74
|
+
# This should be the standard RFC 3066 language identification tag, e.g., en_US.
|
75
|
+
object_of :errorLanguage, String, :required => true
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
# This specifies a list of parameters with every response from a service.
|
82
|
+
class ResponseEnvelope < DataType
|
83
|
+
def self.load_members
|
84
|
+
object_of :timestamp, DateTime, :required => true
|
85
|
+
# Application level acknowledgment code.
|
86
|
+
object_of :ack, AckCode, :required => true
|
87
|
+
object_of :correlationId, String, :required => true
|
88
|
+
object_of :build, String, :required => true
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
# AckCodeType This code identifies the acknowledgment code types that could be used to communicate the status of processing a (request) message to an application. This code would be used as part of a response message that contains an application level acknowledgment element.
|
95
|
+
class AckCode < EnumType
|
96
|
+
self.options = { 'SUCCESS' => 'Success', 'FAILURE' => 'Failure', 'WARNING' => 'Warning', 'SUCCESSWITHWARNING' => 'SuccessWithWarning', 'FAILUREWITHWARNING' => 'FailureWithWarning' }
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
# DetailLevelCodeType
|
102
|
+
class DetailLevelCode < EnumType
|
103
|
+
self.options = { 'RETURNALL' => 'ReturnAll' }
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
class ErrorCategory < EnumType
|
109
|
+
self.options = { 'SYSTEM' => 'System', 'APPLICATION' => 'Application', 'REQUEST' => 'Request' }
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
class ErrorSeverity < EnumType
|
115
|
+
self.options = { 'ERROR' => 'Error', 'WARNING' => 'Warning' }
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
# Specifies the payment terms for this invoice.
|
121
|
+
class PaymentTermsType < EnumType
|
122
|
+
self.options = { 'DUEONRECEIPT' => 'DueOnReceipt', 'DUEONDATESPECIFIED' => 'DueOnDateSpecified', 'NET1' => 'Net10', 'NET2' => 'Net15', 'NET3' => 'Net30', 'NET4' => 'Net45' }
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
# Specifies the payment methods that can be used to mark an invoice as paid.
|
128
|
+
class PaymentMethodsType < EnumType
|
129
|
+
self.options = { 'BANKTRANSFER' => 'BankTransfer', 'CASH' => 'Cash', 'CHECK' => 'Check', 'CREDITCARD' => 'CreditCard', 'DEBITCARD' => 'DebitCard', 'OTHER' => 'Other', 'PAYPAL' => 'PayPal', 'WIRETRANSFER' => 'WireTransfer' }
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
# Specifies the invoice status.
|
135
|
+
class StatusType < EnumType
|
136
|
+
self.options = { 'DRAFT' => 'Draft', 'SENT' => 'Sent', 'PAID' => 'Paid', 'MARKEDASPAID' => 'MarkedAsPaid', 'CANCELED' => 'Canceled', 'REFUNDED' => 'Refunded', 'PARTIALLYREFUNDED' => 'PartiallyRefunded', 'MARKEDASREFUNDED' => 'MarkedAsRefunded' }
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
# Specifies the merchant or payer.
|
142
|
+
class OriginType < EnumType
|
143
|
+
self.options = { 'WEB' => 'Web', 'API' => 'API' }
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
# Specifies the merchant or payer.
|
149
|
+
class ActorType < EnumType
|
150
|
+
self.options = { 'MERCHANT' => 'Merchant', 'PAYER' => 'Payer' }
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
# Contact information for a company participating in the invoicing system.
|
156
|
+
class BusinessInfoType < DataType
|
157
|
+
def self.load_members
|
158
|
+
# First name of the company contact.
|
159
|
+
object_of :firstName, String
|
160
|
+
# Last name of the company contact.
|
161
|
+
object_of :lastName, String
|
162
|
+
# Business name of the company.
|
163
|
+
object_of :businessName, String
|
164
|
+
# Phone number for contacting the company.
|
165
|
+
object_of :phone, String
|
166
|
+
# Fax number used by the company.
|
167
|
+
object_of :fax, String
|
168
|
+
# Website used by the company.
|
169
|
+
object_of :website, String
|
170
|
+
# Custom value to be displayed in the contact information details.
|
171
|
+
object_of :customValue, String
|
172
|
+
# Street address of the company.
|
173
|
+
object_of :address, BaseAddress
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
# Item information about a service or product listed in the invoice.
|
180
|
+
class InvoiceItemType < DataType
|
181
|
+
def self.load_members
|
182
|
+
# SKU or item name.
|
183
|
+
object_of :name, String, :required => true
|
184
|
+
# Description of the item.
|
185
|
+
object_of :description, String
|
186
|
+
# Date on which the product or service was provided.
|
187
|
+
object_of :date, DateTime
|
188
|
+
# Item count.
|
189
|
+
object_of :quantity, Float, :required => true
|
190
|
+
# Price of the item, in the currency specified by the invoice.
|
191
|
+
object_of :unitPrice, Float, :required => true
|
192
|
+
# Name of an applicable tax, if any.
|
193
|
+
object_of :taxName, String
|
194
|
+
# Rate of an applicable tax, if any.
|
195
|
+
object_of :taxRate, Float
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
# A list of invoice items.
|
202
|
+
class InvoiceItemListType < DataType
|
203
|
+
def self.load_members
|
204
|
+
array_of :item, InvoiceItemType, :required => true
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
# Invoice details about the merchant, payer, totals and terms.
|
211
|
+
class InvoiceType < DataType
|
212
|
+
def self.load_members
|
213
|
+
# Merchant's email.
|
214
|
+
object_of :merchantEmail, String, :required => true
|
215
|
+
# Email to which the invoice will be sent.
|
216
|
+
object_of :payerEmail, String, :required => true
|
217
|
+
# Unique identifier for the invoice.
|
218
|
+
object_of :number, String
|
219
|
+
# Company contact information of the merchant company sending the invoice.
|
220
|
+
object_of :merchantInfo, BusinessInfoType
|
221
|
+
# List of items included in this invoice.
|
222
|
+
object_of :itemList, InvoiceItemListType, :required => true
|
223
|
+
# Currency used for all invoice item amounts and totals.
|
224
|
+
object_of :currencyCode, String, :required => true
|
225
|
+
# Date on which the invoice will be enabled.
|
226
|
+
object_of :invoiceDate, DateTime
|
227
|
+
# Date on which the invoice payment is due.
|
228
|
+
object_of :dueDate, DateTime
|
229
|
+
# Terms by which the invoice payment is due.
|
230
|
+
object_of :paymentTerms, PaymentTermsType, :required => true
|
231
|
+
# A discount percent applied to the invoice, if any.
|
232
|
+
object_of :discountPercent, Float
|
233
|
+
# A discount amount applied to the invoice, if any. If DiscountPercent is provided, DiscountAmount is ignored.
|
234
|
+
object_of :discountAmount, Float
|
235
|
+
# General terms for the invoice.
|
236
|
+
object_of :terms, String
|
237
|
+
# Note to the payer company.
|
238
|
+
object_of :note, String
|
239
|
+
# Memo for book keeping that is private to the Merchant.
|
240
|
+
object_of :merchantMemo, String
|
241
|
+
# Billing information for the payer.
|
242
|
+
object_of :billingInfo, BusinessInfoType
|
243
|
+
# Shipping information for the payer.
|
244
|
+
object_of :shippingInfo, BusinessInfoType
|
245
|
+
# Cost of shipping.
|
246
|
+
object_of :shippingAmount, Float
|
247
|
+
# Name of the applicable tax on shipping cost, if any.
|
248
|
+
object_of :shippingTaxName, String
|
249
|
+
# Rate of the applicable tax on shipping cost, if any.
|
250
|
+
object_of :shippingTaxRate, Float
|
251
|
+
# The external image URL of the invoice's logo, if any
|
252
|
+
object_of :logoUrl, String
|
253
|
+
# BN code for tracking transactions with a particular partner.
|
254
|
+
object_of :referrerCode, String
|
255
|
+
# Label used to display custom amount value. If a value is entered for customAmountLabel, then customAmountValue cannot be empty.
|
256
|
+
object_of :customAmountLabel, String
|
257
|
+
# Value of custom amount. If a value is entered for customAmountValue, then customAmountLabel cannot be empty.
|
258
|
+
object_of :customAmountValue, Float
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
# Invoice details about the invoice status and state change dates.
|
265
|
+
class InvoiceDetailsType < DataType
|
266
|
+
def self.load_members
|
267
|
+
# Status of the invoice.
|
268
|
+
object_of :status, StatusType, :required => true
|
269
|
+
# The total amount of the invoice (cost of items, shipping and tax, less any discount). This field is set by the invoicing system and will ignore any changes made by API callers.
|
270
|
+
object_of :totalAmount, Float
|
271
|
+
# Whether the invoice was created via the website or via an API call.
|
272
|
+
object_of :origin, OriginType, :required => true
|
273
|
+
# Date when the invoice was created.
|
274
|
+
object_of :createdDate, DateTime, :required => true
|
275
|
+
# Account that created the invoice.
|
276
|
+
object_of :createdBy, String
|
277
|
+
# If canceled, date when the invoice was canceled.
|
278
|
+
object_of :canceledDate, DateTime
|
279
|
+
# Actor who canceled the invoice.
|
280
|
+
object_of :canceledByActor, ActorType
|
281
|
+
# Account that canceled the invoice.
|
282
|
+
object_of :canceledBy, String
|
283
|
+
# Date when the invoice was last edited.
|
284
|
+
object_of :lastUpdatedDate, DateTime
|
285
|
+
# Account that last edited the invoice.
|
286
|
+
object_of :lastUpdatedBy, String
|
287
|
+
# Date when the invoice was first sent.
|
288
|
+
object_of :firstSentDate, DateTime
|
289
|
+
# Date when the invoice was last sent.
|
290
|
+
object_of :lastSentDate, DateTime
|
291
|
+
# Account that last sent the invoice.
|
292
|
+
object_of :lastSentBy, String
|
293
|
+
# If the invoice was paid, date when the invoice was paid.
|
294
|
+
object_of :paidDate, DateTime
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
# Details of the refund made against this invoice.
|
301
|
+
class OtherPaymentRefundDetailsType < DataType
|
302
|
+
def self.load_members
|
303
|
+
# Optional note associated with the refund.
|
304
|
+
object_of :note, String
|
305
|
+
# Date when the invoice was marked as refunded. If the date is not specified, the current date and time is used as a default. In addition, the date must be after the payment date of the invoice.
|
306
|
+
object_of :date, DateTime
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
# Details of the paypal refund made against this invoice.
|
313
|
+
class PayPalPaymentRefundDetailsType < DataType
|
314
|
+
def self.load_members
|
315
|
+
# Date when the invoice was marked as refunded by PayPal.
|
316
|
+
object_of :date, DateTime
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
# PayPal payment details about the invoice.
|
323
|
+
class PayPalPaymentDetailsType < DataType
|
324
|
+
def self.load_members
|
325
|
+
# Transaction ID of the PayPal payment.
|
326
|
+
object_of :transactionID, String, :required => true
|
327
|
+
# Date when the invoice was paid.
|
328
|
+
object_of :date, DateTime
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
# Offline payment details about the invoice.
|
335
|
+
class OtherPaymentDetailsType < DataType
|
336
|
+
def self.load_members
|
337
|
+
# Method used for the offline payment.
|
338
|
+
object_of :method, PaymentMethodsType
|
339
|
+
# Optional note associated with the payment.
|
340
|
+
object_of :note, String
|
341
|
+
# Date when the invoice was paid.
|
342
|
+
object_of :date, DateTime
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
# Payment details about the invoice.
|
349
|
+
class PaymentDetailsType < DataType
|
350
|
+
def self.load_members
|
351
|
+
# True if the invoice was paid using PayPal.
|
352
|
+
object_of :viaPayPal, Boolean, :required => true
|
353
|
+
# PayPal payment details.
|
354
|
+
object_of :paypalPayment, PayPalPaymentDetailsType
|
355
|
+
# Other payment details.
|
356
|
+
object_of :otherPayment, OtherPaymentDetailsType
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
# Determines an inclusive date range.
|
363
|
+
class DateRangeType < DataType
|
364
|
+
def self.load_members
|
365
|
+
# Start of the date range.
|
366
|
+
object_of :startDate, DateTime
|
367
|
+
# End of the date range.
|
368
|
+
object_of :endDate, DateTime
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
# Search parameters criteria.
|
375
|
+
class SearchParametersType < DataType
|
376
|
+
def self.load_members
|
377
|
+
# Email search string.
|
378
|
+
object_of :email, String
|
379
|
+
# Recipient search string.
|
380
|
+
object_of :recipientName, String
|
381
|
+
# Company search string.
|
382
|
+
object_of :businessName, String
|
383
|
+
# Invoice number search string.
|
384
|
+
object_of :invoiceNumber, String
|
385
|
+
# Invoice status search.
|
386
|
+
array_of :status, StatusType
|
387
|
+
# Invoice amount search. Specifies the smallest amount to be returned.
|
388
|
+
object_of :lowerAmount, Float
|
389
|
+
# Invoice amount search. Specifies the largest amount to be returned.
|
390
|
+
object_of :upperAmount, Float
|
391
|
+
# Currency used for lower and upper amounts. Required when lowerAmount or upperAmount is specified.
|
392
|
+
object_of :currencyCode, String
|
393
|
+
# Invoice memo search string.
|
394
|
+
object_of :memo, String
|
395
|
+
# Whether the invoice was created via the website or via an API call.
|
396
|
+
object_of :origin, OriginType
|
397
|
+
# Invoice date range filter.
|
398
|
+
object_of :invoiceDate, DateRangeType
|
399
|
+
# Invoice due date range filter.
|
400
|
+
object_of :dueDate, DateRangeType
|
401
|
+
# Invoice payment date range filter.
|
402
|
+
object_of :paymentDate, DateRangeType
|
403
|
+
# Invoice creation date range filter.
|
404
|
+
object_of :creationDate, DateRangeType
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
# Summary of invoice information.
|
411
|
+
class InvoiceSummaryType < DataType
|
412
|
+
def self.load_members
|
413
|
+
# The created invoice's ID.
|
414
|
+
object_of :invoiceID, String, :required => true
|
415
|
+
# Invoice creator's email.
|
416
|
+
object_of :merchantEmail, String, :required => true
|
417
|
+
# Email to which the invoice will be sent.
|
418
|
+
object_of :payerEmail, String, :required => true
|
419
|
+
# Unique identifier for the invoice.
|
420
|
+
object_of :number, String, :required => true
|
421
|
+
# Business name of the billing info.
|
422
|
+
object_of :billingBusinessName, String
|
423
|
+
# First name of the billing info.
|
424
|
+
object_of :billingFirstName, String
|
425
|
+
# Last name of the billing info.
|
426
|
+
object_of :billingLastName, String
|
427
|
+
# Business name of the shipping info.
|
428
|
+
object_of :shippingBusinessName, String
|
429
|
+
# First name of the shipping info.
|
430
|
+
object_of :shippingFirstName, String
|
431
|
+
# Last name of the shipping info.
|
432
|
+
object_of :shippingLastName, String
|
433
|
+
# Total amount of the invoice.
|
434
|
+
object_of :totalAmount, Float, :required => true
|
435
|
+
# Currency used for all invoice item amounts and totals.
|
436
|
+
object_of :currencyCode, String, :required => true
|
437
|
+
# Date on which the invoice will be enabled.
|
438
|
+
object_of :invoiceDate, DateTime, :required => true
|
439
|
+
# Date on which the invoice payment is due.
|
440
|
+
object_of :dueDate, DateTime, :required => true
|
441
|
+
# Status of the invoice.
|
442
|
+
object_of :status, StatusType, :required => true
|
443
|
+
# Whether the invoice was created via the website or via an API call.
|
444
|
+
object_of :origin, OriginType, :required => true
|
445
|
+
# BN code for tracking transactions with a particular partner.
|
446
|
+
object_of :referrerCode, String
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
# A list of invoice summaries.
|
453
|
+
class InvoiceSummaryListType < DataType
|
454
|
+
def self.load_members
|
455
|
+
array_of :invoice, InvoiceSummaryType
|
456
|
+
end
|
457
|
+
end
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
# The request object for CreateInvoice.
|
462
|
+
class CreateInvoiceRequest < DataType
|
463
|
+
def self.load_members
|
464
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
465
|
+
# Data to populate the newly created invoice.
|
466
|
+
object_of :invoice, InvoiceType, :required => true
|
467
|
+
end
|
468
|
+
end
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
# The response object for CreateInvoice.
|
473
|
+
class CreateInvoiceResponse < DataType
|
474
|
+
def self.load_members
|
475
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
476
|
+
# The created invoice's ID.
|
477
|
+
object_of :invoiceID, String, :required => true
|
478
|
+
# The created invoice's number.
|
479
|
+
object_of :invoiceNumber, String, :required => true
|
480
|
+
# The URL which lead merchant to view the invoice details on web.
|
481
|
+
object_of :invoiceURL, String, :required => true
|
482
|
+
# The total amount of the invoice (cost of items, shipping and tax, less any discount).
|
483
|
+
object_of :totalAmount, Integer, :required => true
|
484
|
+
array_of :error, ErrorData
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
# The request object for SendInvoice.
|
491
|
+
class SendInvoiceRequest < DataType
|
492
|
+
def self.load_members
|
493
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
494
|
+
# ID of the invoice to send.
|
495
|
+
object_of :invoiceID, String, :required => true
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
# The response object for SendInvoice.
|
502
|
+
class SendInvoiceResponse < DataType
|
503
|
+
def self.load_members
|
504
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
505
|
+
# The sent invoice's ID.
|
506
|
+
object_of :invoiceID, String, :required => true
|
507
|
+
# The URL which lead merchant to view the invoice details on web.
|
508
|
+
object_of :invoiceURL, String, :required => true
|
509
|
+
array_of :error, ErrorData
|
510
|
+
end
|
511
|
+
end
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
# The request object for CreateAndSendInvoice.
|
516
|
+
class CreateAndSendInvoiceRequest < DataType
|
517
|
+
def self.load_members
|
518
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
519
|
+
# Data to populate the newly created invoice.
|
520
|
+
object_of :invoice, InvoiceType, :required => true
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
# The response object for CreateAndSendInvoice.
|
527
|
+
class CreateAndSendInvoiceResponse < DataType
|
528
|
+
def self.load_members
|
529
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
530
|
+
# The created invoice's ID.
|
531
|
+
object_of :invoiceID, String, :required => true
|
532
|
+
# The created invoice's number.
|
533
|
+
object_of :invoiceNumber, String, :required => true
|
534
|
+
# The URL which lead merchant to view the invoice details on web.
|
535
|
+
object_of :invoiceURL, String, :required => true
|
536
|
+
# The total amount of the invoice (cost of items, shipping and tax, less any discount).
|
537
|
+
object_of :totalAmount, Integer, :required => true
|
538
|
+
array_of :error, ErrorData
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
# The request object for UpdateInvoice.
|
545
|
+
class UpdateInvoiceRequest < DataType
|
546
|
+
def self.load_members
|
547
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
548
|
+
# invoice's ID
|
549
|
+
object_of :invoiceID, String, :required => true
|
550
|
+
# Data to populate the newly created invoice.
|
551
|
+
object_of :invoice, InvoiceType, :required => true
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
# The response object for UpdateInvoice.
|
558
|
+
class UpdateInvoiceResponse < DataType
|
559
|
+
def self.load_members
|
560
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
561
|
+
# The invoice's ID.
|
562
|
+
object_of :invoiceID, String, :required => true
|
563
|
+
# The updated invoice's number.
|
564
|
+
object_of :invoiceNumber, String, :required => true
|
565
|
+
# The URL which lead merchant to view the invoice details on web.
|
566
|
+
object_of :invoiceURL, String, :required => true
|
567
|
+
# The total amount of the invoice (cost of items, shipping and tax, less any discount).
|
568
|
+
object_of :totalAmount, Integer, :required => true
|
569
|
+
array_of :error, ErrorData
|
570
|
+
end
|
571
|
+
end
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
# The request object for GetInvoiceDetails.
|
576
|
+
class GetInvoiceDetailsRequest < DataType
|
577
|
+
def self.load_members
|
578
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
579
|
+
# ID of the invoice to retrieve.
|
580
|
+
object_of :invoiceID, String, :required => true
|
581
|
+
end
|
582
|
+
end
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
# The response object for CreateInvoice.
|
587
|
+
class GetInvoiceDetailsResponse < DataType
|
588
|
+
def self.load_members
|
589
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
590
|
+
# The requested invoice.
|
591
|
+
object_of :invoice, InvoiceType, :required => true
|
592
|
+
# The requested invoice details.
|
593
|
+
object_of :invoiceDetails, InvoiceDetailsType, :required => true
|
594
|
+
# The requested invoice payment details.
|
595
|
+
object_of :paymentDetails, PaymentDetailsType
|
596
|
+
# The requested invoice refund details.
|
597
|
+
object_of :refundDetails, PaymentRefundDetailsType
|
598
|
+
# The URL which lead merchant to view the invoice details on web.
|
599
|
+
object_of :invoiceURL, String, :required => true
|
600
|
+
array_of :error, ErrorData
|
601
|
+
end
|
602
|
+
end
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
# The request object for CancelInvoice.
|
607
|
+
class CancelInvoiceRequest < DataType
|
608
|
+
def self.load_members
|
609
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
610
|
+
# invoice's ID
|
611
|
+
object_of :invoiceID, String
|
612
|
+
# Subject of the cancellation notification
|
613
|
+
object_of :subject, String
|
614
|
+
# Note to send payer within the cancellation notification
|
615
|
+
object_of :noteForPayer, String
|
616
|
+
# send a copy of cancellation notification to merchant
|
617
|
+
object_of :sendCopyToMerchant, Boolean
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
# The response object for CancelInvoice.
|
624
|
+
class CancelInvoiceResponse < DataType
|
625
|
+
def self.load_members
|
626
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
627
|
+
# The canceled invoice's ID.
|
628
|
+
object_of :invoiceID, String, :required => true
|
629
|
+
# The canceled invoice's number.
|
630
|
+
object_of :invoiceNumber, String, :required => true
|
631
|
+
# The URL which lead merchant to view the invoice details on web.
|
632
|
+
object_of :invoiceURL, String, :required => true
|
633
|
+
array_of :error, ErrorData
|
634
|
+
end
|
635
|
+
end
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
# The request object for SearchInvoices.
|
640
|
+
class SearchInvoicesRequest < DataType
|
641
|
+
def self.load_members
|
642
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
643
|
+
# Invoice creator's email.
|
644
|
+
object_of :merchantEmail, String, :required => true
|
645
|
+
# Parameters constraining the search.
|
646
|
+
object_of :parameters, SearchParametersType, :required => true
|
647
|
+
# Page number of result set, starting with 1.
|
648
|
+
object_of :page, Integer, :required => true
|
649
|
+
# Number of results per page, between 1 and 100.
|
650
|
+
object_of :pageSize, Integer, :required => true
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
# The response object for SearchInvoices.
|
657
|
+
class SearchInvoicesResponse < DataType
|
658
|
+
def self.load_members
|
659
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
660
|
+
# Number of invoices that matched the search.
|
661
|
+
object_of :count, Integer, :required => true
|
662
|
+
# Page of invoice summaries that matched the search.
|
663
|
+
object_of :invoiceList, InvoiceSummaryListType
|
664
|
+
# Page number of result set.
|
665
|
+
object_of :page, Integer, :required => true
|
666
|
+
# True if another page of invoice summary results exists.
|
667
|
+
object_of :hasNextPage, Boolean, :required => true
|
668
|
+
# True if a previous page of invoice summary results exists.
|
669
|
+
object_of :hasPreviousPage, Boolean, :required => true
|
670
|
+
array_of :error, ErrorData
|
671
|
+
end
|
672
|
+
end
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
# The request object for MarkInvoiceAsPaid.
|
677
|
+
class MarkInvoiceAsPaidRequest < DataType
|
678
|
+
def self.load_members
|
679
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
680
|
+
# ID of the invoice to mark as paid.
|
681
|
+
object_of :invoiceID, String, :required => true
|
682
|
+
# Details of the payment made against this invoice.
|
683
|
+
object_of :payment, OtherPaymentDetailsType, :required => true
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
|
688
|
+
|
689
|
+
# The response object for MarkInvoiceAsPaid.
|
690
|
+
class MarkInvoiceAsPaidResponse < DataType
|
691
|
+
def self.load_members
|
692
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
693
|
+
# The paid invoice ID.
|
694
|
+
object_of :invoiceID, String, :required => true
|
695
|
+
# The paid invoice number.
|
696
|
+
object_of :invoiceNumber, String, :required => true
|
697
|
+
# The URL which lead merchant to view the invoice details on web.
|
698
|
+
object_of :invoiceURL, String, :required => true
|
699
|
+
array_of :error, ErrorData
|
700
|
+
end
|
701
|
+
end
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
# The request object for MarkInvoiceAsRefunded.
|
706
|
+
class MarkInvoiceAsRefundedRequest < DataType
|
707
|
+
def self.load_members
|
708
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
709
|
+
# ID of the invoice to mark as refunded.
|
710
|
+
object_of :invoiceID, String, :required => true
|
711
|
+
# Details of the refund made against this invoice.
|
712
|
+
object_of :refundDetail, OtherPaymentRefundDetailsType, :required => true
|
713
|
+
end
|
714
|
+
end
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
# The response object for MarkInvoiceAsRefunded.
|
719
|
+
class MarkInvoiceAsRefundedResponse < DataType
|
720
|
+
def self.load_members
|
721
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
722
|
+
# The invoice ID of the invoice that was marked as refunded.
|
723
|
+
object_of :invoiceID, String, :required => true
|
724
|
+
# The invoice number of the invoice that was marked as refunded.
|
725
|
+
object_of :invoiceNumber, String, :required => true
|
726
|
+
# The URL of the details page of the invoice that was marked as refunded.
|
727
|
+
object_of :invoiceURL, String, :required => true
|
728
|
+
array_of :error, ErrorData
|
729
|
+
end
|
730
|
+
end
|
731
|
+
|
732
|
+
|
733
|
+
|
734
|
+
# The request object for MarkInvoiceAsUnpaid.
|
735
|
+
class MarkInvoiceAsUnpaidRequest < DataType
|
736
|
+
def self.load_members
|
737
|
+
object_of :requestEnvelope, RequestEnvelope, :required => true
|
738
|
+
# ID of the invoice to mark as unpaid.
|
739
|
+
object_of :invoiceID, String, :required => true
|
740
|
+
end
|
741
|
+
end
|
742
|
+
|
743
|
+
|
744
|
+
|
745
|
+
# The response object for MarkInvoiceAsUnpaid.
|
746
|
+
class MarkInvoiceAsUnpaidResponse < DataType
|
747
|
+
def self.load_members
|
748
|
+
object_of :responseEnvelope, ResponseEnvelope, :required => true
|
749
|
+
# The invoice ID of the invoice that was marked as unpaid.
|
750
|
+
object_of :invoiceID, String, :required => true
|
751
|
+
# The invoice number of the invoice that was marked as unpaid.
|
752
|
+
object_of :invoiceNumber, String, :required => true
|
753
|
+
# The URL of the details page of the invoice that was marked as unpaid.
|
754
|
+
object_of :invoiceURL, String, :required => true
|
755
|
+
array_of :error, ErrorData
|
756
|
+
end
|
757
|
+
end
|
758
|
+
|
759
|
+
|
760
|
+
|
761
|
+
# Payment refund details about the invoice.
|
762
|
+
class PaymentRefundDetailsType < DataType
|
763
|
+
def self.load_members
|
764
|
+
# True if the invoice was refunded using PayPal.
|
765
|
+
object_of :viaPayPal, Boolean, :required => true
|
766
|
+
# Other payment refund details.
|
767
|
+
object_of :paypalPayment, PayPalPaymentRefundDetailsType
|
768
|
+
# details.
|
769
|
+
object_of :otherPayment, OtherPaymentRefundDetailsType
|
770
|
+
end
|
771
|
+
end
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
|
777
|
+
constants.each do |data_type_klass|
|
778
|
+
data_type_klass = const_get(data_type_klass)
|
779
|
+
data_type_klass.load_members if defined? data_type_klass.load_members
|
780
|
+
end
|
781
|
+
|
782
|
+
end
|
783
|
+
end
|
784
|
+
end
|