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
-
#add_manual_payment(invoice_id, amount, date, payment_type, description, bypass_commission) ⇒ Object
adding a manual payment for an invoice.
-
#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.
-
#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.
-
#invoice_add_order_item(invoice_id, product_id, type, price, quantity, description, notes) ⇒ Boolean
Adds a line item to an order.
-
#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.
-
#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.
-
#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.
-
#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.
-
#invoice_add_subscription(contact_id, allow_duplicate, cprogram_id, qty, price, allow_tax, merchant_account_id, credit_card_id, affiliate_id, days_till_charge) ⇒ Object
This is a replacement method for invoice_add_recurring_order in order to fully support and comply with the Infusionsoft API documentation.
-
#invoice_calculate_amount_owed(invoice_id) ⇒ Float
Calculates the amount owed for a given invoice.
-
#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.
-
#invoice_create_blank_order(contact_id, description, order_date, lead_affiliate_id, sale_affiliate_id) ⇒ Integer
Creates a blank order with no items.
-
#invoice_create_invoice_for_recurring(recurring_order_id) ⇒ Integer
This will create an invoice for all charges due on a Subscription.
-
#invoice_delete_subscription(cprogram_id) ⇒ Boolean
Deletes the specified subscription from the database, as well as all invoices tied to the subscription.
-
#invoice_get_all_payment_otpions ⇒ Array
Retrieve all Payment Types currently setup under the Order Settings section of Infusionsoft.
-
#invoice_get_all_shipping_options ⇒ Array
Retrieves the shipping options currently setup for the Infusionsoft shopping cart.
-
#invoice_get_invoice_id(order_id) ⇒ Object
Deprecated - returns the invoice id from a one time order.
-
#invoice_get_payments(invoice_id) ⇒ Array<Hash>
Retrieves all payments for a given invoice.
-
#invoice_locate_existing_card(contact_id, last_four) ⇒ Integer
Locates an existing card in the system for a contact, using the last 4 digits.
-
#invoice_recalculate_tax(invoice_id) ⇒ Boolean
Calculates tax, and places it onto the given invoice.
-
#invoice_update_recurring_next_bill_date(job_recurring_id, next_bill_date) ⇒ Boolean
Changes the next bill date on a subscription.
-
#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).
Instance Method Details
#add_manual_payment(invoice_id, amount, date, payment_type, description, bypass_commission) ⇒ Object
adding a manual payment for an invoice. This can be useful when the payments are not handled by Infusionsoft but you still needs to makethe invoice as paid
283 284 285 286 |
# File 'lib/infusionsoft/client/invoice.rb', line 283 def add_manual_payment(invoice_id, amount, date, payment_type, description, bypass_commission) response = xmlrpc('InvoiceService.addManualPayment', invoice_id, amount, date, payment_type, description, bypass_commission) end |
#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.
136 137 138 139 |
# File 'lib/infusionsoft/client/invoice.rb', line 136 def invoice_add_manual_payment(invoice_id, amount, date, type, description, bypass_commissions) response = xmlrpc('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.
264 265 266 267 268 |
# File 'lib/infusionsoft/client/invoice.rb', line 264 def invoice_add_order_commission_override(invoice_id, affiliate_id, product_id, percentage, amount, payout_type, description, date) response = xmlrpc('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 = xmlrpc('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.
167 168 169 170 171 172 173 174 175 |
# File 'lib/infusionsoft/client/invoice.rb', line 167 def 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) response = xmlrpc('InvoiceService.addPaymentPlan', 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) 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.
121 122 123 124 125 |
# File 'lib/infusionsoft/client/invoice.rb', line 121 def invoice_add_recurring_commission_override(recurring_order_id, affiliate_id, amount, payout_type, description) response = xmlrpc('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 79 80 81 |
# File 'lib/infusionsoft/client/invoice.rb', line 72 def invoice_add_recurring_order(contact_id, allow_duplicate, cprogram_id, merchant_account_id, credit_card_id, affiliate_id, days_till_charge) api_logger.warn "[DEPRECATION WARNING]: The invoice_add_subscription method more fully complies with Infusionsoft's published API documents. User is advised to review Infusionsoft's API and this gem's documentation for changes in parameters." response = xmlrpc('InvoiceService.addRecurringOrder', contact_id, allow_duplicate, cprogram_id, merchant_account_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.
290 291 292 293 294 295 296 |
# File 'lib/infusionsoft/client/invoice.rb', line 290 def 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) response = xmlrpc('InvoiceService.addRecurringOrder', contact_id, allow_duplicate, cprogram_id, qty, price, allow_tax, merchant_account_id, credit_card_id, affiliate_id, days_till_charge) end |
#invoice_add_subscription(contact_id, allow_duplicate, cprogram_id, qty, price, allow_tax, merchant_account_id, credit_card_id, affiliate_id, days_till_charge) ⇒ Object
This is a replacement method for invoice_add_recurring_order in order to fully support and comply with the Infusionsoft API documentation.
100 101 102 103 104 105 106 107 |
# File 'lib/infusionsoft/client/invoice.rb', line 100 def invoice_add_subscription(contact_id, allow_duplicate, cprogram_id, qty, price, allow_tax, merchant_account_id, credit_card_id, affiliate_id, days_till_charge) response = xmlrpc('InvoiceService.addRecurringOrder', contact_id, allow_duplicate, cprogram_id, qty, price, allow_tax, merchant_account_id, credit_card_id, affiliate_id, days_till_charge) end |
#invoice_calculate_amount_owed(invoice_id) ⇒ Float
Calculates the amount owed for a given invoice.
181 182 183 |
# File 'lib/infusionsoft/client/invoice.rb', line 181 def invoice_calculate_amount_owed(invoice_id) response = xmlrpc('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, merchant_account_id, bypass_commissions) response = xmlrpc('InvoiceService.chargeInvoice', invoice_id, notes, credit_card_id, merchant_account_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 = xmlrpc('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.
147 148 149 |
# File 'lib/infusionsoft/client/invoice.rb', line 147 def invoice_create_invoice_for_recurring(recurring_order_id) response = xmlrpc('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 = xmlrpc('InvoiceService.deleteSubscription', cprogram_id) end |
#invoice_get_all_payment_otpions ⇒ Array
Retrieve all Payment Types currently setup under the Order Settings section of Infusionsoft.
188 189 190 |
# File 'lib/infusionsoft/client/invoice.rb', line 188 def invoice_get_all_payment_otpions response = xmlrpc('InvoiceService.getAllPaymentOptions') end |
#invoice_get_all_shipping_options ⇒ Array
Retrieves the shipping options currently setup for the Infusionsoft shopping cart.
237 238 239 |
# File 'lib/infusionsoft/client/invoice.rb', line 237 def response = xmlrpc('Invoice.getAllShippingOptions') end |
#invoice_get_invoice_id(order_id) ⇒ Object
Deprecated - returns the invoice id from a one time order.
299 300 301 |
# File 'lib/infusionsoft/client/invoice.rb', line 299 def invoice_get_invoice_id(order_id) response = xmlrpc('InvoiceService.getInvoiceId', order_id) end |
#invoice_get_payments(invoice_id) ⇒ Array<Hash>
Retrieves all payments for a given invoice.
196 197 198 |
# File 'lib/infusionsoft/client/invoice.rb', line 196 def invoice_get_payments(invoice_id) response = xmlrpc('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.
205 206 207 |
# File 'lib/infusionsoft/client/invoice.rb', line 205 def invoice_locate_existing_card(contact_id, last_four) response = xmlrpc('InvoiceService.locateExistingCard', contact_id, last_four) end |
#invoice_recalculate_tax(invoice_id) ⇒ Boolean
Calculates tax, and places it onto the given invoice.
213 214 215 |
# File 'lib/infusionsoft/client/invoice.rb', line 213 def invoice_recalculate_tax(invoice_id) response = xmlrpc('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.
246 247 248 |
# File 'lib/infusionsoft/client/invoice.rb', line 246 def invoice_update_recurring_next_bill_date(job_recurring_id, next_bill_date) response = xmlrpc('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).
221 222 223 |
# File 'lib/infusionsoft/client/invoice.rb', line 221 def invoice_validate_card(credit_card_id) response = xmlrpc('InvoiceService.validateCreditCard', credit_card_id) end |