PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.28
Booktics – Appointment Booking Calendar for Service Businesses v1.0.28
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
← All changes | core/payment/payment-methods/abstract-payment-method.php +35 -0 1.0.21 → 1.0.28 View file →
@@ -2,15 +2,50 @@
2 2
3 3 namespace Booktics\Payment\Payment_Methods;
4 4
5 5 use Booktics\Payment\Contracts\Payment_Method_Interface;
6 +use Booktics\Payment\Payment_Status;
6 7 use Booktics\Models\Order_Model;
7 8
8 9 abstract class Abstract_Payment_Method implements Payment_Method_Interface {
9 10
11 + /**
12 + * The unpaid order was actually paid — repair it, do not release the slot.
13 + */
14 + const RESERVATION_REPAIR = 'repair';
15 +
16 + /**
17 + * The customer never completed payment — release the held slot.
18 + */
19 + const RESERVATION_RELEASE = 'release';
20 +
21 + /**
22 + * Payment is still legitimately in progress — keep the slot and re-check later.
23 + */
24 + const RESERVATION_WAIT = 'wait';
25 +
10 26 protected $id;
11 27 protected $name;
12 28 private $order;
29 +
30 + /**
31 + * Decide what to do with a slot held by an unpaid order that has passed the
32 + * reservation timeout: repair (payment actually went through), release (free
33 + * the slot), or wait (payment still genuinely in progress — check again later).
34 + *
35 + * Default implementation infers the action from get_payment_status(). Gateways
36 + * with richer lifecycle states (e.g. Stripe's 3D-Secure flow) should override
37 + * this to avoid canceling a customer who is mid-payment.
38 + *
39 + * @param Order_Model $order The order whose reservation is being evaluated.
40 + *
41 + * @return string One of the RESERVATION_* constants.
42 + */
43 + public function resolve_reservation_action( $order ): string {
44 + return Payment_Status::COMPLETED === $this->get_payment_status( $order )
45 + ? self::RESERVATION_REPAIR
46 + : self::RESERVATION_RELEASE;
47 + }
13 48
14 49 /**
15 50 * Get the unique identifier for this payment method
16 51 *