PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.5.2
LatePoint – Calendar Booking Plugin for Appointments and Events v5.5.2
5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / abilities / orders / abstract-order-ability.php
latepoint / lib / abilities / orders Last commit date
abstract-order-ability.php 3 months ago change-invoice-status.php 3 months ago change-order-status.php 3 months ago create-invoice.php 3 months ago create-order.php 3 months ago delete-order.php 3 months ago get-invoice.php 3 months ago get-order-price-breakdown.php 3 months ago get-order.php 3 months ago get-transaction.php 3 months ago list-invoices.php 3 months ago list-orders.php 3 months ago list-transactions.php 3 months ago refund-transaction.php 3 months ago update-order.php 3 months ago
abstract-order-ability.php
99 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 abstract class LatePointAbstractOrderAbility extends LatePointAbstractAbility {
7
8 public function serialize_order( OsOrderModel $o ): array {
9 return [
10 'id' => (int) $o->id,
11 'status' => $o->status ?? '',
12 'payment_status' => $o->payment_status ?? '',
13 'fulfillment_status' => $o->fulfillment_status ?? '',
14 'customer_id' => (int) ( $o->customer_id ?? 0 ),
15 'subtotal' => (float) ( $o->subtotal ?? 0 ),
16 'total' => (float) ( $o->total ?? 0 ),
17 'notes' => $o->customer_comment ?? '',
18 'created_at' => ! empty( $o->created_at ) ? date( 'c', strtotime( $o->created_at ) ) : '',
19 'updated_at' => ! empty( $o->updated_at ) ? date( 'c', strtotime( $o->updated_at ) ) : '',
20 ];
21 }
22
23 public function serialize_invoice( OsInvoiceModel $i ): array {
24 $order = $i->order_id ? new OsOrderModel( (int) $i->order_id ) : new OsOrderModel();
25 $customer_id = ( $order && ! $order->is_new_record() ) ? (int) $order->customer_id : 0;
26 return [
27 'id' => (int) $i->id,
28 'order_id' => (int) ( $i->order_id ?? 0 ),
29 'customer_id' => $customer_id,
30 'status' => $i->status ?? '',
31 'subtotal' => (float) ( $i->charge_amount ?? 0 ),
32 'total' => (float) ( $i->charge_amount ?? 0 ),
33 'due_date' => ! empty( $i->due_at ) ? date( 'c', strtotime( $i->due_at ) ) : '',
34 'created_at' => ! empty( $i->created_at ) ? date( 'c', strtotime( $i->created_at ) ) : '',
35 ];
36 }
37
38 public function serialize_transaction( OsTransactionModel $t ): array {
39 return [
40 'id' => (int) $t->id,
41 'order_id' => (int) ( $t->order_id ?? 0 ),
42 'customer_id' => (int) ( $t->customer_id ?? 0 ),
43 'status' => $t->status ?? '',
44 'payment_method' => $t->payment_method ?? '',
45 'amount' => (float) ( $t->amount ?? 0 ),
46 'created_at' => ! empty( $t->created_at ) ? date( 'c', strtotime( $t->created_at ) ) : '',
47 ];
48 }
49
50 protected function order_output_schema(): array {
51 return [
52 'type' => 'object',
53 'properties' => [
54 'id' => [ 'type' => 'integer' ],
55 'status' => [ 'type' => 'string' ],
56 'payment_status' => [ 'type' => 'string' ],
57 'fulfillment_status' => [ 'type' => 'string' ],
58 'customer_id' => [ 'type' => 'integer' ],
59 'subtotal' => [ 'type' => 'number' ],
60 'total' => [ 'type' => 'number' ],
61 'notes' => [ 'type' => 'string' ],
62 'created_at' => [ 'type' => 'string' ],
63 'updated_at' => [ 'type' => 'string' ],
64 ],
65 ];
66 }
67
68 protected function invoice_output_schema(): array {
69 return [
70 'type' => 'object',
71 'properties' => [
72 'id' => [ 'type' => 'integer' ],
73 'order_id' => [ 'type' => 'integer' ],
74 'customer_id' => [ 'type' => 'integer' ],
75 'status' => [ 'type' => 'string' ],
76 'subtotal' => [ 'type' => 'number' ],
77 'total' => [ 'type' => 'number' ],
78 'due_date' => [ 'type' => 'string' ],
79 'created_at' => [ 'type' => 'string' ],
80 ],
81 ];
82 }
83
84 protected function transaction_output_schema(): array {
85 return [
86 'type' => 'object',
87 'properties' => [
88 'id' => [ 'type' => 'integer' ],
89 'order_id' => [ 'type' => 'integer' ],
90 'customer_id' => [ 'type' => 'integer' ],
91 'status' => [ 'type' => 'string' ],
92 'payment_method' => [ 'type' => 'string' ],
93 'amount' => [ 'type' => 'number' ],
94 'created_at' => [ 'type' => 'string' ],
95 ],
96 ];
97 }
98 }
99