PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.13
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.13
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
woocommerce-pos / includes / Services / Receipt_Payload_Assembler.php

Receipt_Payload_Assembler.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.13, at includes/Services/Receipt_Payload_Assembler.php

68 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Receipt payload assembler service.
4 *
5 * @package WCPOS\WooCommercePOS\Services
6 */
7
8 namespace WCPOS\WooCommercePOS\Services;
9
10 /**
11 * Receipt_Payload_Assembler class.
12 */
13 class Receipt_Payload_Assembler {
14
15 /**
16 * Assemble receipt sections in canonical payload order.
17 *
18 * @param array<string,mixed> $sections Already-computed receipt sections.
19 *
20 * @return array<string,mixed>
21 */
22 public static function assemble( array $sections ): array {
23 return array(
24 'order' => $sections['order'],
25 'store' => $sections['store'],
26 'cashier' => $sections['cashier'],
27 'customer' => $sections['customer'],
28 'lines' => $sections['lines'],
29 'fees' => $sections['fees'],
30 'shipping' => $sections['shipping'],
31 'discounts' => $sections['discounts'],
32 'totals' => $sections['totals'],
33 'tax' => $sections['tax'],
34 'tax_summary' => $sections['tax_summary'],
35 'has_tax_summary' => ! empty( $sections['tax_summary'] ),
36 'payments' => $sections['payments'],
37 'refunds' => $sections['refunds'],
38 'fiscal' => $sections['fiscal'],
39 'presentation_hints' => $sections['presentation_hints'],
40 'i18n' => Receipt_I18n_Labels::get_labels( $sections['presentation_hints']['locale'] ?? '' ),
41 );
42 }
43
44 /**
45 * Assemble fiscal values in canonical section order.
46 *
47 * @param array<string,mixed> $values Already-computed fiscal values.
48 *
49 * @return array<string,mixed>
50 */
51 public static function fiscal( array $values ): array {
52 return array(
53 'immutable_id' => $values['immutable_id'],
54 'receipt_number' => $values['receipt_number'],
55 'sequence' => $values['sequence'],
56 'hash' => $values['hash'],
57 'qr_payload' => $values['qr_payload'],
58 'tax_agency_code' => $values['tax_agency_code'],
59 'signed_at' => $values['signed_at'],
60 'signature_excerpt' => $values['signature_excerpt'],
61 'document_label' => $values['document_label'],
62 'is_reprint' => $values['is_reprint'],
63 'reprint_count' => $values['reprint_count'],
64 'extra_fields' => $values['extra_fields'],
65 );
66 }
67 }
68