infusionsoft 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,91 +1,141 @@
1
1
  module Infusionsoft
2
2
  class Client
3
- ########################
4
- ### Email Service ###
5
- ########################
3
+ # The Email service allows you to email your contacts as well as attaching emails sent
4
+ # elsewhere (this lets you send email from multiple services and still see all communications
5
+ # inside of Infusionsoft).
6
6
  module Email
7
- # Enables you to opt contacts in
8
- #
9
- # @email [String]
10
- # @reason [String]
11
- def email_optin(email, reason)
12
- response = get('APIEmailService', 'optIn', email, reason)
13
- end
14
7
 
15
- # Enables you to opt contacts out
8
+ # Create a new email template that can be used for future emails
16
9
  #
17
- # @email [String]
18
- # @reason [String]
19
- def email_optout(email, reason)
20
- response = get('APIEmailService', 'optOut', email, reason)
10
+ # @param [String] title
11
+ # @param [String] categories a comma separated list of the categories
12
+ # you want this template in Infusionsoft
13
+ # @param [String] from the from address format use is 'FirstName LastName <email@domain.com>'
14
+ # @param [String] to the email address this template is sent to
15
+ # @param [String] cc a comma separated list of cc email addresses
16
+ # @param [String] bcc a comma separated list of bcc email addresses
17
+ # @param [String] subject
18
+ # @param [String] text_body
19
+ # @param [String] html_body
20
+ # @param [String] content_type can be Text, HTML, Multipart
21
+ # @param [String] merge_context can be Contact, ServiceCall, Opportunity, CreditCard
22
+ def email_add(title, categories, from, to, cc, bcc, subject, text_body, html_body,
23
+ content_type, merge_context)
24
+ response = get('APIEmailService.addEmailTemplate', title, categories, from, to,
25
+ cc, bcc, subject, text_body, html_body, content_type, merge_context)
21
26
  end
22
27
 
23
- # Sends an email through infusion
28
+ # This will create an item in the email history for a contact. This does not actually
29
+ # send the email, it only places an item into the email history. Using the API to
30
+ # instruct Infusionsoft to send an email will handle this automatically.
24
31
  #
25
- # @contact_list [Array] List of contact ids you want to send this email to
26
- # @from_address [String]
27
- # @to_address [String]
28
- # @cc_address [String]
29
- # @bcc_address [String]
30
- # @content_type [String] this must be one of the following Text, HTML, or Multipart
31
- # @subject [String]
32
- # @html_body [Text]
33
- # @text_body [Text]
34
- def email_send(contact_list, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, text_body)
35
- response = get('APIEmailService', 'sendEmail', contact_list, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, text_body)
32
+ # @param [Integer] contact_id
33
+ # @param [String] from_name the name portion of the from address, not the email
34
+ # @param [String] from_address
35
+ # @param [String] to_address
36
+ # @param [String] cc_addresses
37
+ # @param [String] bcc_addresses
38
+ # @param [String] content_type can be Text, HTML, Multipart
39
+ # @param [String] subject
40
+ # @param [String] html_body
41
+ # @param [String] text_body
42
+ # @param [String] header the header info for this email (will be listed in history)
43
+ # @param [Date] receive_date
44
+ # @param [Date] sent_date
45
+ def email_attach(contact_id, from_name, from_address, to_address, cc_addresses,
46
+ bcc_addresses, content_type, subject, html_body, txt_body,
47
+ header, receive_date, send_date)
48
+ response = get('APIEmailService.attachEmail', contact_id, from_name, from_address,
49
+ to_address, cc_addresses, bcc_addresses, content_type, subject,
50
+ html_body, txt_body, header, receive_date, send_date)
36
51
  end
37
52
 
38
- # adds an email template for future use
53
+ # This retrieves all possible merge fields for the context provided.
39
54
  #
