PluginProbe
seQura / 3.0.2
seQura v3.0.2
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.0.2, at src/Services/Order/interface-order-service.php

213 lines 6.4 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 if it is not already set
158 */
159 public function create_cart_info( WC_Order $order ): ?Cart_Info;
160
161 /**
162 * Get payment gateway webhook identifier
163 */
164 public function get_ipn_url( WC_Order $order, string $store_id ): string;
165
166 /**
167 * Get payment gateway webhook identifier
168 */
169 public function get_return_url( WC_Order $order ): string;
170
171 /**
172 * Get payment gateway webhook identifier
173 */
174 public function get_event_url( WC_Order $order, string $store_id ): string;
175
176 /**
177 * Get the meta key used to store the sent to seQura value.
178 */
179 public function get_sent_to_sequra_meta_key(): string;
180
181 /**
182 * Get customer for the order
183 */
184 public function get_customer( ?WC_Order $order, string $lang, int $fallback_user_id = 0, string $fallback_ip = '', string $fallback_user_agent = '' ): Customer;
185
186 /**
187 * Get delivery or invoice address
188 */
189 public function get_address( ?WC_Order $order, bool $is_delivery ): Address;
190
191 /**
192 * Set the order as sent to seQura
193 */
194 public function set_as_sent_to_sequra( WC_Order $order ): void;
195
196 /**
197 * Call the Order Update API to sync the order status with SeQura
198 */
199 public function update_sequra_order_status( WC_Order $order, string $old_store_status, string $new_store_status ): void;
200
201 /**
202 * Update the order amount in SeQura after a refund
203 *
204 * @throws Throwable
205 */
206 public function handle_refund( WC_Order $order, float $amount ): void;
207
208 /**
209 * Get the link to the SeQura back office for the order
210 */
211 public function get_link_to_sequra_back_office( WC_Order $order ): ?string;
212 }
213