| @@ -7,12 +7,8 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | namespace SeQura\WC\Services\Order; |
| 10 | 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 | 11 | use SeQura\WC\Dto\Cart_Info; |
| 16 | 12 | use SeQura\WC\Dto\Payment_Method_Data; |
| 17 | 13 | use WC_Order; |
| 18 | 14 | |
| @@ -21,110 +17,8 @@ | ||
| 21 | 17 | */ |
| 22 | 18 | interface Interface_Order_Service { |
| 23 | 19 | |
| 24 | 20 | /** |
| 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 | 21 | * Get the seQura payment method title for the order. |
| 128 | 22 | * If the order is not a seQura order an empty string is returned. |
| 129 | 23 | */ |
| 130 | 24 | public function get_payment_method_title( WC_Order $order ): string; |
| @@ -163,40 +57,15 @@ | ||
| 163 | 57 | /** |
| 164 | 58 | * Set cart info if it is not already set |
| 165 | 59 | */ |
| 166 | 60 | 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 | 61 | |
| 173 | 62 | /** |
| 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 | 63 | * Get the meta key used to store the sent to seQura value. |
| 185 | 64 | */ |
| 186 | 65 | public function get_sent_to_sequra_meta_key(): string; |
| 187 | 66 | |
| 188 | 67 | /** |
| 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 | 68 | * Set the order as sent to seQura |
| 200 | 69 | */ |
| 201 | 70 | public function set_as_sent_to_sequra( WC_Order $order ): void; |
| 202 | 71 | |
| @@ -237,6 +106,26 @@ | ||
| 237 | 106 | * |
| 238 | 107 | * @param WC_Order $order |
| 239 | 108 | * @return string |
| 240 | 109 | */ |
| 241 | - public function get_merchant_id( $order ); | |
| 110 | + public function get_merchant_id( $order ); | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * Check if the migration process is complete | |
| 114 | + * | |
| 115 | + * @return bool True if they are missing indexes, false otherwise | |
| 116 | + */ | |
| 117 | + public function is_migration_complete(); | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * Execute the migration process | |
| 121 | + */ | |
| 122 | + public function migrate_data(); | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * Get the order completion date or current date if not completed. | |
| 126 | + * | |
| 127 | + * @param WC_Order $order | |
| 128 | + * @return string | |
| 129 | + */ | |
| 130 | + public function get_order_completion_date( $order ); | |
| 242 | 131 | } |