Simplify_Plan

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/Plan.php  
  1. class Simplify_Plan extends Simplify_Object { 
  2. /** 
  3. * Creates an Simplify_Plan object 
  4. * @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;"> 
  5. * <dt><tt>amount</tt></dt> <dd>Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00USD <strong>required </strong></dd> 
  6. * <dt><tt>billingCycle</tt></dt> <dd>How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO] </dd> 
  7. * <dt><tt>billingCycleLimit</tt></dt> <dd>The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 </dd> 
  8. * <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217) for the plan. Must match the currency associated with your account. [default: USD] <strong>required </strong></dd> 
  9. * <dt><tt>frequency</tt></dt> <dd>Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". [default: MONTHLY] <strong>required </strong></dd> 
  10. * <dt><tt>frequencyPeriod</tt></dt> <dd>Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1, default: 1] <strong>required </strong></dd> 
  11. * <dt><tt>name</tt></dt> <dd>Name of the plan [max length: 50, min length: 2] <strong>required </strong></dd> 
  12. * <dt><tt>renewalReminderLeadDays</tt></dt> <dd>If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set. </dd> 
  13. * <dt><tt>trialPeriod</tt></dt> <dd>Plan free trial period selection. Must be Days, Weeks, or Month [default: NONE] <strong>required </strong></dd> 
  14. * <dt><tt>trialPeriodQuantity</tt></dt> <dd>Quantity of the trial period. Must be greater than 0 and a whole number. [min value: 1] </dd></dl> 
  15. * @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/> 
  16. * @return Plan a Plan object. 
  17. */ 
  18. static public function createPlan($hash, $authentication = null) { 
  19.  
  20. $args = func_get_args(); 
  21. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); 
  22.  
  23. $instance = new Simplify_Plan(); 
  24. $instance->setAll($hash); 
  25.  
  26. $object = Simplify_PaymentsApi::createObject($instance, $authentication); 
  27. return $object; 
  28.  
  29.  
  30.  
  31.  
  32. /** 
  33. * Deletes an Simplify_Plan object. 
  34. * @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> 
  35. */ 
  36. public function deletePlan($authentication = null) { 
  37.  
  38. $args = func_get_args(); 
  39. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1); 
  40.  
  41. $obj = Simplify_PaymentsApi::deleteObject($this, $authentication); 
  42. $this->properties = null; 
  43. return true; 
  44.  
  45.  
  46. /** 
  47. * Retrieve Simplify_Plan objects. 
  48. * @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;"> 
  49. * <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd> 
  50. * <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> 
  51. * <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> 
  52. * <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> dateCreated</tt><tt> amount</tt><tt> frequency</tt><tt> name</tt><tt> id</tt>.</dd></dl> 
  53. * @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> 
  54. * @return ResourceList a ResourceList object that holds the list of Plan objects and the total 
  55. * number of Plan objects available for the given criteria. 
  56. * @see ResourceList 
  57. */ 
  58. static public function listPlan($criteria = null, $authentication = null) { 
  59.  
  60. $args = func_get_args(); 
  61. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); 
  62.  
  63. $val = new Simplify_Plan(); 
  64. $list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication); 
  65.  
  66. return $list; 
  67.  
  68.  
  69. /** 
  70. * Retrieve a Simplify_Plan object from the API 
  71. * @param string id the id of the Plan object to retrieve 
  72. * @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> 
  73. * @return Plan a Plan object 
  74. */ 
  75. static public function findPlan($id, $authentication = null) { 
  76.  
  77. $args = func_get_args(); 
  78. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); 
  79.  
  80. $val = new Simplify_Plan(); 
  81. $val->id = $id; 
  82.  
  83. $obj = Simplify_PaymentsApi::findObject($val, $authentication); 
  84.  
  85. return $obj; 
  86.  
  87.  
  88. /** 
  89. * Updates an Simplify_Plan object. 
  90. * The properties that can be updated: 
  91. * <dl style="padding-left:10px;"> 
  92. * <dt><tt>name</tt></dt> <dd>Name of the plan. [min length: 2] <strong>required </strong></dd></dl> 
  93. * @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> 
  94. * @return Plan a Plan object. 
  95. */ 
  96. public function updatePlan($authentication = null) { 
  97.  
  98. $args = func_get_args(); 
  99. $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1); 
  100.  
  101. $object = Simplify_PaymentsApi::updateObject($this, $authentication); 
  102. return $object; 
  103.  
  104. /** 
  105. * @ignore 
  106. */ 
  107. public function getClazz() { 
  108. return "Plan";