Add PayPal support for add-on and gift voucher checkout

This commit is contained in:
Codex Agent
2026-02-04 14:54:40 +01:00
parent 7025418d9e
commit 17025df47b
24 changed files with 1599 additions and 34 deletions

View File

@@ -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();
}