class-wc-payments-printed-receipt-sample-order.php
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Class WC_Payments_Printed_Receipt_Sample_Order
*
* @package WooCommerce\Payments
*/
defined( 'ABSPATH' ) || exit;
/**
* This class represents a sample order to be used when generating a preview of a printed receipt.
*
* @see WC_REST_Payments_Reader_Controller::preview_print_receipt
*/
class WC_Payments_Printed_Receipt_Sample_Order extends WC_Order {
const PREVIEW_RECEIPT_ORDER_DATA = [
'id' => '42',
'currency' => 'USD',
'subtotal' => 0,
'line_items' => [
[
'name' => 'Sample',
'quantity' => 1,
'subtotal' => 0,
'product' => [
'price' => 0,
'regular_price' => 1,
'id' => 'sample',
],
],
[
'name' => 'Sample',
'quantity' => 1,
'subtotal' => 0,
'product' => [
'price' => 0,
'regular_price' => 1,
'id' => 'sample',
],
],
],
'coupon_lines' => [
[
'code' => 'DISCOUNT',
'description' => 'sample',
'discount' => 0,
],
],
'tax_lines' => [
[
'rate_percent' => 0,
'tax_total' => '0',
],
],
'total' => 0,
'shipping_tax' => 0,
'total_fees' => 0,
];
/**
* __construct
*/
public function __construct() {
// noop.
}
/**
* Returns order data
*
* @return array
*/
public function get_data(): array {
return self::PREVIEW_RECEIPT_ORDER_DATA;
}
}