Module: Infusionsoft::Client::Invoice

Included in:
Infusionsoft::Client
Defined in:
lib/infusionsoft/client/invoice.rb

Overview

The Invoice service allows you to manage eCommerce transactions.

Instance Method Summary collapse

Instance Method Details

#invoice_add_manual_payment(invoice_id, amount, date, type, description, bypass_commissions) ⇒ Boolean

Adds a payment to an invoice without actually processing a charge through a merchant.



104
105
106
107
# File 'lib/infusionsoft/client/invoice.rb', line 104

def invoice_add_manual_payment(invoice_id, amount, date, type, description, bypass_commissions)
  response = get('InvoiceService.addManualPayment', invoice_id, amount, date, type,
                 description, bypass_commissions)
end

#invoice_add_order_commission_override(invoice_id, affiliate_id, product_id, percentage, amount, payout_type, description, date) ⇒ Boolean

Adds a commission override to a one time order, using a combination of percentage and hard-coded amounts.



232
233
234
235
236
# File 'lib/infusionsoft/client/invoice.rb', line 232

def invoice_add_order_commission_override(invoice_id, affiliate_id, product_id, percentage,
                                          amount, payout_type, description, date)
  response = get('InvoiceService.addOrderCommissionOverride', invoice_id, affiliate_id,
                 product_id, percentage, amount, payout_type, description, date)
end

#invoice_add_order_item(invoice_id, product_id, type, price, quantity, description, notes) ⇒ Boolean

Adds a line item to an order. This used to add a Product to an order as well as any other sort of charge/discount.



31
32
33
34
# File 'lib/infusionsoft/client/invoice.rb', line 31

def invoice_add_order_item(invoice_id, product_id, type, price, quantity, description, notes)
  response = get('InvoiceService.addOrderItem', invoice_id, product_id, type, price,
                 quantity, description, notes)
end

#invoice_add_payment_plan(invoice_id, auto_charge, credit_card_id, merchant_account_id, days_between_retry, max_retry, initial_payment_amount, initial_payment_date, plan_start_date, number_of_payments, days_between_payments) ⇒ Boolean

Adds a payment plan to an existing invoice.



135
136
137
138
139
140
141
142
143
# File 'lib/infusionsoft/client/invoice.rb', line 135

def invoice_add_payment_plan(invoice_id, auto_charge, credit_card_id,
                             , days_between_retry, max_retry,
                             initial_payment_amount, initial_payment_date, plan_start_date,
                             number_of_payments, days_between_payments)
  response = get('InvoiceService.addPaymentPlan', invoice_id, auto_charge,
                 credit_card_id, , days_between_retry, max_retry,
                 initial_payment_amount, initial_payment_date, plan_start_date, number_of_payments,
                 days_between_payments)
end

#invoice_add_recurring_commission_override(recurring_order_id, affiliate_id, amount, payout_type, description) ⇒ Boolean

This modifies the commissions being earned on a particular subscription. This does not affect previously generated invoices for this subscription.



89
90
91
92
93
# File 'lib/infusionsoft/client/invoice.rb', line 89

def invoice_add_recurring_commission_override(recurring_order_id, affiliate_id,
                                              amount, payout_type, description)
  response = get('InvoiceService.addRecurringCommissionOverride', recurring_order_id,
                 affiliate_id, amount, payout_type, description)
end

#invoice_add_recurring_order(contact_id, allow_duplicate, cprogram_id, merchant_account_id, credit_card_id, affiliate_id, days_till_charge) ⇒ Object

Creates a subscription for a contact. Subscriptions are billing automatically by infusionsoft within the next six hours. If you want to bill immediately you will need to utilize the create_invoice_for_recurring and then charge_invoice method to accomplish this.



72
73
74
75
76
77
78
# File 'lib/infusionsoft/client/invoice.rb', line 72

def invoice_add_recurring_order(contact_id, allow_duplicate, cprogram_id,
                                , credit_card_id, affiliate_id,
                                days_till_charge)
  response = get('InvoiceService.addRecurringOrder', contact_id,
                 allow_duplicate, cprogram_id, , credit_card_id,
                 affiliate_id, days_till_charge)
end

#invoice_add_recurring_order_with_price(contact_id, allow_duplicate, cprogram_id, qty, price, allow_tax, merchant_account_id, credit_card_id, affiliate_id, days_till_charge) ⇒ Object

Deprecated - Adds a recurring order to the database.



240
241
242
243
244
245
246
# File 'lib/infusionsoft/client/invoice.rb', line 240

def invoice_add_recurring_order_with_price(contact_id, allow_duplicate, cprogram_id, qty,
                                           price, allow_tax, ,
                                           credit_card_id, affiliate_id, days_till_charge)
  response = get('InvoiceService.addRecurringOrder', contact_id, allow_duplicate,
                 cprogram_id, qty, price, allow_tax, , credit_card_id,
                 affiliate_id, days_till_charge)
