Пример #1
0
 public function testCreateCompound()
 {
     $subscription = self::$entities['subscription'];
     // Create model of coupon
     // unique name for test
     $uniqueString = time();
     $couponCode = "TEST2_{$uniqueString}";
     $coupon = new Bf_Coupon(array('name' => '3 Months free', 'couponCode' => $couponCode, 'coupons' => 100, 'uses' => 3));
     $coupon->setRatePlan('Gold membership');
     // $5 off CPU
     $coupon->addCashDiscount("CPU", 5);
     // 5 Mbps free P2P Traffic
     $coupon->addFreeUnitsDiscount("P2P Traffic", 5);
     // 10 Mbps free bandwidth
     $coupon->addFreeUnitsDiscount("Bandwidth", 10);
     $createdCoupon = Bf_Coupon::create($coupon);
 }