Add PayPal support for add-on and gift voucher checkout
This commit is contained in:
@@ -15,6 +15,8 @@ class GiftVoucher extends Model
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
public const STATUS_PENDING = 'pending';
|
||||
|
||||
public const STATUS_ISSUED = 'issued';
|
||||
|
||||
public const STATUS_REDEEMED = 'redeemed';
|
||||
@@ -35,6 +37,8 @@ class GiftVoucher extends Model
|
||||
'lemonsqueezy_order_id',
|
||||
'lemonsqueezy_checkout_id',
|
||||
'lemonsqueezy_variant_id',
|
||||
'paypal_order_id',
|
||||
'paypal_capture_id',
|
||||
'coupon_id',
|
||||
'expires_at',
|
||||
'redeemed_at',
|
||||
@@ -89,6 +93,10 @@ class GiftVoucher extends Model
|
||||
|
||||
public function canBeRedeemed(): bool
|
||||
{
|
||||
if ($this->status !== self::STATUS_ISSUED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ! $this->isRedeemed() && ! $this->isRefunded() && ! $this->isExpired();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user