PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.2
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.2
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
fluent-cart / app / Modules / PaymentMethods / Core / AbstractSubscriptionModule.php

AbstractSubscriptionModule.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.2, at app/Modules/PaymentMethods/Core/AbstractSubscriptionModule.php

115 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Modules\PaymentMethods\Core;
4
5 use FluentCart\App\Models\Subscription;
6
7 abstract class AbstractSubscriptionModule
8 {
9 /**
10 * @throws \Exception
11 */
12 public function fetchSubscription($data, $order, $subscription)
13 {
14 throw new \Exception(esc_html__('Subscription fetching not available for this method!', 'fluent-cart'), 404);
15 }
16
17 /**
18 * @throws \Exception
19 */
20 public function cardUpdate($data, $subscriptionId)
21 {
22 throw new \Exception(esc_html__('No valid payment method to update!', 'fluent-cart'), 404);
23 }
24
25 /**
26 * @throws \Exception
27 */
28 public function switchPaymentMethod($data, $subscriptionId)
29 {
30 throw new \Exception(esc_html__('No valid payment method to switch!', 'fluent-cart'), 404);
31 }
32
33 /**
34 * @throws \Exception
35 */
36 public function reactivateSubscription($data, $subscriptionId)
37 {
38 throw new \Exception(esc_html__('No valid payment method to reactivate!', 'fluent-cart'), 404);
39 }
40
41 /**
42 * @throws \Exception
43 */
44 public function pauseSubscription($data, $order, $subscription)
45 {
46 throw new \Exception(esc_html__('No valid payment method to pause!', 'fluent-cart'), 404);
47 }
48
49 /**
50 * @throws \Exception
51 */
52 public function resumeSubscription($data, $order, $subscription)
53 {
54 throw new \Exception(esc_html__('No valid payment method to resume!', 'fluent-cart'), 404);
55 }
56
57 public function cancel($vendorSubscriptionId, $args = [])
58 {
59 return new \WP_Error(
60 'not_implemented',
61 esc_html__('Cancel subscription is not implemented for this payment method.', 'fluent-cart')
62 );
63 }
64
65 /**
66 * @throws \Exception
67 */
68 public function cancelSubscription($data, $order, $subscription)
69 {
70 throw new \Exception(esc_html__('No valid payment method to cancel!', 'fluent-cart'), 404);
71 }
72
73 public function cancelOnPlanChange($vendorSubscriptionId, $parentOrderId, $subscriptionId, $reason)
74 {
75 // cancel the subscription on the vendor side, implement on the child class
76 }
77
78 public function cancelAutoRenew($subscription)
79 {
80 // cancel the subscription on the vendor side, implement on the child class
81 }
82
83 public function cancelOnSwitchPaymentMethod($currentVendorSubscriptionId, $parentOrderId, $vendorSubscriptionId, $newPaymentMethod, $reason)
84 {
85 // cancel the subscription on the vendor side, implement on the child class
86 }
87
88 public function reSyncSubscriptionFromRemote(Subscription $subscriptionModel)
89 {
90 return new \WP_Error(
91 'not_implemented',
92 esc_html__('Re-sync subscription from remote is not implemented for this payment method.', 'fluent-cart')
93 );
94 }
95
96 /**
97 * Read-only lookup of a candidate vendor subscription id, used by the admin
98 * "Edit Vendor IDs" verify action before the id is saved. Writes nothing.
99 * Only reached when the gateway declares the verify_vendor_ids feature.
100 *
101 * $args carries both candidate ids because some gateways nest the
102 * subscription under its customer.
103 *
104 * @param array $args vendor_subscription_id, vendor_customer_id
105 * @return array|\WP_Error normalized id/status/amount/currency/customer_id/next_billing_date
106 */
107 public function verifyVendorSubscription(array $args, $mode = 'current')
108 {
109 return new \WP_Error(
110 'not_implemented',
111 esc_html__('Vendor subscription lookup is not implemented for this payment method.', 'fluent-cart')
112 );
113 }
114 }
115