Simplify_Invoice

Copyright (c) 2013 - 2015 MasterCard International Incorporated All rights reserved.

Defined (1)

The class is defined in the following location(s).

/includes/gateways/simplify-commerce/includes/Simplify/Invoice.php  
  1. class Simplify_Invoice extends Simplify_Object { 
  2. /** 
  3. * Creates an Simplify_Invoice object 
  4. * @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;"> 
  5. * <dt><tt>billingAddress.city</tt></dt> <dd>Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd> 
  6. * <dt><tt>billingAddress.country</tt></dt> <dd>Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd> 
  7. * <dt><tt>billingAddress.line1</tt></dt> <dd>Billing address line 1 of the location where the goods or services were supplied. [max length: 255] </dd> 
  8. * <dt><tt>billingAddress.line2</tt></dt> <dd>Billing address line 2 of the location where the goods or services were supplied. [max length: 255] </dd> 
  9. * <dt><tt>billingAddress.name</tt></dt> <dd>Billing address name of the location where the goods or services were supplied. Will use the customer name if not provided. [max length: 255] </dd> 
  10. * <dt><tt>billingAddress.state</tt></dt> <dd>Billing address state of the location where the goods or services were supplied. [max length: 255] </dd> 
  11. * <dt><tt>billingAddress.zip</tt></dt> <dd>Billing address zip of the location where the goods or services were supplied. [max length: 32] </dd> 
  12. * <dt><tt>businessAddress.city</tt></dt> <dd>Address city of the business that is sending the invoice. [max length: 255, min length: 2] </dd> 
  13. * <dt><tt>businessAddress.country</tt></dt> <dd>Address country of the business that is sending the invoice. [max length: 2, min length: 2] </dd> 
  14. * <dt><tt>businessAddress.line1</tt></dt> <dd>Address line 1 of the business that is sending the invoice. [max length: 255] </dd> 
  15. * <dt><tt>businessAddress.line2</tt></dt> <dd>Address line 2 of the business that is sending the invoice. [max length: 255] </dd> 
  16. * <dt><tt>businessAddress.name</tt></dt> <dd>The name of the business that is sending the invoice. [max length: 255] </dd> 
  17. * <dt><tt>businessAddress.state</tt></dt> <dd>Address state of the business that is sending the invoice. [max length: 255] </dd> 
  18. * <dt><tt>businessAddress.zip</tt></dt> <dd>Address zip of the business that is sending the invoice. [max length: 32] </dd> 
  19. * <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3, default: USD] </dd> 
  20. * <dt><tt>customer</tt></dt> <dd>The customer ID of the customer we are invoicing. This is optional if invoiceToCopy or a name and email are provided </dd> 
  21. * <dt><tt>customerTaxNo</tt></dt> <dd>The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255] </dd> 
  22. * <dt><tt>discountRate</tt></dt> <dd>The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6] </dd> 
  23. * <dt><tt>dueDate</tt></dt> <dd>The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past. </dd> 
  24. * <dt><tt>email</tt></dt> <dd>The email of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. </dd> 
  25. * <dt><tt>invoiceId</tt></dt> <dd>User defined invoice id. If not provided the system will generate a numeric id. [max length: 255] </dd> 
  26. * <dt><tt>invoiceToCopy</tt></dt> <dd>The id of an existing invoice to be copied. This is optional if customer or a name and email are provided </dd> 
  27. * <dt><tt>items.amount</tt></dt> <dd>Amount of the invoice item (the smallest unit of your currency). Example: 100 = $1.00USD [min value: -9999900, max value: 9999900] <strong>required </strong></dd> 
  28. * <dt><tt>items.description</tt></dt> <dd>The description of the invoice item. [max length: 1024] </dd> 
  29. * <dt><tt>items.invoice</tt></dt> <dd>The ID of the invoice this item belongs to. </dd> 
  30. * <dt><tt>items.product</tt></dt> <dd>The product this invoice item refers to. </dd> 
  31. * <dt><tt>items.quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1] </dd> 
  32. * <dt><tt>items.reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd> 
  33. * <dt><tt>items.tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd> 
  34. * <dt><tt>lateFee</tt></dt> <dd>The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD [max value: 9999900] </dd> 
  35. * <dt><tt>memo</tt></dt> <dd>A memo that is displayed to the customer on the invoice payment screen. [max length: 4000] </dd> 
  36. * <dt><tt>name</tt></dt> <dd>The name of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. [max length: 50, min length: 2] </dd> 
  37. * <dt><tt>note</tt></dt> <dd>This field can be used to store a note that is not displayed to the customer. [max length: 4000] </dd> 
  38. * <dt><tt>reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd> 
  39. * <dt><tt>shippingAddress.city</tt></dt> <dd>Address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd> 
  40. * <dt><tt>shippingAddress.country</tt></dt> <dd>Address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd> 
  41. * <dt><tt>shippingAddress.line1</tt></dt> <dd>Address line 1 of the location where the goods or services were supplied. [max length: 255] </dd> 
  42. * <dt><tt>shippingAddress.line2</tt></dt> <dd>Address line 2 of the location where the goods or services were supplied. [max length: 255] </dd> 
  43. * <dt><tt>shippingAddress.name</tt></dt> <dd>Address name of the location where the goods or services were supplied. [max length: 255] </dd> 
  44. * <dt><tt>shippingAddress.state</tt></dt> <dd>Address state of the location where the goods or services were supplied. [max length: 255] </dd> 
  45. * <dt><tt>shippingAddress.zip</tt></dt> <dd>Address zip of the location where the goods or services were supplied. [max length: 32] </dd> 
  46. * <dt><tt>suppliedDate</tt></dt> <dd>The date on which the goods or services were supplied. </dd> 
  47. * <dt><tt>taxNo</tt></dt> <dd>The tax number or VAT id of the person who supplied the goods or services. [max length: 255] </dd> 
  48. * <dt><tt>type</tt></dt> <dd>The type of invoice. One of WEB or MOBILE. [valid values: WEB, MOBILE, default: WEB] </dd></dl> 
  49. * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/> 
  50. * @return Invoice a Invoice object. 
  51. */ 
  52. static public function createInvoice($hash, $authentication = null) { 
  53.  
  54. $args = func_get_args(); 
  55. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); 
  56.  
  57. $instance = new Simplify_Invoice(); 
  58. $instance->setAll($hash); 
  59.  
  60. $object = Simplify_PaymentsApi::createObject($instance, $authentication); 
  61. return $object; 
  62.  
  63.  
  64.  
  65.  
  66. /** 
  67. * Deletes an Simplify_Invoice object. 
  68. * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> 
  69. */ 
  70. public function deleteInvoice($authentication = null) { 
  71.  
  72. $args = func_get_args(); 
  73. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1); 
  74.  
  75. $obj = Simplify_PaymentsApi::deleteObject($this, $authentication); 
  76. $this->properties = null; 
  77. return true; 
  78.  
  79.  
  80. /** 
  81. * Retrieve Simplify_Invoice objects. 
  82. * @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;"> 
  83. * <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd> 
  84. * <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd> 
  85. * <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd> 
  86. * <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> invoiceDate</tt><tt> dueDate</tt><tt> datePaid</tt><tt> customer</tt><tt> status</tt><tt> dateCreated</tt>.</dd></dl> 
  87. * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> 
  88. * @return ResourceList a ResourceList object that holds the list of Invoice objects and the total 
  89. * number of Invoice objects available for the given criteria. 
  90. * @see ResourceList 
  91. */ 
  92. static public function listInvoice($criteria = null, $authentication = null) { 
  93.  
  94. $args = func_get_args(); 
  95. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); 
  96.  
  97. $val = new Simplify_Invoice(); 
  98. $list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication); 
  99.  
  100. return $list; 
  101.  
  102.  
  103. /** 
  104. * Retrieve a Simplify_Invoice object from the API 
  105. * @param string id the id of the Invoice object to retrieve 
  106. * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> 
  107. * @return Invoice a Invoice object 
  108. */ 
  109. static public function findInvoice($id, $authentication = null) { 
  110.  
  111. $args = func_get_args(); 
  112. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); 
  113.  
  114. $val = new Simplify_Invoice(); 
  115. $val->id = $id; 
  116.  
  117. $obj = Simplify_PaymentsApi::findObject($val, $authentication); 
  118.  
  119. return $obj; 
  120.  
  121.  
  122. /** 
  123. * Updates an Simplify_Invoice object. 
  124. * The properties that can be updated: 
  125. * <dl style="padding-left:10px;"> 
  126. * <dt><tt>billingAddress.city</tt></dt> <dd>Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd> 
  127. * <dt><tt>billingAddress.country</tt></dt> <dd>Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd> 
  128. * <dt><tt>billingAddress.line1</tt></dt> <dd>Billing address line 1 of the location where the goods or services were supplied. [max length: 255] </dd> 
  129. * <dt><tt>billingAddress.line2</tt></dt> <dd>Billing address line 2 of the location where the goods or services were supplied. [max length: 255] </dd> 
  130. * <dt><tt>billingAddress.name</tt></dt> <dd>Billing address name of the location where the goods or services were supplied. [max length: 255] </dd> 
  131. * <dt><tt>billingAddress.state</tt></dt> <dd>Billing address state of the location where the goods or services were supplied. [max length: 255] </dd> 
  132. * <dt><tt>billingAddress.zip</tt></dt> <dd>Billing address zip of the location where the goods or services were supplied. [max length: 32] </dd> 
  133. * <dt><tt>businessAddress.city</tt></dt> <dd>Business address city of the business that is sending the invoice. [max length: 255, min length: 2] </dd> 
  134. * <dt><tt>businessAddress.country</tt></dt> <dd>Business address country of the business that is sending the invoice. [max length: 2, min length: 2] </dd> 
  135. * <dt><tt>businessAddress.line1</tt></dt> <dd>Business address line 1 of the business that is sending the invoice. [max length: 255] </dd> 
  136. * <dt><tt>businessAddress.line2</tt></dt> <dd>Business address line 2 of the business that is sending the invoice. [max length: 255] </dd> 
  137. * <dt><tt>businessAddress.name</tt></dt> <dd>Business address name of the business that is sending the invoice. [max length: 255] </dd> 
  138. * <dt><tt>businessAddress.state</tt></dt> <dd>Business address state of the business that is sending the invoice. [max length: 255] </dd> 
  139. * <dt><tt>businessAddress.zip</tt></dt> <dd>Business address zip of the business that is sending the invoice. [max length: 32] </dd> 
  140. * <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3] </dd> 
  141. * <dt><tt>customerTaxNo</tt></dt> <dd>The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255] </dd> 
  142. * <dt><tt>datePaid</tt></dt> <dd>This is the date the invoice was PAID in UTC millis. </dd> 
  143. * <dt><tt>discountRate</tt></dt> <dd>The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6] </dd> 
  144. * <dt><tt>dueDate</tt></dt> <dd>The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past. </dd> 
  145. * <dt><tt>email</tt></dt> <dd>The email of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. </dd> 
  146. * <dt><tt>invoiceId</tt></dt> <dd>User defined invoice id. If not provided the system will generate a numeric id. [max length: 255] </dd> 
  147. * <dt><tt>items.amount</tt></dt> <dd>Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: -9999900, max value: 9999900] <strong>required </strong></dd> 
  148. * <dt><tt>items.description</tt></dt> <dd>The description of the invoice item. [max length: 1024] </dd> 
  149. * <dt><tt>items.invoice</tt></dt> <dd>The ID of the invoice this item belongs to. </dd> 
  150. * <dt><tt>items.product</tt></dt> <dd>The Id of the product this item refers to. </dd> 
  151. * <dt><tt>items.quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1] </dd> 
  152. * <dt><tt>items.reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd> 
  153. * <dt><tt>items.tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd> 
  154. * <dt><tt>lateFee</tt></dt> <dd>The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD [max value: 9999900] </dd> 
  155. * <dt><tt>memo</tt></dt> <dd>A memo that is displayed to the customer on the invoice payment screen. [max length: 4000] </dd> 
  156. * <dt><tt>name</tt></dt> <dd>The name of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. [max length: 50, min length: 2] </dd> 
  157. * <dt><tt>note</tt></dt> <dd>This field can be used to store a note that is not displayed to the customer. [max length: 4000] </dd> 
  158. * <dt><tt>payment</tt></dt> <dd>The ID of the payment. Use this ID to query the /payment API. [max length: 255] </dd> 
  159. * <dt><tt>reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd> 
  160. * <dt><tt>shippingAddress.city</tt></dt> <dd>Address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd> 
  161. * <dt><tt>shippingAddress.country</tt></dt> <dd>Address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd> 
  162. * <dt><tt>shippingAddress.line1</tt></dt> <dd>Address line 1 of the location where the goods or services were supplied. [max length: 255] </dd> 
  163. * <dt><tt>shippingAddress.line2</tt></dt> <dd>Address line 2 of the location where the goods or services were supplied. [max length: 255] </dd> 
  164. * <dt><tt>shippingAddress.name</tt></dt> <dd>Address name of the location where the goods or services were supplied. [max length: 255] </dd> 
  165. * <dt><tt>shippingAddress.state</tt></dt> <dd>Address state of the location where the goods or services were supplied. [max length: 255] </dd> 
  166. * <dt><tt>shippingAddress.zip</tt></dt> <dd>Address zip of the location where the goods or services were supplied. [max length: 32] </dd> 
  167. * <dt><tt>status</tt></dt> <dd>New status of the invoice. </dd> 
  168. * <dt><tt>suppliedDate</tt></dt> <dd>The date on which the goods or services were supplied. </dd> 
  169. * <dt><tt>taxNo</tt></dt> <dd>The tax number or VAT id of the person who supplied the goods or services. [max length: 255] </dd></dl> 
  170. * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i> 
  171. * @return Invoice a Invoice object. 
  172. */ 
  173. public function updateInvoice($authentication = null) { 
  174.  
  175. $args = func_get_args(); 
  176. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1); 
  177.  
  178. $object = Simplify_PaymentsApi::updateObject($this, $authentication); 
  179. return $object; 
  180.  
  181. /** 
  182. * @ignore 
  183. */ 
  184. public function getClazz() { 
  185. return "Invoice";