Exemplo n.º 1
0
 public static function getApplicableCouponsForSubscription($subscription, $options = NULL, $customClient = NULL)
 {
     $subscriptionID = Bf_Subscription::getIdentifier($subscription);
     $endpoint = sprintf("%s/applicable-coupons", rawurlencode($subscriptionID));
     $responseEntity = Bf_Coupon::getClassName();
     return static::getCollection($endpoint, $options, $customClient, $responseEntity);
 }
Exemplo n.º 2
0
 public static function applyCouponToSubscription(Bf_Coupon $coupon, $subscription)
 {
     $subscriptionID = Bf_Subscription::getIdentifier($subscription);
     // make new Bf_Coupon using only the `couponCode` param
     $requestEntity = new Bf_Coupon(array('couponCode' => $coupon->couponCode), $coupon->getClient());
     $endpoint = sprintf("%s/coupons", rawurlencode($subscriptionID));
     $responseEntity = Bf_Coupon::getClassName();
     $constructedEntity = static::postEntityAndGrabFirst($endpoint, $requestEntity, $responseEntity);
     return $constructedEntity;
 }