40
- # @title [String]
41
- # @categories [String] a comma separated list of the categories you wan this template in Infusionsoft
42
- # @content_type [String] can be Text, HTML, Multipart
43
- # @text_body [Text]
44
- # @html_body [Text]
45
- # @merge_context [String] can be Contact, ServiceCall, Opportunity, CreditCard
46
- def email_add(title, categories, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context)
47
- response = get('APIEmailService', 'addEmailTemplate', title, categories, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context)
55
+ # @param [String] merge_context could include Contact, ServiceCall, Opportunity, or CreditCard
56
+ # @return [Array] returns the merge fields for the given context
57
+ def email_get_available_merge_fields(merge_context)
58
+ response = get('APIEmailService.getAvailableMergeFields', merge_context)
48
59
  end
49
60
 
50
- # Attaches an email to a contact record
51
- def email_attach(contact_id, from_name, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, txt_body, header, receive_date, send_date)
52
- response = get('APIEmailService', 'attachEmail', contact_id, from_name, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, txt_body, header, receive_date, send_date)
61
+ # Retrieves the details for a particular email template.
62
+ #
63
+ # @param [Integer] id
64
+ # @return [Hash] all data for the email template
65
+ def email_get_template(id)
66
+ response = get('APIEmailService.getEmailTemplate', id)
53
67
  end
54
68
 
55
- # Creates an email template
56
- def email_create_template(title, user_id, from_address, to_addres, cc_addresses, bcc_addresses, content_type, subject, html_body, txt_body)
57
- response = get('APIEmailService', 'createEmailTemplate', title, user_id, from_address, to_addres, cc_addresses, bcc_addresses, content_type, subject, html_body, txt_body)
69
+ # Retrieves the status of the given email address.
70
+ #
71
+ # @param [String] email_address
72
+ # @return [Integer] 0 = opted out, 1 = single opt-in, 2 = double opt-in
73
+ def email_get_opt_status(email_address)
74
+ response = get('APIEmailService.getOptStatus', email_address)
58
75
  end
59
76
 
60
- # updates an email template for future use
77
+ # This method opts-in an email address. This method only works the first time
78
+ # an email address opts-in.
61
79
  #
62
- # @categories [String] a comma separated list of the categories you wan this template in Infusionsoft
63
- # @content_type [String] can be Text, HTML, Multipart
64
- # @merge_context [String] can be Contact, ServiceCall, Opportunity, CreditCard
65
- def email_update_template(id, title, categories, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context)
66
- response = get('APIEmailService', 'updateEmailTemplate', title, categories, from, to, cc, bcc, subject, text_body, html_body, content_type)
80
+ # @param [String] email_address
81
+ # @param [String] reason
82
+ # This is how you can note why/how this email was opted-in. If a blank
83
+ # reason is passed the system will default a reason of "API Opt In"
84
+ # @return [Boolean]
85
+ def email_optin(email_address, reason)
86
+ response = get('APIEmailService.optIn', email_address, reason)
67
87
  end
68
88
 
69
- # returns an email template
70
- def email_get_template(id)
71
- response = get('APIEmailService', 'getEmailTemplate', id)
89
+ # Opts-out an email address. Note that once an address is opt-out,
90
+ # the API cannot opt it back in.
91
+ #
92
+ # @param [String] email_address
93
+ # @param [String] reason
94
+ # @return [Boolean]
95
+ def email_optout(email_address, reason)
96
+ response = get('APIEmailService.optOut', email_address, reason)
72
97
  end
73
98
 
74
- # gets the opt-in status of the provided email address
99
+ # This will send an email to a list of contacts, as well as record the email
100
+ # in the contacts' email history.
75
101
  #
76
- # email_address [String]
77
- # @returns 0 = opted out; 1 = single opt-in; 2 = double opt-in
78
- def email_get_opt_status(email_address)
79
- response = get('APIEmailService', 'getOptStatus', email_address)
102
+ # @param [Array<Integer>] contact_list list of contact ids you want to send this email to
103
+ # @param [String] from_address
104
+ # @param [String] to_address
105
+ # @param [String] cc_address
106
+ # @param [String] bcc_address
107
+ # @param [String] content_type this must be one of the following Text, HTML, or Multipart
108
+ # @param [String] subject
109
+ # @param [String] html_body
110
+ # @param [String] text_body
111
+ # @return [Boolean] returns true/false if the email has been sent
112
+ def email_send(contact_list, from_address, to_address, cc_addresses,
113
+ bcc_addresses, content_type, subject, html_body, text_body)
114
+ response = get('APIEmailService.sendEmail', contact_list, from_address,
115
+ to_address, cc_addresses, bcc_addresses, content_type, subject,
116
+ html_body, text_body)
80
117
  end
