paypal-payment 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/Gemfile +18 -0
- data/Guardfile +24 -0
- data/README.rdoc +107 -0
- data/Rakefile +5 -0
- data/docs/AdaptivePayments.rdoc +84 -0
- data/docs/PP_NVPAPI_DeveloperGuide.pdf +0 -0
- data/docs/PP_WPP_IntegrationGuide.pdf +0 -0
- data/docs/adaptive_payments.md +55 -0
- data/docs/api.txt +67 -0
- data/docs/design.txt +38 -0
- data/docs/express_checkout.md +172 -0
- data/docs/requirements.txt +32 -0
- data/lib/paypal-payment.rb +10 -0
- data/lib/paypal/adaptive_payments.rb +31 -0
- data/lib/paypal/adaptive_payments/api.rb +51 -0
- data/lib/paypal/adaptive_payments/base.rb +11 -0
- data/lib/paypal/adaptive_payments/client_details.rb +14 -0
- data/lib/paypal/adaptive_payments/display_options.rb +10 -0
- data/lib/paypal/adaptive_payments/funding_constraint.rb +11 -0
- data/lib/paypal/adaptive_payments/funding_type_info.rb +8 -0
- data/lib/paypal/adaptive_payments/funding_type_list.rb +11 -0
- data/lib/paypal/adaptive_payments/initiating_entity.rb +11 -0
- data/lib/paypal/adaptive_payments/institution_customer.rb +13 -0
- data/lib/paypal/adaptive_payments/invoice_data.rb +13 -0
- data/lib/paypal/adaptive_payments/invoice_item.rb +11 -0
- data/lib/paypal/adaptive_payments/payment.rb +105 -0
- data/lib/paypal/adaptive_payments/payment_info.rb +18 -0
- data/lib/paypal/adaptive_payments/payment_info_list.rb +11 -0
- data/lib/paypal/adaptive_payments/payment_options.rb +39 -0
- data/lib/paypal/adaptive_payments/phone.rb +9 -0
- data/lib/paypal/adaptive_payments/preapproval.rb +52 -0
- data/lib/paypal/adaptive_payments/receiver.rb +17 -0
- data/lib/paypal/adaptive_payments/receiver_list.rb +49 -0
- data/lib/paypal/adaptive_payments/receiver_options.rb +19 -0
- data/lib/paypal/adaptive_payments/request.rb +51 -0
- data/lib/paypal/adaptive_payments/response.rb +38 -0
- data/lib/paypal/adaptive_payments/response/address.rb +13 -0
- data/lib/paypal/adaptive_payments/response/address_list.rb +11 -0
- data/lib/paypal/adaptive_payments/response/base_address.rb +13 -0
- data/lib/paypal/adaptive_payments/response/details.rb +19 -0
- data/lib/paypal/adaptive_payments/response/error_list.rb +15 -0
- data/lib/paypal/adaptive_payments/response/pay.rb +31 -0
- data/lib/paypal/adaptive_payments/response/pay_error.rb +16 -0
- data/lib/paypal/adaptive_payments/response/pay_error_list.rb +15 -0
- data/lib/paypal/adaptive_payments/response/pay_options.rb +7 -0
- data/lib/paypal/adaptive_payments/response/preapproval.rb +47 -0
- data/lib/paypal/adaptive_payments/response/refund.rb +16 -0
- data/lib/paypal/adaptive_payments/response/refund_info.rb +24 -0
- data/lib/paypal/adaptive_payments/response/refund_info_list.rb +11 -0
- data/lib/paypal/adaptive_payments/response/shipping_address.rb +11 -0
- data/lib/paypal/adaptive_payments/sender_identifier.rb +7 -0
- data/lib/paypal/adaptive_payments/sender_options.rb +8 -0
- data/lib/paypal/api.rb +94 -0
- data/lib/paypal/cacert.pem +3987 -0
- data/lib/paypal/common.rb +11 -0
- data/lib/paypal/common/base.rb +83 -0
- data/lib/paypal/common/error_data.rb +15 -0
- data/lib/paypal/common/request.rb +45 -0
- data/lib/paypal/common/request_envelope.rb +13 -0
- data/lib/paypal/common/response.rb +34 -0
- data/lib/paypal/common/response_envelope.rb +19 -0
- data/lib/paypal/express_checkout.rb +19 -0
- data/lib/paypal/express_checkout/account.rb +16 -0
- data/lib/paypal/express_checkout/api.rb +43 -0
- data/lib/paypal/express_checkout/base.rb +37 -0
- data/lib/paypal/express_checkout/billing.rb +7 -0
- data/lib/paypal/express_checkout/callback.rb +17 -0
- data/lib/paypal/express_checkout/checkout.rb +144 -0
- data/lib/paypal/express_checkout/fields.rb +449 -0
- data/lib/paypal/express_checkout/fmf.rb +7 -0
- data/lib/paypal/express_checkout/payment.rb +76 -0
- data/lib/paypal/express_checkout/payment_item.rb +7 -0
- data/lib/paypal/express_checkout/recurring.rb +131 -0
- data/lib/paypal/express_checkout/request.rb +212 -0
- data/lib/paypal/express_checkout/response.rb +52 -0
- data/lib/paypal/express_checkout/response/account.rb +30 -0
- data/lib/paypal/express_checkout/response/address.rb +29 -0
- data/lib/paypal/express_checkout/response/authorization.rb +25 -0
- data/lib/paypal/express_checkout/response/base.rb +125 -0
- data/lib/paypal/express_checkout/response/callback_request.rb +10 -0
- data/lib/paypal/express_checkout/response/callback_response.rb +8 -0
- data/lib/paypal/express_checkout/response/capture.rb +14 -0
- data/lib/paypal/express_checkout/response/checkout.rb +11 -0
- data/lib/paypal/express_checkout/response/details.rb +35 -0
- data/lib/paypal/express_checkout/response/manage_profile.rb +9 -0
- data/lib/paypal/express_checkout/response/notification.rb +85 -0
- data/lib/paypal/express_checkout/response/payment.rb +24 -0
- data/lib/paypal/express_checkout/response/profile.rb +58 -0
- data/lib/paypal/express_checkout/response/reference.rb +11 -0
- data/lib/paypal/express_checkout/response/refund.rb +13 -0
- data/lib/paypal/express_checkout/response/search.rb +33 -0
- data/lib/paypal/express_checkout/response/transaction_details.rb +11 -0
- data/lib/paypal/express_checkout/shipping_option.rb +7 -0
- data/lib/paypal/express_checkout/utils.rb +26 -0
- data/lib/paypal/express_checkout/version.rb +10 -0
- data/lib/paypal/invoice.rb +22 -0
- data/lib/paypal/invoice/api.rb +51 -0
- data/lib/paypal/invoice/base.rb +11 -0
- data/lib/paypal/invoice/base_address.rb +11 -0
- data/lib/paypal/invoice/business_info.rb +17 -0
- data/lib/paypal/invoice/date_range.rb +8 -0
- data/lib/paypal/invoice/invoice.rb +117 -0
- data/lib/paypal/invoice/invoice_details.rb +38 -0
- data/lib/paypal/invoice/invoice_item.rb +13 -0
- data/lib/paypal/invoice/invoice_item_list.rb +10 -0
- data/lib/paypal/invoice/invoice_summary.rb +22 -0
- data/lib/paypal/invoice/invoice_summary_list.rb +10 -0
- data/lib/paypal/invoice/other_payment_details.rb +13 -0
- data/lib/paypal/invoice/payment_details.rb +16 -0
- data/lib/paypal/invoice/paypal_payment_details.rb +11 -0
- data/lib/paypal/invoice/request.rb +43 -0
- data/lib/paypal/invoice/response.rb +27 -0
- data/lib/paypal/invoice/response/details.rb +23 -0
- data/lib/paypal/invoice/response/invoice.rb +10 -0
- data/lib/paypal/invoice/response/search.rb +15 -0
- data/lib/paypal/invoice/search.rb +19 -0
- data/lib/paypal/invoice/search_parameters.rb +20 -0
- data/lib/paypal/permissions.rb +12 -0
- data/lib/paypal/permissions/api.rb +60 -0
- data/lib/paypal/permissions/base.rb +11 -0
- data/lib/paypal/permissions/permission.rb +33 -0
- data/lib/paypal/permissions/personal_data.rb +17 -0
- data/lib/paypal/permissions/request.rb +52 -0
- data/lib/paypal/permissions/response.rb +24 -0
- data/lib/paypal/permissions/response/permission.rb +14 -0
- data/lib/paypal/permissions/response/personal_data.rb +8 -0
- data/lib/paypal/permissions/response/token.rb +10 -0
- data/lib/paypal/permissions/token.rb +13 -0
- data/lib/paypal/recurring.rb +110 -0
- data/lib/paypal/request.rb +82 -0
- data/lib/paypal/version.rb +8 -0
- data/paypal-payment.gemspec +30 -0
- data/spec/fixtures/adaptive_payments/payment/create/failure.yml +62 -0
- data/spec/fixtures/adaptive_payments/payment/create/success.yml +58 -0
- data/spec/fixtures/adaptive_payments/payment/details/success.yml +113 -0
- data/spec/fixtures/adaptive_payments/payment/pay/failure.yml +62 -0
- data/spec/fixtures/adaptive_payments/payment/pay/preapproval.yml +58 -0
- data/spec/fixtures/adaptive_payments/payment/pay/success.yml +58 -0
- data/spec/fixtures/adaptive_payments/payment/pay/with_pay_key.yml +58 -0
- data/spec/fixtures/adaptive_payments/payment/refund/failure.yml +62 -0
- data/spec/fixtures/adaptive_payments/payment/refund/success.yml +58 -0
- data/spec/fixtures/adaptive_payments/payment/shipping_addresses/success.yml +113 -0
- data/spec/fixtures/adaptive_payments/payment_options/get/success.yml +174 -0
- data/spec/fixtures/adaptive_payments/payment_options/set/success.yml +113 -0
- data/spec/fixtures/adaptive_payments/preapproval/create/success.yml +58 -0
- data/spec/fixtures/adaptive_payments/preapproval/details/success.yml +168 -0
- data/spec/fixtures/express_checkout/account/balance/success.yml +32 -0
- data/spec/fixtures/express_checkout/account/pal_details/success.yml +32 -0
- data/spec/fixtures/express_checkout/checkout/checkout/sales/success.yml +61 -0
- data/spec/fixtures/express_checkout/checkout/checkout/success.yml +32 -0
- data/spec/fixtures/express_checkout/checkout/details/failure.yml +32 -0
- data/spec/fixtures/express_checkout/checkout/details/success.yml +61 -0
- data/spec/fixtures/express_checkout/checkout/pay/sales/success.yml +61 -0
- data/spec/fixtures/express_checkout/checkout/pay/success.yml +61 -0
- data/spec/fixtures/express_checkout/payment/details/failure.yml +32 -0
- data/spec/fixtures/express_checkout/payment/details/success.yml +32 -0
- data/spec/fixtures/express_checkout/payment/refund/failure.yml +32 -0
- data/spec/fixtures/express_checkout/payment/refund/success.yml +32 -0
- data/spec/fixtures/express_checkout/payment/search/success.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/cancel/failure.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/cancel/success.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/checkout/success.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/create_profile/failure.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/create_profile/success.yml +61 -0
- data/spec/fixtures/express_checkout/recurring/profile/failure.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/profile/success.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/reactivate/failure.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/reactivate/success.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/suspend/failure.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/suspend/success.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/update_profile/failure.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/update_profile/profile.yml +32 -0
- data/spec/fixtures/express_checkout/recurring/update_profile/success.yml +32 -0
- data/spec/fixtures/invoice/cancel/success.yml +174 -0
- data/spec/fixtures/invoice/create/failure.yml +62 -0
- data/spec/fixtures/invoice/create/success.yml +60 -0
- data/spec/fixtures/invoice/create_and_send/failure.yml +62 -0
- data/spec/fixtures/invoice/create_and_send/success.yml +60 -0
- data/spec/fixtures/invoice/details/success.yml +117 -0
- data/spec/fixtures/invoice/mark_as_paid/failure.yml +180 -0
- data/spec/fixtures/invoice/mark_as_paid/success.yml +174 -0
- data/spec/fixtures/invoice/mark_as_refunded/success.yml +174 -0
- data/spec/fixtures/invoice/mark_as_unpaid/success.yml +231 -0
- data/spec/fixtures/invoice/search/success.yml +174 -0
- data/spec/fixtures/invoice/send/success.yml +117 -0
- data/spec/fixtures/invoice/update/failure.yml +119 -0
- data/spec/fixtures/invoice/update/success.yml +117 -0
- data/spec/fixtures/ipn/express_checkout.json +35 -0
- data/spec/fixtures/ipn/recurring_payment.json +44 -0
- data/spec/fixtures/ipn/recurring_payment_profile_created.json +31 -0
- data/spec/fixtures/ipn/recurring_payment_profile_created_with_initial_amount.json +33 -0
- data/spec/fixtures/ipn/recurring_payment_skipped.json +30 -0
- data/spec/fixtures/ipn/recurring_payment_with_initial_amount.json +44 -0
- data/spec/fixtures/notification/failure.yml +50 -0
- data/spec/fixtures/notification/success.yml +50 -0
- data/spec/paypal/adaptive_payments/api_spec.rb +20 -0
- data/spec/paypal/adaptive_payments/payment/base_spec.rb +28 -0
- data/spec/paypal/adaptive_payments/payment/create_spec.rb +63 -0
- data/spec/paypal/adaptive_payments/payment/details_spec.rb +34 -0
- data/spec/paypal/adaptive_payments/payment/pay_spec.rb +97 -0
- data/spec/paypal/adaptive_payments/payment/refund_spec.rb +49 -0
- data/spec/paypal/adaptive_payments/payment/shipping_addresses_spec.rb +30 -0
- data/spec/paypal/adaptive_payments/payment_options/get_spec.rb +33 -0
- data/spec/paypal/adaptive_payments/payment_options/set_spec.rb +66 -0
- data/spec/paypal/adaptive_payments/preapproval/cancel_spec.rb +34 -0
- data/spec/paypal/adaptive_payments/preapproval/create_spec.rb +39 -0
- data/spec/paypal/adaptive_payments/preapproval/details_spec.rb +34 -0
- data/spec/paypal/adaptive_payments/request_spec.rb +48 -0
- data/spec/paypal/api_spec.rb +78 -0
- data/spec/paypal/common/base_spec.rb +157 -0
- data/spec/paypal/common/error_data_spec.rb +0 -0
- data/spec/paypal/common/request_envelope_spec.rb +6 -0
- data/spec/paypal/common/response_spec.rb +0 -0
- data/spec/paypal/express_checkout/account/balance_spec.rb +25 -0
- data/spec/paypal/express_checkout/account/pal_details_spec.rb +20 -0
- data/spec/paypal/express_checkout/checkout/checkout_spec.rb +73 -0
- data/spec/paypal/express_checkout/checkout/details_spec.rb +70 -0
- data/spec/paypal/express_checkout/checkout/pay_spec.rb +68 -0
- data/spec/paypal/express_checkout/fields_spec.rb +138 -0
- data/spec/paypal/express_checkout/payment/refund_spec.rb +34 -0
- data/spec/paypal/express_checkout/payment/search_spec.rb +24 -0
- data/spec/paypal/express_checkout/payment/transaction_details_spec.rb +30 -0
- data/spec/paypal/express_checkout/payment_spec.rb +13 -0
- data/spec/paypal/express_checkout/recurring/create_profile_spec.rb +50 -0
- data/spec/paypal/express_checkout/recurring/manage_profile_spec.rb +62 -0
- data/spec/paypal/express_checkout/recurring/profile_spec.rb +44 -0
- data/spec/paypal/express_checkout/recurring/update_profile_spec.rb +50 -0
- data/spec/paypal/express_checkout/request_spec.rb +221 -0
- data/spec/paypal/express_checkout/response/account_spec.rb +33 -0
- data/spec/paypal/express_checkout/response/base_spec.rb +253 -0
- data/spec/paypal/invoice/cancel_spec.rb +38 -0
- data/spec/paypal/invoice/create_and_send_spec.rb +58 -0
- data/spec/paypal/invoice/create_spec.rb +58 -0
- data/spec/paypal/invoice/details_spec.rb +39 -0
- data/spec/paypal/invoice/mark_as_paid_spec.rb +75 -0
- data/spec/paypal/invoice/mark_as_refunded_spec.rb +47 -0
- data/spec/paypal/invoice/mark_as_unpaid_spec.rb +43 -0
- data/spec/paypal/invoice/search_spec.rb +70 -0
- data/spec/paypal/invoice/send_spec.rb +48 -0
- data/spec/paypal/invoice/update_spec.rb +72 -0
- data/spec/paypal/request_spec.rb +45 -0
- data/spec/spec_helper.rb +35 -0
- metadata +546 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
module PayPal
|
2
|
+
module ExpressCheckout
|
3
|
+
module Response
|
4
|
+
class Search < PayPal::ExpressCheckout::Response::Base
|
5
|
+
|
6
|
+
def payments
|
7
|
+
@payments ||= begin
|
8
|
+
index = 0
|
9
|
+
[].tap do |payments|
|
10
|
+
while params["L_TIMESTAMP#{index}"]
|
11
|
+
payments << PayPal::ExpressCheckout::Payment.new({
|
12
|
+
:timestamp => params["L_TIMESTAMP#{index}"],
|
13
|
+
:time_zone => params["L_TIMEZONE#{index}"],
|
14
|
+
:payment_type => params["L_TYPE#{index}"],
|
15
|
+
:email => params["L_EMAIL#{index}"],
|
16
|
+
:name => params["L_NAME#{index}"],
|
17
|
+
:transaction_id => params["L_TRANSACTIONID#{index}"],
|
18
|
+
:status => params["L_STATUS#{index}"],
|
19
|
+
:amount => params["L_AMT#{index}"].to_f,
|
20
|
+
:currency => params["L_CURRENCYCODE#{index}"],
|
21
|
+
:fee_amount => params["L_FEEAMT#{index}"].to_f,
|
22
|
+
:net_amount => params["L_NETAMT#{index}"].to_f
|
23
|
+
})
|
24
|
+
|
25
|
+
index += 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module PayPal
|
2
|
+
module ExpressCheckout
|
3
|
+
module Response
|
4
|
+
class TransactionDetails < Base
|
5
|
+
has_fields :payment, :amount, :gift, :survey, :receiver, :payer, :ship_to, :auction, :subscription
|
6
|
+
|
7
|
+
has_many :payment_items, :shipping_options
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module PayPal
|
2
|
+
module ExpressCheckout
|
3
|
+
module Utils
|
4
|
+
def convert_to_time(string)
|
5
|
+
DateTime.strptime(string, "%H:%M:%S %b %e, %Y %Z").new_offset(0)
|
6
|
+
end
|
7
|
+
|
8
|
+
def mapping(options = {})
|
9
|
+
options.each do |to, from|
|
10
|
+
class_eval <<-RUBY
|
11
|
+
def #{to}
|
12
|
+
@#{to} ||= begin
|
13
|
+
from = [#{from.inspect}].flatten
|
14
|
+
name = from.find {|name| params[name]}
|
15
|
+
value = nil
|
16
|
+
value = params[name] if name
|
17
|
+
value = send("build_#{to}", value) if respond_to?("build_#{to}", true)
|
18
|
+
value
|
19
|
+
end
|
20
|
+
end
|
21
|
+
RUBY
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module PayPal
|
2
|
+
module Invoice
|
3
|
+
end
|
4
|
+
end
|
5
|
+
|
6
|
+
require "paypal/invoice/api"
|
7
|
+
require "paypal/invoice/base"
|
8
|
+
require "paypal/invoice/response"
|
9
|
+
require "paypal/invoice/request"
|
10
|
+
require "paypal/invoice/base_address"
|
11
|
+
require "paypal/invoice/date_range"
|
12
|
+
require "paypal/invoice/search_parameters"
|
13
|
+
require "paypal/invoice/search"
|
14
|
+
require "paypal/invoice/business_info"
|
15
|
+
require "paypal/invoice/invoice_item"
|
16
|
+
require "paypal/invoice/invoice_item_list"
|
17
|
+
require "paypal/invoice/invoice"
|
18
|
+
require "paypal/invoice/invoice_details"
|
19
|
+
require "paypal/invoice/invoice_summary_list"
|
20
|
+
require "paypal/invoice/invoice_summary"
|
21
|
+
require "paypal/invoice/other_payment_details"
|
22
|
+
require "paypal/invoice/paypal_payment_details"
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module PayPal
|
2
|
+
module Invoice
|
3
|
+
class Api
|
4
|
+
|
5
|
+
API_ENDPOINTS = {
|
6
|
+
:sandbox => "https://svcs.sandbox.paypal.com/Invoice",
|
7
|
+
:production => "https://svcs.paypal.com/Invoice"
|
8
|
+
}
|
9
|
+
|
10
|
+
DATA_FORMATS = {
|
11
|
+
:nvp => 'NV',
|
12
|
+
:xml => 'XML',
|
13
|
+
:json => 'JSON'
|
14
|
+
}
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def username
|
18
|
+
PayPal::Api.instance.username
|
19
|
+
end
|
20
|
+
|
21
|
+
def password
|
22
|
+
PayPal::Api.instance.password
|
23
|
+
end
|
24
|
+
|
25
|
+
def signature
|
26
|
+
PayPal::Api.instance.signature
|
27
|
+
end
|
28
|
+
|
29
|
+
def app_id
|
30
|
+
PayPal::Api.instance.app_id
|
31
|
+
end
|
32
|
+
|
33
|
+
def environment
|
34
|
+
PayPal::Api.environment
|
35
|
+
end
|
36
|
+
|
37
|
+
def api_endpoint
|
38
|
+
API_ENDPOINTS[environment]
|
39
|
+
end
|
40
|
+
|
41
|
+
def request_data_format
|
42
|
+
DATA_FORMATS[:json]
|
43
|
+
end
|
44
|
+
|
45
|
+
def response_data_format
|
46
|
+
DATA_FORMATS[:json]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module PayPal::Invoice
|
2
|
+
class BusinessInfo < PayPal::Invoice::Base
|
3
|
+
|
4
|
+
attr_accessor :first_name
|
5
|
+
attr_accessor :last_name
|
6
|
+
attr_accessor :business_name
|
7
|
+
attr_accessor :phone
|
8
|
+
attr_accessor :fax
|
9
|
+
attr_accessor :website
|
10
|
+
attr_accessor :custom_value
|
11
|
+
attr_accessor :address
|
12
|
+
|
13
|
+
def set_address(value)
|
14
|
+
self.address = build_value(BaseAddress, value)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module PayPal::Invoice
|
2
|
+
class Invoice < PayPal::Invoice::Base
|
3
|
+
|
4
|
+
attr_accessor :merchant_email
|
5
|
+
attr_accessor :payer_email
|
6
|
+
attr_accessor :number
|
7
|
+
attr_accessor :merchant_info
|
8
|
+
attr_accessor :item_list
|
9
|
+
attr_accessor :currency_code
|
10
|
+
attr_accessor :invoice_date
|
11
|
+
attr_accessor :due_date
|
12
|
+
attr_accessor :payment_terms
|
13
|
+
attr_accessor :discount_percent
|
14
|
+
attr_accessor :discount_amount
|
15
|
+
attr_accessor :terms
|
16
|
+
attr_accessor :note
|
17
|
+
attr_accessor :merchant_memo
|
18
|
+
attr_accessor :billing_info
|
19
|
+
attr_accessor :shipping_info
|
20
|
+
attr_accessor :shipping_amount
|
21
|
+
attr_accessor :shipping_tax_name
|
22
|
+
attr_accessor :shipping_tax_rate
|
23
|
+
attr_accessor :logo_url
|
24
|
+
attr_accessor :referrer_code
|
25
|
+
attr_accessor :invoice_id
|
26
|
+
attr_accessor :subject
|
27
|
+
attr_accessor :note_for_payer
|
28
|
+
attr_accessor :send_copy_to_mechant
|
29
|
+
|
30
|
+
# mark_as_paid attribtues
|
31
|
+
attr_accessor :payment
|
32
|
+
|
33
|
+
# mark_as_refunded attribute
|
34
|
+
attr_accessor :refund_detail
|
35
|
+
|
36
|
+
attr_accessor :response
|
37
|
+
|
38
|
+
def hash_keys
|
39
|
+
{
|
40
|
+
:invoice_id => :invoiceID
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def set_merchant_info(value)
|
45
|
+
self.merchant_info = build_value(BusinessInfo, value)
|
46
|
+
end
|
47
|
+
|
48
|
+
def set_billing_info(value)
|
49
|
+
self.billing_info = build_value(BusinessInfo, value)
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_shipping_info(value)
|
53
|
+
self.shipping_info = build_value(BusinessInfo, value)
|
54
|
+
end
|
55
|
+
|
56
|
+
def set_item_list(value)
|
57
|
+
self.item_list = build_value(InvoiceItemList, value)
|
58
|
+
end
|
59
|
+
|
60
|
+
def set_invoice_date(value)
|
61
|
+
self.invoice_date = build_datetime(value)
|
62
|
+
end
|
63
|
+
|
64
|
+
def set_due_date(value)
|
65
|
+
self.due_date = build_datetime(value)
|
66
|
+
end
|
67
|
+
|
68
|
+
def set_payment(value)
|
69
|
+
self.payment = build_value(OtherPaymentDetails, value)
|
70
|
+
end
|
71
|
+
|
72
|
+
def set_refund_detail(value)
|
73
|
+
self.refund_detail = build_value(OtherPaymentDetails, value)
|
74
|
+
end
|
75
|
+
|
76
|
+
def create
|
77
|
+
self.response = Response.process(:create, request.run(:create, { :invoice => self.to_hash }))
|
78
|
+
self.invoice_id = self.response.invoice_id
|
79
|
+
self.response
|
80
|
+
end
|
81
|
+
|
82
|
+
def send_invoice
|
83
|
+
self.response = Response.process(:send, request.run(:send, self.to_hash(:invoice_id)))
|
84
|
+
end
|
85
|
+
|
86
|
+
def create_and_send
|
87
|
+
self.response = Response.process(:create_and_send, request.run(:create_and_send, { :invoice => self.to_hash }))
|
88
|
+
self.invoice_id = self.response.invoice_id
|
89
|
+
self.response
|
90
|
+
end
|
91
|
+
|
92
|
+
def update
|
93
|
+
self.response = Response.process(:update, request.run(:update, { :invoiceID => self.invoice_id, :invoice => self.to_hash}))
|
94
|
+
end
|
95
|
+
|
96
|
+
def cancel
|
97
|
+
self.response = Response.process(:cancel, request.run(:cancel, self.to_hash(:invoice_id)))
|
98
|
+
end
|
99
|
+
|
100
|
+
def details
|
101
|
+
self.response = Response.process(:details, request.run(:details, self.to_hash(:invoice_id)))
|
102
|
+
end
|
103
|
+
|
104
|
+
def mark_as_paid
|
105
|
+
self.response = Response.process(:mark_as_paid, request.run(:mark_as_paid, self.to_hash(:invoice_id, :payment)))
|
106
|
+
end
|
107
|
+
|
108
|
+
def mark_as_unpaid
|
109
|
+
self.response = Response.process(:mark_as_unpaid, request.run(:mark_as_unpaid, self.to_hash(:invoice_id)))
|
110
|
+
end
|
111
|
+
|
112
|
+
def mark_as_refunded
|
113
|
+
self.response = Response.process(:mark_as_refunded, request.run(:mark_as_refunded, self.to_hash(:invoice_id, :refund_detail)))
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module PayPal::Invoice
|
2
|
+
class InvoiceDetails < PayPal::Invoice::Base
|
3
|
+
attr_accessor :status
|
4
|
+
attr_accessor :total_amount
|
5
|
+
attr_accessor :origin
|
6
|
+
attr_accessor :created_date
|
7
|
+
attr_accessor :created_by
|
8
|
+
attr_accessor :canceled_date
|
9
|
+
attr_accessor :canceled_by_actor
|
10
|
+
attr_accessor :canceled_by
|
11
|
+
attr_accessor :last_updated_date
|
12
|
+
attr_accessor :last_updated_by
|
13
|
+
attr_accessor :first_sent_date
|
14
|
+
attr_accessor :last_sent_date
|
15
|
+
attr_accessor :last_sent_by
|
16
|
+
attr_accessor :paid_date
|
17
|
+
|
18
|
+
def set_created_date(value)
|
19
|
+
self.created_date = build_datetime(value)
|
20
|
+
end
|
21
|
+
|
22
|
+
def set_canceled_date(value)
|
23
|
+
self.canceled_date = build_datetime(value)
|
24
|
+
end
|
25
|
+
|
26
|
+
def set_last_updated_date(value)
|
27
|
+
self.last_updated_date = build_datetime(value)
|
28
|
+
end
|
29
|
+
|
30
|
+
def set_first_sent_date(value)
|
31
|
+
self.first_sent_date = build_datetime(value)
|
32
|
+
end
|
33
|
+
|
34
|
+
def set_last_sent_date(value)
|
35
|
+
self.last_sent_date = build_datetime(value)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module PayPal::Invoice
|
2
|
+
class InvoiceItem < PayPal::Invoice::Base
|
3
|
+
|
4
|
+
attr_accessor :name
|
5
|
+
attr_accessor :description
|
6
|
+
attr_accessor :date
|
7
|
+
attr_accessor :quantity
|
8
|
+
attr_accessor :unit_price
|
9
|
+
attr_accessor :tax_name
|
10
|
+
attr_accessor :tax_rate
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module PayPal::Invoice
|
2
|
+
class InvoiceSummary < PayPal::Invoice::Base
|
3
|
+
|
4
|
+
attr_accessor :invoice_id
|
5
|
+
attr_accessor :merchant_email
|
6
|
+
attr_accessor :payer_email
|
7
|
+
attr_accessor :number
|
8
|
+
attr_accessor :currency_code
|
9
|
+
attr_accessor :billing_business_name
|
10
|
+
attr_accessor :billing_first_name
|
11
|
+
attr_accessor :billing_last_name
|
12
|
+
attr_accessor :shipping_business_name
|
13
|
+
attr_accessor :shipping_first_name
|
14
|
+
attr_accessor :shipping_last_name
|
15
|
+
attr_accessor :total_amount
|
16
|
+
attr_accessor :invoice_date
|
17
|
+
attr_accessor :due_date
|
18
|
+
attr_accessor :status
|
19
|
+
attr_accessor :origin
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|