class PayPal::SDK::REST::DataTypes::Invoice
Public Class Methods
find(resource_id, access_token = nil)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1295 def find(resource_id, access_token = nil) raise ArgumentError.new("id required") if resource_id.to_s.strip.empty? path = "v1/invoicing/invoices/#{resource_id}" api.token = access_token unless access_token.nil? self.new(api.get(path)) end
generate_number(options)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1313 def self.generate_number(options) path = "v1/invoicing/invoices/next-invoice-number" response = api.post(path, options) object.new(response) end
get_all(options = {}, access_token = nil)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1302 def get_all(options = {}, access_token = nil) path = "v1/invoicing/invoices/" api.token = access_token unless access_token.nil? Invoices.new(api.get(path, options)) end
load_members()
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1184 def self.load_members object_of :id, String object_of :number, String object_of :template_id, String object_of :uri, String object_of :status, String object_of :merchant_info, MerchantInfo array_of :billing_info, BillingInfo array_of :cc_info, Participant object_of :shipping_info, ShippingInfo array_of :items, InvoiceItem object_of :invoice_date, String object_of :payment_term, PaymentTerm object_of :reference, String object_of :discount, Cost object_of :shipping_cost, ShippingCost object_of :custom, CustomAmount object_of :allow_partial_payment, Boolean object_of :minimum_amount_due, Currency object_of :tax_calculated_after_discount, Boolean object_of :tax_inclusive, Boolean object_of :terms, String object_of :note, String object_of :merchant_memo, String object_of :logo_url, String object_of :total_amount, Currency array_of :payments, PaymentDetail array_of :refunds, RefundDetail object_of :metadata, Metadata object_of :additional_data, String object_of :gratuity, Currency object_of :paid_amount, PaymentSummary object_of :refunded_amount, PaymentSummary array_of :attachments, FileAttachment array_of :links, Links end
qr_code(options = {})
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1308 def qr_code(options = {}) path = "v1/invoicing/invoices/{invoice_id}/qr-code" object.new(api.get(path, options)) end
search(options, access_token = nil)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1288 def search(options, access_token = nil) path = "v1/invoicing/search" api.token = access_token unless access_token.nil? response = api.post(path, options) Invoices.new(response) end
Public Instance Methods
cancel(cancel_notification)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1245 def cancel(cancel_notification) cancel_notification = CancelNotification.new(cancel_notification) unless cancel_notification.is_a? CancelNotification path = "v1/invoicing/invoices/#{self.id}/cancel" response = api.post(path, cancel_notification.to_hash, http_header) self.merge!(response) success? end
create()
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1223 def create() path = "v1/invoicing/invoices" response = api.post(path, self.to_hash, http_header) self.merge!(response) success? end
delete()
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1276 def delete() path = "v1/invoicing/invoices/#{self.id}" response = api.delete(path, {}) self.merge!(response) success? end
record_payment(payment_detail)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1253 def record_payment(payment_detail) payment_detail = PaymentDetail.new(payment_detail) unless payment_detail.is_a? PaymentDetail path = "v1/invoicing/invoices/#{self.id}/record-payment" response = api.post(path, payment_detail.to_hash, http_header) self.merge!(response) success? end
record_refund(refund_detail)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1261 def record_refund(refund_detail) refund_detail = RefundDetail.new(refund_detail) unless refund_detail.is_a? RefundDetail path = "v1/invoicing/invoices/#{self.id}/record-refund" response = api.post(path, refund_detail.to_hash, http_header) self.merge!(response) success? end
remind(notification)
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1237 def remind(notification) notification = Notification.new(notification) unless notification.is_a? Notification path = "v1/invoicing/invoices/#{self.id}/remind" response = api.post(path, notification.to_hash, http_header) self.merge!(response) success? end
send_invoice()
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1230 def send_invoice() path = "v1/invoicing/invoices/#{self.id}/send" response = api.post(path, {}, http_header) self.merge!(response) success? end
update()
click to toggle source
# File lib/paypal-sdk/rest/data_types.rb, line 1269 def update() path = "v1/invoicing/invoices/#{self.id}" response = api.put(path, self.to_hash, http_header) self.merge!(response) success? end