81
118
 
82
- # returns a string of merge fields for a given context
119
+ # This method is used to update an already existing email template.
83
120
  #
84
- # @merge_context [String] could include Contact, ServiceCall, Opportunity, CreditCard
85
- def email_get_available_merge_fields(merge_context)
86
- response = get('APIEmailService', 'getAvailableMergeFields', merge_context)
121
+ # @param [Integer] id
122
+ # @param [String] title
123
+ # @param [String] category
124
+ # @param [String] from
125
+ # @param [String] to
126
+ # @param [String] cc
127
+ # @param [String] bcc
128
+ # @param [String subject
129
+ # @param [String] text_body
130
+ # @param [String] html_body
131
+ # @param [String] content_type can be Text, HTML, Multipart
132
+ # @param [String] merge_context can be Contact, ServiceCall, Opportunity, CreditCard
133
+ # @return [Boolean] returns true/false if teamplate was updated successfully
134
+ def email_update_template(id, title, category, from, to, cc, bcc, subject,
135
+ text_body, html_body, content_type, merge_context)
136
+ response = get('APIEmailService.updateEmailTemplate', title, category, from,
137
+ to, cc, bcc, subject, text_body, html_body, content_type, merge_context)
87
138
  end
88
-
89
139
  end
90
140
  end
91
141
  end
@@ -1,8 +1,5 @@
1
1
  module Infusionsoft
2
2
  class Client
3
- ########################
4
- ### File Service ###
5
- ########################
6
3
  module File
7
4
  def file_upload(contact_id, file_name, encoded_file_base64)
8
5
  response = get('FileService', 'uploadFile', contact_id, file_name, encoded_file_base64)
@@ -1,127 +1,253 @@
1
1
  module Infusionsoft
2
2
  class Client
3
- ########################
4
- ### Invoice Service ###
5
- ########################
3
+ # The Invoice service allows you to manage eCommerce transactions.
6
4
  module Invoice
7
- def invoice_update_recurring_next_bill_date(job_recurring_id, new_bill_date)
8
- response = get('InvoiceService', 'updateJobRecurringNextBillDate', job_recurring_id, new_bill_date)
5
+ # Creates a blank order with no items.
6
+ #
7
+ # @param [Integer] contact_id
8
+ # @param [String] description the name this order will display
9
+ # @param [Date] order_date
10
+ # @param [Integer] lead_affiliate_id 0 should be used if none
11
+ # @param [Integer] sale_affiliate_id 0 should be used if none
12
+ # @return [Integer] returns the invoice id
13
+ def invoice_create_blank_order(contact_id, description, order_date, lead_affiliate_id,
14
+ sale_affiliate_id)
15
+ response = get('InvoiceService.createBlankOrder', contact_id, description, order_date,
16
+ lead_affiliate_id, sale_affiliate_id)
9
17
  end
10
18
 
11
- # Adds a payment to an invoice without actually processing a charge through a merchant.
19
+ # Adds a line item to an order. This used to add a Product to an order as well as
20
+ # any other sort of charge/discount.
12
21
  #
