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

132 lines 3.0 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\WC\Dto\Cart_Info;
12 use SeQura\WC\Dto\Payment_Method_Data;
13 use WC_Order;
14
15 /**
16 * Handle use cases related to Order
17 */
18 interface Interface_Order_Service {
19
20 /**
21 * Get the seQura payment method title for the order.
22 * If the order is not a seQura order an empty string is returned.
23 */
24 public function get_payment_method_title( WC_Order $order ): string;
25
26 /**
27 * Get the seQura product for the order.
28 * If the value is not found an empty string is returned.
29 */
30 public function get_product( WC_Order $order ): string;
31
32 /**
33 * Get the seQura campaign for the order.
34 * If the value is not found an empty string is returned.
35 */
36 public function get_campaign( WC_Order $order ): string;
37
38 /**
39 * Save required metadata for the order.
40 * Returns true if the metadata was saved, false otherwise.
41 */
42 public function set_order_metadata( WC_Order $order, ?Payment_Method_Data $data, ?Cart_Info $cart_info ): bool;
43
44 /**
45 * Get the seQura cart info for the order.
46 * If the value is not found null is returned.
47 */
48 public function get_cart_info( WC_Order $order ): ?Cart_Info;
49
50 /**
51 * Set cart info for the order
52 *
53 * @param Cart_Info $cart_info Cart info
54 */
55 public function set_cart_info( WC_Order $order, $cart_info ): void;
56
57 /**
58 * Set cart info if it is not already set
59 */
60 public function create_cart_info( WC_Order $order ): ?Cart_Info;
61
62 /**
63 * Get the meta key used to store the sent to seQura value.
64 */
65 public function get_sent_to_sequra_meta_key(): string;
66
67 /**
68 * Set the order as sent to seQura
69 */
70 public function set_as_sent_to_sequra( WC_Order $order ): void;
71
72 /**
73 * Call the Order Update API to sync the order status with SeQura
74 */
75 public function update_sequra_order_status( WC_Order $order, string $old_store_status, string $new_store_status ): void;
76
77 /**
78 * Update the order amount in SeQura after a refund
79 *
80 * @throws Throwable
81 */
82 public function handle_refund( WC_Order $order, float $amount ): void;
83
84 /**
85 * Get the link to the SeQura back office for the order
86 */
87 public function get_link_to_sequra_back_office( WC_Order $order ): ?string;
88
89 /**
90 * Get the total amount of the order
91 *
92 * @param WC_Order $order
93 * @return float|int
94 */
95 public function get_total( $order, $in_cents = true );
96
97 /**
98 * Cleanup orders
99 *
100 * @return void
101 */
102 public function cleanup_orders();
103
104 /**
105 * Get the Merchant ID
106 *
107 * @param WC_Order $order
108 * @return string
109 */
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 );
131 }
132