%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /home/addictionfreeind/www/admin1/vendor/laravel/cashier/src/Concerns/ |
Upload File : |
<?php
namespace Laravel\Cashier\Concerns;
trait AllowsCoupons
{
/**
* The coupon ID being applied.
*
* @var string|null
*/
public $couponId;
/**
* The promotion code ID being applied.
*
* @var string|null
*/
public $promotionCodeId;
/**
* Determines if user redeemable promotion codes are available in Stripe Checkout.
*
* @var bool
*/
public $allowPromotionCodes = false;
/**
* The coupon ID to be applied.
*
* @param string $couponId
* @return $this
*/
public function withCoupon($couponId)
{
$this->couponId = $couponId;
return $this;
}
/**
* The promotion code ID to apply.
*
* @param string $promotionCodeId
* @return $this
*/
public function withPromotionCode($promotionCodeId)
{
$this->promotionCodeId = $promotionCodeId;
return $this;
}
/**
* Enables user redeemable promotion codes for a Stripe Checkout session.
*
* @return $this
*/
public function allowPromotionCodes()
{
$this->allowPromotionCodes = true;
return $this;
}
/**
* Return the discounts for a Stripe Checkout session.
*
* @return array[]|null
*/
protected function checkoutDiscounts()
{
if ($this->couponId) {
return [['coupon' => $this->couponId]];
}
if ($this->promotionCodeId) {
return [['promotion_code' => $this->promotionCodeId]];
}
}
}