13
- # @invoice_id [Integer]
14
- # @amount [Float]
15
- # @date [Date]
16
- # @type [String] Cash, Check, Credit Card, Money Order, PayPal, etc.
17
- # @description [String]
18
- # @bypass_commissions [Boolean]
19
- # @return [Boolean]
20
- def invoice_add_manual_payment(invoice_id, amount, date, type, description, bypass_commissions)
21
- response = get('InvoiceService', 'addManualPayment', invoice_id, amount, date, type,
22
- description, bypass_commissions)
22
+ # @param [Integer] invoice_id
23
+ # @param [Integer] product_id
24
+ # @param [Integer] type UNKNOWN = 0, SHIPPING = 1, TAX = 2, SERVICE = 3, PRODUCT = 4,
25
+ # UPSELL = 5, FINANCECHARGE = 6, SPECIAL = 7
26
+ # @param [Float] price
27
+ # @param [Integer] quantity
28
+ # @param [String] description a full description of the line item
29
+ # @param [String] notes
30
+ # @return [Boolean] returns true/false if it was added successfully or not
31
+ def invoice_add_order_item(invoice_id, product_id, type, price, quantity, description, notes)
32
+ response = get('InvoiceService.addOrderItem', invoice_id, product_id, type, price,
33
+ quantity, description, notes)
23
34
  end
24
35
 
25
- # Adds a commission override to a one time order, using a combination of percentage and hard-coded amounts.
26
- def invoice_add_order_commission_override(invoice_id, affiliate_id, product_id, percentage, amount, payout_type,
27
- description, date)
28
- response = get('InvoiceService', 'addOrderCommissionOverride', invoice_id, affiliate_id, product_id,
29
- percentage, amount, payout_type, description, date)
36
+ # This will cause a credit card to be charged for the amount currently due on an invoice.
37
+ #
38
+ # @param [Integer] invoice_id
39
+ # @param [String] notes a note about the payment
40
+ # @param [Integer] credit_card_id
41
+ # @param [Integer] merchant_account_id
42
+ # @param [Boolean] bypass_commission
43
+ # @return [Hash] containing the following keys {'Successful => [Boolean],
44
+ # 'Code' => [String], 'RefNum' => [String], 'Message' => [String]}
45
+ def invoice_charge_invoice(invoice_id, notes, credit_card_id, merchant_account_id,
46
+ bypass_commissions)
47
+ response = get('InvoiceService.chargeInvoice', invoice_id, notes, credit_card_id,
48
+ merchant_account_id, bypass_commissions)
30
49
  end
31
50
 
32
- # Adds an item to an existing order.
51
+ # Deletes the specified subscription from the database, as well as all invoices
52
+ # tied to the subscription.
33
53
  #
34
- # @order_id [Integer] This is the invoice id
35
- # @product_id [Integer]
36
- # @type [Integer] UNKNOWN = 0, SHIPPING = 1, TAX = 2, SERVICE = 3, PRODUCT = 4, UPSELL = 5, FINANCECHARGE = 6, SPECIAL = 7
37
- # @price [Float]
38
- # @quantity [Integer]
39
- # @description [String]
40
- # @notes [String]
41
- # @return [Boolean] returns true or false if it was added successfully or not
42
- def invoice_add_order_item(order_id, product_id, type, price, quantity, description, notes)
43
- response = get('InvoiceService', 'addOrderItem', order_id, product_id, type, price,
44
- quantity, description, notes)
54
+ # @param [Integer] cprogram_id the id of the subscription being deleted
55
+ # @return [Boolean]
56
+ def invoice_delete_subscription(cprogram_id)
57
+ response = get('InvoiceService.deleteSubscription', cprogram_id)
45
58
  end
46
59
 
47
- # Adds a payment plan to an existing invoice.
48
- def invoice_add_payment_plan(order_id, auto_charge, credit_card_id, merchant_account_id, days_between_retry, max_retry,
49
- initial_payment_amount, plan_start_date, number_of_payments, days_between_payments)
50
- response = get('InvoiceService', 'addPaymentPlan', order_id, auto_charge, credit_card_id, merchant_account_id,
51
- days_between_retry, max_retry, initial_payment_amount, plan_start_date, number_of_payments,
52
- days_between_payments)
60
+ # Creates a subscription for a contact. Subscriptions are billing automatically
61
+ # by infusionsoft within the next six hours. If you want to bill immediately you
62
+ # will need to utilize the create_invoice_for_recurring and then
63
+ # charge_invoice method to accomplish this.
64
+ #
65
+ # @param [Integer] contact_id
66
+ # @param [Boolean] allow_duplicate
67
+ # @param [Integer] cprogram_id the subscription id
68
+ # @param [Integer] merchant_account_id
69
+ # @param [Integer] credit_card_id
70
+ # @param [Integer] affiliate_id
71
+ # @param [Integer] days_till_charge number of days you want to wait till it's charged
72
+ def invoice_add_recurring_order(contact_id, allow_duplicate, cprogram_id,
73
+ merchant_account_id, credit_card_id, affiliate_id,
74
+ days_till_charge)
75
+ response = get('InvoiceService.addRecurringOrder', contact_id,
76
+ allow_duplicate, cprogram_id, merchant_account_id, credit_card_id,
77
+ affiliate_id, days_till_charge)
53
78
  end
