PluginProbe
seQura / 3.1.1
seQura v3.1.1
4.3.4 4.3.3 4.3.2 4.3.1 trunk 2.0.0 2.0.10 2.0.11 2.0.12 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 3.0.0 3.0.2 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 4.0.0 All 30 releases
sequra / src / Services / Order / interface-order-service.php

interface-order-service.php in seQura 3.1.1, at src/Services/Order/interface-order-service.php

243 lines 6.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Order service interface
4 *
5 * @package SeQura/WC
6 * @subpackage SeQura/WC/Services
7 */
8
9 namespace SeQura\WC\Services\Order;
10
11 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Address;
12 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Customer;
13 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\DeliveryMethod;
14 use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\PreviousOrder;
15 use SeQura\WC\Dto\Cart_Info;
16 use SeQura\WC\Dto\Payment_Method_Data;
17 use WC_Order;
18
19 /**
20 * Handle use cases related to Order
21 */
22 interface Interface_Order_Service {
23
24 /**
25 * Get delivery method
26 */
27 public function get_delivery_method( ?WC_Order $order ): DeliveryMethod;
28
29 /**
30 * Get client first name. If the order is null, attempt to retrieve data from the session.
31 */
32 public function get_first_name( ?WC_Order $order, $is_delivery = true ): string;
33
34 /**
35 * Get client last name. If the order is null, attempt to retrieve data from the session.
36 */
37 public function get_last_name( ?WC_Order $order, $is_delivery = true ): string;
38
39 /**
40 * Get client company. If the order is null, attempt to retrieve data from the session.
41 */
42 public function get_company( ?WC_Order $order, $is_delivery = true ): string;
43
44 /**
45 * Get client address's first line. If the order is null, attempt to retrieve data from the session.
46 */
47 public function get_address_1( ?WC_Order $order, $is_delivery = true ): string;
48
49 /**
50 * Get client address's second line. If the order is null, attempt to retrieve data from the session.
51 */
52 public function get_address_2( ?WC_Order $order, $is_delivery = true ): string;
53
54 /**
55 * Get client postcode. If the order is null, attempt to retrieve data from the session.
56 */
57 public function get_postcode( ?WC_Order $order, $is_delivery = true ): string;
58
59 /**
60 * Get client city. If the order is null, attempt to retrieve data from the session.
61 */
62 public function get_city( ?WC_Order $order, $is_delivery = true ): string;
63
64 /**
65 * Get client country code. If the order is null, attempt to retrieve data from the session.
66 */
67 public function get_country( ?WC_Order $order, $is_delivery = true ): string;
68
69 /**
70 * Get client state. If the order is null, attempt to retrieve data from the session.
71 */
72 public function get_state( ?WC_Order $order, $is_delivery = true ): string;
73
74 /**
75 * Get client phone. If the order is null, attempt to retrieve data from the session.
76 */
77 public function get_phone( ?WC_Order $order, $is_delivery = true ): string;
78
79 /**
80 * Get client email. If the order is null, attempt to retrieve data from the session.
81 */
82 public function get_email( ?WC_Order $order ): string;
83
84 /**
85 * Get client vat number. If the order is null, attempt to retrieve data from the session.
86 */
87 public function get_vat( ?WC_Order $order, $is_delivery = true ): string;
88
89 /**
90 * Get client NIN number. If the order is null, attempt to retrieve data from the session.
91 */
92 public function get_nin( ?WC_Order $order ): ?string;
93
94 /**
95 * Get date of birth. If the order is null, attempt to retrieve data from the session.
96 */
97 public function get_dob( ?WC_Order $order ): ?string;
98
99 /**
100 * Get shopper title. If the order is null, attempt to retrieve data from the session.
101 */
102 public function get_shopper_title( ?WC_Order $order ): ?string;
103
104 /**
105 * Get shopper created at date. If the order is null, attempt to retrieve data from the session.
106 */
107 public function get_shopper_created_at( ?WC_Order $order ): ?string;
108
109 /**
110 * Get shopper updated at date. If the order is null, attempt to retrieve data from the session.
111 */
112 public function get_shopper_updated_at( ?WC_Order $order ): ?string;
113
114 /**
115 * Get shopper rating. If the order is null, attempt to retrieve data from the session.
116 */
117 public function get_shopper_rating( ?WC_Order $order ): ?int;
118
119 /**
120 * Get previous orders
121 *
122 * @return PreviousOrder[]
123 */
124 public function get_previous_orders( int $customer_id ): array;
125
126 /**
127 * Get the seQura payment method title for the order.
128 * If the order is not a seQura order an empty string is returned.
129 */
130 public function get_payment_method_title( WC_Order $order ): string;
131
132 /**
133 * Get the seQura product for the order.
134 * If the value is not found an empty string is returned.
135 */
136 public function get_product( WC_Order $order ): string;
137
138 /**
139 * Get the seQura campaign for the order.
140 * If the value is not found an empty string is returned.
141 */
142 public function get_campaign( WC_Order $order ): string;
143
144 /**
145 * Save required metadata for the order.
146 * Returns true if the metadata was saved, false otherwise.
147 */
148 public function set_order_metadata( WC_Order $order, ?Payment_Method_Data $data, ?Cart_Info $cart_info ): bool;
149
150 /**
151 * Get the seQura cart info for the order.
152 * If the value is not found null is returned.
153 */
154 public function get_cart_info( WC_Order $order ): ?Cart_Info;
155
156 /**
157 * Set cart info for the order
158 *
159 * @param Cart_Info $cart_info Cart info
160 */
161 public function set_cart_info( WC_Order $order, $cart_info ): void;
162
163 /**
164 * Set cart info if it is not already set
165 */
166 public function create_cart_info( WC_Order $order ): ?Cart_Info;
167
168 /**
169 * Get payment gateway webhook identifier
170 */
171 public function get_ipn_url( WC_Order $order, string $store_id ): string;
172
173 /**
174 * Get payment gateway webhook identifier
175 */
176 public function get_return_url( WC_Order $order ): string;
177
178 /**
179 * Get payment gateway webhook identifier
180 */
181 public function get_event_url( WC_Order $order, string $store_id ): string;
182
183 /**
184 * Get the meta key used to store the sent to seQura value.
185 */
186 public function get_sent_to_sequra_meta_key(): string;
187
188 /**
189 * Get customer for the order
190 */
191 public function get_customer( ?WC_Order $order, string $lang, int $fallback_user_id = 0, string $fallback_ip = '', string $fallback_user_agent = '' ): Customer;
192
193 /**
194 * Get delivery or invoice address
195 */
196 public function get_address( ?WC_Order $order, bool $is_delivery ): Address;
197
198 /**
199 * Set the order as sent to seQura
200 */
201 public function set_as_sent_to_sequra( WC_Order $order ): void;
202
203 /**
204 * Call the Order Update API to sync the order status with SeQura
205 */
206 public function update_sequra_order_status( WC_Order $order, string $old_store_status, string $new_store_status ): void;
207
208 /**
209 * Update the order amount in SeQura after a refund
210 *
211 * @throws Throwable
212 */
213 public function handle_refund( WC_Order $order, float $amount ): void;
214
215 /**
216 * Get the link to the SeQura back office for the order
217 */
218 public function get_link_to_sequra_back_office( WC_Order $order ): ?string;
219
220 /**
221 * Get the total amount of the order
222 *
223 * @param WC_Order $order
224 * @return float|int
225 */
226 public function get_total( $order, $in_cents = true );
227
228 /**
229 * Cleanup orders
230 *
231 * @return void
232 */
233 public function cleanup_orders();
234
235 /**
236 * Get the Merchant ID
237 *
238 * @param WC_Order $order
239 * @return string
240 */
241 public function get_merchant_id( $order );
242 }
243