end

#invoice_calculate_amount_owed(invoice_id) ⇒ Float

Calculates the amount owed for a given invoice.



149
150
151
# File 'lib/infusionsoft/client/invoice.rb', line 149

def invoice_calculate_amount_owed(invoice_id)
  response = get('InvoiceService.calculateAmountOwed', invoice_id)
end

#invoice_charge_invoice(invoice_id, notes, credit_card_id, merchant_account_id, bypass_commissions) ⇒ Hash

This will cause a credit card to be charged for the amount currently due on an invoice.



45
46
47
48
49
# File 'lib/infusionsoft/client/invoice.rb', line 45

def invoice_charge_invoice(invoice_id, notes, credit_card_id, ,
                           bypass_commissions)
  response = get('InvoiceService.chargeInvoice', invoice_id, notes, credit_card_id,
                      , bypass_commissions)
end

#invoice_create_blank_order(contact_id, description, order_date, lead_affiliate_id, sale_affiliate_id) ⇒ Integer

Creates a blank order with no items.



13
14
15
16
17
# File 'lib/infusionsoft/client/invoice.rb', line 13

def invoice_create_blank_order(contact_id, description, order_date, lead_affiliate_id,
                               sale_affiliate_id)
  response = get('InvoiceService.createBlankOrder', contact_id, description, order_date,
                  lead_affiliate_id, sale_affiliate_id)
end

#invoice_create_invoice_for_recurring(recurring_order_id) ⇒ Integer

This will create an invoice for all charges due on a Subscription. If the subscription has three billing cycles that are due, it will create one invoice with all three items attached.



115
116
117
# File 'lib/infusionsoft/client/invoice.rb', line 115

def invoice_create_invoice_for_recurring(recurring_order_id)
  response = get('InvoiceService.createInvoiceForRecurring', recurring_order_id)
end

#invoice_delete_subscription(cprogram_id) ⇒ Boolean

Deletes the specified subscription from the database, as well as all invoices tied to the subscription.



56
57
58
# File 'lib/infusionsoft/client/invoice.rb', line 56

def invoice_delete_subscription(cprogram_id)
  response = get('InvoiceService.deleteSubscription', cprogram_id)
end

#invoice_get_all_payment_otpionsArray

Retrieve all Payment Types currently setup under the Order Settings section of Infusionsoft.



156
157
158
# File 'lib/infusionsoft/client/invoice.rb', line 156

def invoice_get_all_payment_otpions
  response = get('InvoiceService.getAllPaymentOptions')
end

#invoice_get_all_shipping_optionsArray

Retrieves the shipping options currently setup for the Infusionsoft shopping cart.



205
206
207
# File 'lib/infusionsoft/client/invoice.rb', line 205

def invoice_get_all_shipping_options
  response = get('Invoice.getAllShippingOptions')
end

#invoice_get_invoice_id(order_id) ⇒ Object

Deprecated - returns the invoice id from a one time order.



249
250
251
# File 'lib/infusionsoft/client/invoice.rb', line 249

def invoice_get_invoice_id(order_id)
  response = get('InvoiceService.getinvoice_id', order_id)
end

#invoice_get_payments(invoice_id) ⇒ Array<Hash>

Retrieves all payments for a given invoice.



164
165
166
# File 'lib/infusionsoft/client/invoice.rb', line 164

def invoice_get_payments(invoice_id)
  response = get('Invoice.getPayments', invoice_id)
end

#invoice_locate_existing_card(contact_id, last_four) ⇒ Integer

Locates an existing card in the system for a contact, using the last 4 digits.



173
174
175
# File 'lib/infusionsoft/client/invoice.rb', line 173

def invoice_locate_existing_card(contact_id, last_four)
  response = get('InvoiceService.locateExistingCard', contact_id, last_four)
end

#invoice_recalculate_tax(invoice_id) ⇒ Boolean

Calculates tax, and places it onto the given invoice.



181
182
183
# File 'lib/infusionsoft/client/invoice.rb', line 181

def invoice_recalculate_tax(invoice_id)
  response = get('InvoiceService.recalculateTax', invoice_id)
end

#invoice_update_recurring_next_bill_date(job_recurring_id, next_bill_date) ⇒ Boolean

Changes the next bill date on a subscription.



214
215
216
# File 'lib/infusionsoft/client/invoice.rb', line 214

def invoice_update_recurring_next_bill_date(job_recurring_id, next_bill_date)
  response = get('InvoiceService.updateJobRecurringNextBillDate', job_recurring_id, next_bill_date)
end

#invoice_validate_card(data) ⇒ Hash

This will validate a credit card by passing in values of the card directly (this card doesn’t have to be added to the system).



189
190
191
# File 'lib/infusionsoft/client/invoice.rb', line 189

def invoice_validate_card(credit_card_id)
  response = get('InvoiceService.validateCreditCard', credit_card_id)
end