54
79
 
55
- # Adds a commission override to a recurring order.
56
- def invoice_add_recurring_commission_override(recurringorder_id, affiliate_id, amount, payout_type, description)
57
- response = get('InvoiceService', 'addRecurringCommissionOverride', recurringorder_id, affiliate_id, amount,
58
- payout_type, description)
80
+ # This modifies the commissions being earned on a particular subscription.
81
+ # This does not affect previously generated invoices for this subscription.
82
+ #
83
+ # @param [Integer] recurring_order_id
84
+ # @param [Integer] affiliate_id
85
+ # @param [Float] amount
86
+ # @param [Integer] paryout_type how commissions will be earned (possible options are
87
+ # 4 - up front earning, 5 - upon customer payment) typically this is 5
88
+ # @return [Boolean]
89
+ def invoice_add_recurring_commission_override(recurring_order_id, affiliate_id,
90
+ amount, payout_type, description)
91
+ response = get('InvoiceService.addRecurringCommissionOverride', recurring_order_id,
92
+ affiliate_id, amount, payout_type, description)
59
93
  end
60
94
 
61
- # Adds a recurring order to the database.
62
- def invoice_add_recurring_order(contact_id, allow_duplicate, cprogram_id, merchant_account_id, credit_card_id, affiliate_id,
63
- days_till_charge)
64
- response = get('InvoiceService', 'addRecurringOrder', contact_id, allow_duplicate, cprogram_id,
65
- merchant_account_id, credit_card_id, affiliate_id, days_till_charge)
95
+ # Adds a payment to an invoice without actually processing a charge through a merchant.
96
+ #
97
+ # @param [Integer] invoice_id
98
+ # @param [Float] amount
99
+ # @param [Date] date
100
+ # @param [String] type Cash, Check, Credit Card, Money Order, PayPal, etc.
101
+ # @param [String] description an area useful for noting payment details such as check number
102
+ # @param [Boolean] bypass_commissions
103
+ # @return [Boolean]
104
+ def invoice_add_manual_payment(invoice_id, amount, date, type, description, bypass_commissions)
105
+ response = get('InvoiceService', 'addManualPayment', invoice_id, amount, date, type,
106
+ description, bypass_commissions)
66
107
  end
67
-
68
- # Adds a recurring order to the database.
69
- 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)
70
- response = get('InvoiceService', 'addRecurringOrder', contact_id, allow_duplicate, cprogram_id, qty, price, allow_tax, merchant_account_id, credit_card_id, affiliate_id, days_till_charge)
108
+
109
+ # This will create an invoice for all charges due on a Subscription. If the
110
+ # subscription has three billing cycles that are due, it will create one
111
+ # invoice with all three items attached.
112
+ #
113
+ # @param [Integer] recurring_order_id
114
+ # @return [Integer] returns the id of the invoice that was created
115
+ def invoice_create_invoice_for_recurring(recurring_order_id)
116
+ response = get('InvoiceService.createInvoiceForRecurring', recurring_order_id)
71
117
  end
72
118
 
