| @@ -1586,5 +1586,74 @@ | ||
| 1586 | 1586 | default: |
| 1587 | 1587 | return 'string'; |
| 1588 | 1588 | } |
| 1589 | 1589 | } |
| 1590 | + | |
| 1591 | + /** | |
| 1592 | + * Get mock receipt data for template preview. | |
| 1593 | + * | |
| 1594 | + * Returns a representative receipt payload with realistic values | |
| 1595 | + * for use in the template editor preview and tests. | |
| 1596 | + * | |
| 1597 | + * @return array Mock receipt data. | |
| 1598 | + */ | |
| 1599 | + public static function get_mock_receipt_data(): array { | |
| 1600 | + $created = Receipt_Date_Formatter::from_timestamp( strtotime( '2024-01-15 10:30:00 UTC' ) ); | |
| 1601 | + $paid = Receipt_Date_Formatter::from_timestamp( strtotime( '2024-01-15 10:35:00 UTC' ) ); | |
| 1602 | + $completed = Receipt_Date_Formatter::from_timestamp( strtotime( '2024-01-15 10:42:00 UTC' ) ); | |
| 1603 | + $printed = Receipt_Date_Formatter::from_timestamp( strtotime( '2024-01-15 10:45:00 UTC' ) ); | |
| 1604 | + | |
| 1605 | + return array( | |
| 1606 | + 'has_tax_summary' => true, | |
| 1607 | + 'order' => array( | |
| 1608 | + 'id' => 1001, | |
| 1609 | + 'number' => '1001', | |
| 1610 | + 'currency' => 'USD', | |
| 1611 | + 'customer_note' => '', | |
| 1612 | + 'wc_status' => 'completed', | |
| 1613 | + 'status_label' => 'Completed', | |
| 1614 | + 'created_via' => 'woocommerce-pos', | |
| 1615 | + 'created' => $created, | |
| 1616 | + 'paid' => $paid, | |
| 1617 | + 'completed' => $completed, | |
| 1618 | + 'printed' => $printed, | |
| 1619 | + 'needs_payment' => false, | |
| 1620 | + 'payment_url' => '', | |
| 1621 | + ), | |
| 1622 | + 'store' => array( | |
| 1623 | + 'id' => 1, | |
| 1624 | + 'name' => 'My Store', | |
| 1625 | + 'address' => array( | |
| 1626 | + 'address_1' => '123 Main St', | |
| 1627 | + 'address_2' => '', | |
| 1628 | + 'city' => 'Anytown', | |
| 1629 | + 'state' => 'CA', | |
| 1630 | + 'postcode' => '90210', | |
| 1631 | + 'country' => 'US', | |
| 1632 | + ), | |
| 1633 | + 'address_lines' => array( '123 Main St', 'Anytown, CA 90210' ), | |
| 1634 | + 'tax_ids' => array( | |
| 1635 | + array( | |
| 1636 | + 'type' => 'us_ein', | |
| 1637 | + 'value' => '12-3456789', | |
| 1638 | + 'country' => 'US', | |
| 1639 | + 'label' => 'EIN', | |
| 1640 | + ), | |
| 1641 | + ), | |
| 1642 | + 'phone' => '+1 (555) 123-4567', | |
| 1643 | + 'email' => '[email protected]', | |
| 1644 | + 'logo' => 'https://example.com/logo.png', | |
| 1645 | + '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", | |
| 1646 | + '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", | |
| 1647 | + '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", | |
| 1648 | + 'opening_hours_notes' => 'Closed on public holidays', | |
| 1649 | + 'personal_notes' => '', | |
| 1650 | + 'policies_and_conditions' => '', | |
| 1651 | + 'footer_imprint' => '', | |
| 1652 | + ), | |
| 1653 | + 'cashier' => array( | |
| 1654 | + 'id' => 1, | |
| 1655 | + 'name' => 'Admin', | |
| 1656 | + ), | |
| 1657 | + ); | |
| 1658 | + } | |
| 1590 | 1659 | } |