예제 #1
0
 /**
  * Creates an Simplify_Coupon object
  * @param     array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
  *     <dt><tt>amountOff</tt></dt>    <dd>Amount off of the price of the product in minor units in the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 1000 = 10.00 </dd>
  *     <dt><tt>couponCode</tt></dt>    <dd>Code that identifies the coupon to be used. <strong>required </strong></dd>
  *     <dt><tt>description</tt></dt>    <dd>A brief section that describes the coupon. </dd>
  *     <dt><tt>durationInMonths</tt></dt>    <dd>Duration in months that the coupon will be applied after it has first been selected. </dd>
  *     <dt><tt>endDate</tt></dt>    <dd>Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone. </dd>
  *     <dt><tt>maxRedemptions</tt></dt>    <dd>Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. </dd>
  *     <dt><tt>percentOff</tt></dt>    <dd>Percentage off of the price of the product. While this field is optional, you must provide either amountOff or percentOff for a coupon. The percent off is a whole number. </dd>
  *     <dt><tt>startDate</tt></dt>    <dd>First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone. <strong>required </strong></dd></dl>
  * @param     string publicKey Public key. If null, the value of static Simplify::$publicKey will be used
  * @param     string privateKey Private key. If null, the value of static Simplify::$privateKey will be used
  * @return    Coupon a Coupon object.
  */
 public static function createCoupon($hash, $publicKey = null, $privateKey = null)
 {
     $instance = new Simplify_Coupon();
     $instance->setAll($hash);
     $object = Simplify_PaymentsApi::createObject($instance, $publicKey, $privateKey);
     return $object;
 }
예제 #2
0
 /**
  * Creates an Simplify_Coupon object
  * @param     array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
  *     <dt><tt>amountOff</tt></dt>    <dd>Amount off of the price of the product in the smallest units of the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 100 = $1.00USD [min value: 1] </dd>
  *     <dt><tt>couponCode</tt></dt>    <dd>Code that identifies the coupon to be used. [min length: 2] <strong>required </strong></dd>
  *     <dt><tt>description</tt></dt>    <dd>A brief section that describes the coupon. </dd>
  *     <dt><tt>durationInMonths</tt></dt>    <dd>DEPRECATED - Duration in months that the coupon will be applied after it has first been selected. [min value: 1, max value: 9999] </dd>
  *     <dt><tt>endDate</tt></dt>    <dd>Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone. </dd>
  *     <dt><tt>maxRedemptions</tt></dt>    <dd>Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. [min value: 1] </dd>
  *     <dt><tt>numTimesApplied</tt></dt>    <dd>The number of times a coupon will be applied on a customer's subscription. [min value: 1, max value: 9999] </dd>
  *     <dt><tt>percentOff</tt></dt>    <dd>Percentage off of the price of the product. While this field is optional, you must provide either amountOff or percentOff for a coupon. The percent off is a whole number. [min value: 1, max value: 100] </dd>
  *     <dt><tt>startDate</tt></dt>    <dd>First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone. <strong>required </strong></dd></dl>
  * @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/>
  * @return    Coupon a Coupon object.
  */
 public static function createCoupon($hash, $authentication = null)
 {
     $args = func_get_args();
     $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
     $instance = new Simplify_Coupon();
     $instance->setAll($hash);
     $object = Simplify_PaymentsApi::createObject($instance, $authentication);
     return $object;
 }