73
- # Calculates the amount owed for a given invoice.
74
- def invoice_calculate_amount_owed(invoice_id)
75
- response = get('InvoiceService', 'calculateAmountOwed', invoice_id)
119
+ # Adds a payment plan to an existing invoice.
120
+ #
121
+ # @param [Integer] invoice_id
122
+ # @param [Boolean]
123
+ # @param [Integer] credit_card_id
124
+ # @param [Integer] merchant_account_id
125
+ # @param [Integer] days_between_retry the number of days Infusionsoft should wait
126
+ # before re-attempting to charge a failed payment
127
+ # @param [Integer] max_retry the maximum number of charge attempts
128
+ # @param [Float] initial_payment_ammount the amount of the very first charge
129
+ # @param [Date] initial_payment_date
130
+ # @param [Date] plan_start_date
131
+ # @param [Integer] number_of_payments the number of payments in this payplan (does not include
132
+ # initial payment)
133
+ # @param [Integer] days_between_payments the number of days between each payment
134
+ # @return [Boolean]
135
+ def invoice_add_payment_plan(invoice_id, auto_charge, credit_card_id,
136
+ merchant_account_id, days_between_retry, max_retry,
137
+ initial_payment_amount, initial_payment_date, plan_start_date,
138
+ number_of_payments, days_between_payments)
139
+ response = get('InvoiceService.addPaymentPlan', invoice_id, auto_charge,
140
+ credit_card_id, merchant_account_id, days_between_retry, max_retry,
141
+ initial_payment_amount, initial_payment_date, plan_start_date, number_of_payments,
142
+ days_between_payments)
76
143
  end
77
144
 
78
- # Will charge an invoice with the amount currently due on it.
145
+ # Calculates the amount owed for a given invoice.
79
146
  #
80
- # @invoice_id [Integer]
81
- # @notes [String]
82
- # @credit_card_id [Integer]
83
- # @merchant_account_id [Integer]
84
- # @bypass_commission [Boolean]
85
- # @return [Hash] containing the following keys
86
- # {'Successful => [Boolean], 'Code' => [String], 'RefNum' => [String], 'Message' => [String]}
87
- def invoice_charge_invoice(invoice_id, notes, credit_card_id, merchant_account_id, bypass_commissions)
88
- response = get('InvoiceService', 'chargeInvoice', invoice_id, notes, credit_card_id,
89
- merchant_account_id, bypass_commissions)
147
+ # @param [Integer] invoice_id
148
+ # @return [Float]
149
+ def invoice_calculate_amount_owed(invoice_id)
150
+ response = get('InvoiceService.calculateAmountOwed', invoice_id)
90
151
  end
91
152
 
92
- # returns the invoice id from a one time order
93
- def invoice_get_invoice_id(order_id)
94
- response = get('InvoiceService', 'getinvoice_id', order_id)
153
+ # Retrieve all Payment Types currently setup under the Order Settings section of Infusionsoft.
154
+ #
155
+ # @return [Array]
156
+ def invoice_get_all_payment_otpions
157
+ response = get('InvoiceService.getAllPaymentOptions')
95
158
  end
96
159
 
97
- # Creates a blank order with no items.
160
+ # Retrieves all payments for a given invoice.
98
161
  #
99
- # @return [Integer] returns the invoice id
100
- def invoice_create_blank_order(contact_id, description, order_date, lead_affiliate_id, sale_affiliate_id)
101
- response = get('InvoiceService', 'createBlankOrder', contact_id, description, order_date,
102
- lead_affiliate_id, sale_affiliate_id)
162
+ # @param [Integer] invoice_id
163
+ # @return [Array<Hash>] returns an array of payments
164
+ def invoice_get_payments(invoice_id)
165
+ response = get('Invoice.getPayments', invoice_id)
103
166
  end
104
167
 
105
- # This will create an invoice for all charges due on a recurring order.
106
- def invoice_create_invoice_for_recurring(recurringorder_id)
107
- response = get('InvoiceService', 'createInvoiceForRecurring', recurringorder_id)
168
+ # Locates an existing card in the system for a contact, using the last 4 digits.
169
+ #
170
+ # @param [Integer] contact_id
171
+ # @param [Integer] last_four
172
+ # @return [Integer] returns the id of the credit card
173
+ def invoice_locate_existing_card(contact_id, last_four)
174
+ response = get('InvoiceService.locateExistingCard', contact_id, last_four)
108
175
  end
109
176
 
