| @@ -42,9 +42,9 @@ | ||
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Receipt data schema contract version. |
| 45 | 45 | */ |
| 46 | - const SCHEMA_VERSION = '1.1.0'; | |
| 46 | + const SCHEMA_VERSION = '1.2.0'; | |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Money keys that must be present in totals. |
| 50 | 50 | */ |
| @@ -803,25 +803,29 @@ | ||
| 803 | 803 | 'discounts' => array( |
| 804 | 804 | 'label' => /* translators: Label for a receipt data field in the template editor. */ __( 'Discounts', 'woocommerce-pos' ), |
| 805 | 805 | 'is_array' => true, |
| 806 | 806 | 'fields' => array( |
| 807 | - 'label' => array( | |
| 807 | + 'label' => array( | |
| 808 | 808 | 'type' => 'string', |
| 809 | 809 | 'label' => /* translators: Label for a receipt data field in the template editor. */ __( 'Discount Label', 'woocommerce-pos' ), |
| 810 | 810 | ), |
| 811 | - 'code' => array( | |
| 811 | + 'code' => array( | |
| 812 | 812 | 'type' => 'string', |
| 813 | 813 | 'label' => /* translators: Label for a receipt data field in the template editor. */ __( 'Coupon Code', 'woocommerce-pos' ), |
| 814 | 814 | ), |
| 815 | - 'total' => array( | |
| 815 | + 'discount_type' => array( | |
| 816 | + 'type' => 'string', | |
| 817 | + 'label' => /* translators: Label for a receipt data field in the template editor. */ __( 'Coupon Type', 'woocommerce-pos' ), | |
| 818 | + ), | |
| 819 | + 'total' => array( | |
| 816 | 820 | 'type' => 'money', |
| 817 | 821 | 'label' => /* translators: Label for a receipt data field in the template editor. */ __( 'Total', 'woocommerce-pos' ), |
| 818 | 822 | ), |
| 819 | - 'total_incl' => array( | |
| 823 | + 'total_incl' => array( | |
| 820 | 824 | 'type' => 'money', |
| 821 | 825 | 'label' => /* translators: Label for a receipt data field in the template editor. */ __( 'Total (incl tax)', 'woocommerce-pos' ), |
| 822 | 826 | ), |
| 823 | - 'total_excl' => array( | |
| 827 | + 'total_excl' => array( | |
| 824 | 828 | 'type' => 'money', |
| 825 | 829 | 'label' => /* translators: Label for a receipt data field in the template editor. */ __( 'Total (excl tax)', 'woocommerce-pos' ), |
| 826 | 830 | ), |
| 827 | 831 | ), |
| @@ -1581,75 +1585,6 @@ | ||
| 1581 | 1585 | case 'string': |
| 1582 | 1586 | default: |
| 1583 | 1587 | return 'string'; |
| 1584 | 1588 | } |
| 1585 | - } | |
| 1586 | - | |
| 1587 | - /** | |
| 1588 | - * Get mock receipt data for template preview. | |
| 1589 | - * | |
| 1590 | - * Returns a representative receipt payload with realistic values | |
| 1591 | - * for use in the template editor preview and tests. | |
| 1592 | - * | |
| 1593 | - * @return array Mock receipt data. | |
| 1594 | - */ | |
| 1595 | - public static function get_mock_receipt_data(): array { | |
| 1596 | - $created = Receipt_Date_Formatter::from_timestamp( strtotime( '2024-01-15 10:30:00 UTC' ) ); | |
| 1597 | - $paid = Receipt_Date_Formatter::from_timestamp( strtotime( '2024-01-15 10:35:00 UTC' ) ); | |
| 1598 | - $completed = Receipt_Date_Formatter::from_timestamp( strtotime( '2024-01-15 10:42:00 UTC' ) ); | |
| 1599 | - $printed = Receipt_Date_Formatter::from_timestamp( strtotime( '2024-01-15 10:45:00 UTC' ) ); | |
| 1600 | - | |
| 1601 | - return array( | |
| 1602 | - 'has_tax_summary' => true, | |
| 1603 | - 'order' => array( | |
| 1604 | - 'id' => 1001, | |
| 1605 | - 'number' => '1001', | |
| 1606 | - 'currency' => 'USD', | |
| 1607 | - 'customer_note' => '', | |
| 1608 | - 'wc_status' => 'completed', | |
| 1609 | - 'status_label' => 'Completed', | |
| 1610 | - 'created_via' => 'woocommerce-pos', | |
| 1611 | - 'created' => $created, | |
| 1612 | - 'paid' => $paid, | |
| 1613 | - 'completed' => $completed, | |
| 1614 | - 'printed' => $printed, | |
| 1615 | - 'needs_payment' => false, | |
| 1616 | - 'payment_url' => '', | |
| 1617 | - ), | |
| 1618 | - 'store' => array( | |
| 1619 | - 'id' => 1, | |
| 1620 | - 'name' => 'My Store', | |
| 1621 | - 'address' => array( | |
| 1622 | - 'address_1' => '123 Main St', | |
| 1623 | - 'address_2' => '', | |
| 1624 | - 'city' => 'Anytown', | |
| 1625 | - 'state' => 'CA', | |
| 1626 | - 'postcode' => '90210', | |
| 1627 | - 'country' => 'US', | |
| 1628 | - ), | |
| 1629 | - 'address_lines' => array( '123 Main St', 'Anytown, CA 90210' ), | |
| 1630 | - 'tax_ids' => array( | |
| 1631 | - array( | |
| 1632 | - 'type' => 'us_ein', | |
| 1633 | - 'value' => '12-3456789', | |
| 1634 | - 'country' => 'US', | |
| 1635 | - 'label' => 'EIN', | |
| 1636 | - ), | |
| 1637 | - ), | |
| 1638 | - 'phone' => '+1 (555) 123-4567', | |
| 1639 | - 'email' => '[email protected]', | |
| 1640 | - 'logo' => 'https://example.com/logo.png', | |
| 1641 | - 'opening_hours' => "Mon\u{2013}Fri 9:00 AM \u{2013} 5:00 PM\nSat 10:00 AM \u{2013} 4:00 PM\nSun Closed", | |
| 1642 | - 'opening_hours_vertical' => "Mon 9:00 AM \u{2013} 5:00 PM\nTue 9:00 AM \u{2013} 5:00 PM\nWed 9:00 AM \u{2013} 5:00 PM\nThu 9:00 AM \u{2013} 5:00 PM\nFri 9:00 AM \u{2013} 5:00 PM\nSat 10:00 AM \u{2013} 4:00 PM\nSun Closed", | |
| 1643 | - 'opening_hours_inline' => "Mon\u{2013}Fri 9:00 AM \u{2013} 5:00 PM, Sat 10:00 AM \u{2013} 4:00 PM, Sun Closed", | |
| 1644 | - 'opening_hours_notes' => 'Closed on public holidays', | |
| 1645 | - 'personal_notes' => '', | |
| 1646 | - 'policies_and_conditions' => '', | |
| 1647 | - 'footer_imprint' => '', | |
| 1648 | - ), | |
| 1649 | - 'cashier' => array( | |
| 1650 | - 'id' => 1, | |
| 1651 | - 'name' => 'Admin', | |
| 1652 | - ), | |
| 1653 | - ); | |
| 1654 | 1589 | } |
| 1655 | 1590 | } |