110
- # Locates an existing card in the system for a contact, using the
111
- def invoice_locate_existing_card(contact_id, last4)
112
- # last 4 digits of the card.
113
- response = get('InvoiceService', 'locateExistingCard', contact_id, last4)
177
+ # Calculates tax, and places it onto the given invoice.
178
+ #
179
+ # @param [Integer] invoice_id
180
+ # @return [Boolean]
181
+ def invoice_recalculate_tax(invoice_id)
182
+ response = get('InvoiceService.recalculateTax', invoice_id)
114
183
  end
115
184
 
116
185
  # This will validate a credit card in the system.
186
+ #
187
+ # @param [Integer] credit_card_id if the card is already in the system
188
+ # @return [Hash] returns a hash { 'Valid' => false, 'Message' => 'Card is expired' }
117
189
  def invoice_validate_card(credit_card_id)
118
- response = get('InvoiceService', 'validateCreditCard', credit_card_id)
190
+ response = get('InvoiceService.validateCreditCard', credit_card_id)
119
191
  end
120
192
 
121
193
  # This will validate a credit card by passing in values of the
122
- # card directly (this card doesn't have to be added to the system)
123
- def invoice_validate_card(creditCard)
124
- response = get('InvoiceService', 'validateCreditCard', creditCard)
194
+ # card directly (this card doesn't have to be added to the system).
195
+ #
196
+ # @param [Hash] data
197
+ # @return [Hash] returns a hash { 'Valid' => false, 'Message' => 'Card is expired' }
198
+ def invoice_validate_card(data)
199
+ response = get('InvoiceService.validateCreditCard', data)
200
+ end
201
+
202
+ # Retrieves the shipping options currently setup for the Infusionsoft shopping cart.
203
+ #
204
+ # @return [Array]
205
+ def invoice_get_all_shipping_options
206
+ response = get('Invoice.getAllShippingOptions')
207
+ end
208
+
209
+ # Changes the next bill date on a subscription.
210
+ #
211
+ # @param [Integer] job_recurring_id this is the subscription id on the contact
212
+ # @param [Date] next_bill_date
213
+ # @return [Boolean]
214
+ def invoice_update_recurring_next_bill_date(job_recurring_id, next_bill_date)
215
+ response = get('InvoiceService.updateJobRecurringNextBillDate', job_recurring_id, next_bill_date)
216
+ end
217
+
218
+
219
+ # Adds a commission override to a one time order, using a combination of percentage
220
+ # and hard-coded amounts.
221
+ #
222
+ # @param [Integer] invoice_id
223
+ # @param [Integer] affiliate_id
224
+ # @param [Integer] product_id
225
+ # @param [Integer] percentage
226
+ # @param [Float] amount
227
+ # @param [Integer] payout_type how commision should be earned (4 - up front in full, 5 - upon
228
+ # customer payment
229
+ # @param [String] description a note about this commission
230
+ # @param [Date] date the commission was generated, not necessarily earned
231
+ # @return [Boolean]
232
+ def invoice_add_order_commission_override(invoice_id, affiliate_id, product_id, percentage,
233
+ amount, payout_type, description, date)
234
+ response = get('InvoiceService.addOrderCommissionOverride', invoice_id, affiliate_id,
235
+ product_id, percentage, amount, payout_type, description, date)
236
+ end
237
+
238
+
239
+ # Deprecated - Adds a recurring order to the database.
240
+ def invoice_add_recurring_order_with_price(contact_id, allow_duplicate, cprogram_id, qty,
241
+ price, allow_tax, merchant_account_id,
242
+ credit_card_id, affiliate_id, days_till_charge)
243
+ response = get('InvoiceService.addRecurringOrder', contact_id, allow_duplicate,
244
+ cprogram_id, qty, price, allow_tax, merchant_account_id, credit_card_id,
245
+ affiliate_id, days_till_charge)
246
+ end
247
+
248
+ # Deprecated - returns the invoice id from a one time order.
249
+ def invoice_get_invoice_id(order_id)
250
+ response = get('InvoiceService.getinvoice_id', order_id)
125
251
  end
126
252
  end
127
253
  end