@pisell/pisellos 0.10.53 → 0.10.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +3 -1
  3. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  4. package/dist/modules/BusinessAvailability/index.d.ts +30 -0
  5. package/dist/modules/BusinessAvailability/index.js +204 -0
  6. package/dist/modules/OpenData/index.js +1 -1
  7. package/dist/modules/OpenData/types.d.ts +2 -0
  8. package/dist/modules/Order/index.d.ts +5 -2
  9. package/dist/modules/Order/index.js +320 -247
  10. package/dist/modules/Order/types.d.ts +8 -0
  11. package/dist/modules/Payment/index.js +9 -10
  12. package/dist/plugins/request.d.ts +3 -0
  13. package/dist/server/utils/small-ticket.d.ts +1 -85
  14. package/dist/server/utils/small-ticket.js +2 -2576
  15. package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
  16. package/dist/shared/payment/loadPaymentMethods.js +66 -0
  17. package/dist/shared/receipt/small-ticket.d.ts +85 -0
  18. package/dist/shared/receipt/small-ticket.js +2576 -0
  19. package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  20. package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
  21. package/dist/solution/BaseSales/index.d.ts +4 -15
  22. package/dist/solution/BaseSales/index.js +131 -86
  23. package/dist/solution/BaseSales/types.d.ts +11 -0
  24. package/dist/solution/BookingByStep/index.d.ts +1 -1
  25. package/dist/solution/BookingTicket/index.js +41 -13
  26. package/dist/solution/OrderInvoicePreview/index.d.ts +56 -0
  27. package/dist/solution/OrderInvoicePreview/index.js +269 -0
  28. package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  29. package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
  30. package/dist/solution/UnifiedBookingSales/index.d.ts +11 -0
  31. package/dist/solution/UnifiedBookingSales/index.js +154 -75
  32. package/dist/solution/UnifiedBookingSales/types.d.ts +2 -0
  33. package/dist/solution/index.d.ts +1 -0
  34. package/dist/solution/index.js +2 -1
  35. package/lib/index.d.ts +2 -0
  36. package/lib/index.js +21 -1
  37. package/lib/modules/BusinessAvailability/index.d.ts +30 -0
  38. package/lib/modules/BusinessAvailability/index.js +146 -0
  39. package/lib/modules/OpenData/index.js +1 -1
  40. package/lib/modules/OpenData/types.d.ts +2 -0
  41. package/lib/modules/Order/index.d.ts +5 -2
  42. package/lib/modules/Order/index.js +67 -13
  43. package/lib/modules/Order/types.d.ts +8 -0
  44. package/lib/modules/Payment/index.js +3 -4
  45. package/lib/plugins/request.d.ts +3 -0
  46. package/lib/server/utils/small-ticket.d.ts +1 -85
  47. package/lib/server/utils/small-ticket.js +9 -2335
  48. package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
  49. package/lib/shared/payment/loadPaymentMethods.js +40 -0
  50. package/lib/shared/receipt/small-ticket.d.ts +85 -0
  51. package/lib/shared/receipt/small-ticket.js +2342 -0
  52. package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  53. package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
  54. package/lib/solution/BaseSales/index.d.ts +4 -15
  55. package/lib/solution/BaseSales/index.js +45 -24
  56. package/lib/solution/BaseSales/types.d.ts +11 -0
  57. package/lib/solution/BookingByStep/index.d.ts +1 -1
  58. package/lib/solution/BookingTicket/index.js +37 -4
  59. package/lib/solution/OrderInvoicePreview/index.d.ts +56 -0
  60. package/lib/solution/OrderInvoicePreview/index.js +194 -0
  61. package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  62. package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
  63. package/lib/solution/UnifiedBookingSales/index.d.ts +11 -0
  64. package/lib/solution/UnifiedBookingSales/index.js +54 -0
  65. package/lib/solution/UnifiedBookingSales/types.d.ts +2 -0
  66. package/lib/solution/index.d.ts +1 -0
  67. package/lib/solution/index.js +11 -0
  68. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import type { RequestPlugin } from '../../plugins/request';
2
+ import type { PaymentMethod } from '../../modules/Payment/types';
3
+ /** Shared read-only transport; customer hosts route the remote path under /h5. */
4
+ export declare function loadPaymentMethods(request: RequestPlugin, options: {
5
+ transport: 'remote' | 'os-server';
6
+ filterPaymentMethods: boolean;
7
+ }): Promise<PaymentMethod[]>;
8
+ /** Enrich a copy: never overwrite historical names or change payment amounts. */
9
+ export declare function withPaymentMethodNames(order: Record<string, any>, methods: PaymentMethod[]): Record<string, any>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loadPaymentMethods = loadPaymentMethods;
7
+ exports.withPaymentMethodNames = withPaymentMethodNames;
8
+ /** Shared read-only transport; customer hosts route the remote path under /h5. */
9
+ async function loadPaymentMethods(request, options) {
10
+ const response = await request.get('/pay/custom-payment/all', {
11
+ filterPaymentMethods: options.filterPaymentMethods
12
+ }, options.transport === 'os-server' ? {
13
+ osServer: true
14
+ } : {
15
+ manualErrorHandling: true,
16
+ skipErrorHandler: true
17
+ });
18
+ const methods = response?.data ?? response;
19
+ if (!Array.isArray(methods)) throw new Error('Payment methods are unavailable');
20
+ return methods;
21
+ }
22
+
23
+ /** Enrich a copy: never overwrite historical names or change payment amounts. */
24
+ function withPaymentMethodNames(order, methods) {
25
+ if (!Array.isArray(order.payments)) return order;
26
+ return {
27
+ ...order,
28
+ payments: order.payments.map(payment => {
29
+ if (payment.name || payment.title || payment.payment_method_name || payment.method_name) return payment;
30
+ const id = payment.custom_payment_id;
31
+ const hasId = id !== undefined && id !== null && String(id).trim() !== '';
32
+ const code = payment.code || payment.type || payment.payment_method || payment.method;
33
+ const method = methods.find(candidate => hasId ? String(candidate.id) === String(id) : !!code && candidate.code === code);
34
+ return method?.name ? {
35
+ ...payment,
36
+ payment_method_name: method.name
37
+ } : payment;
38
+ })
39
+ };
40
+ }
@@ -0,0 +1,85 @@
1
+ export interface SmallTicketShopInfo {
2
+ name?: string;
3
+ phone?: string;
4
+ address?: string;
5
+ address_street?: string;
6
+ address_detail?: string;
7
+ city?: string;
8
+ province?: string;
9
+ country?: string;
10
+ zip?: string;
11
+ tax_number?: string;
12
+ tax_title?: string;
13
+ is_price_include_tax?: 0 | 1 | boolean;
14
+ currency_symbol?: string;
15
+ currency_code?: string;
16
+ primary_locale?: string;
17
+ timezone?: string;
18
+ [key: string]: any;
19
+ }
20
+ export interface BuildSmallTicketDataParams {
21
+ order: Record<string, any>;
22
+ shopInfo?: SmallTicketShopInfo | null;
23
+ locales?: string[];
24
+ productMap?: Record<string | number, Record<string, any>>;
25
+ }
26
+ export interface SmallTicketItem {
27
+ item: string;
28
+ value: string;
29
+ size?: number;
30
+ align?: string;
31
+ product_uid?: string | number;
32
+ booking_uid?: string | number;
33
+ }
34
+ export interface SmallTicketProduct {
35
+ product_title: string;
36
+ product_quantity: number;
37
+ selling_price: string;
38
+ total_selling_price: string;
39
+ original_price: string;
40
+ base_price?: string;
41
+ total_original_price: string;
42
+ options_total_price?: string;
43
+ package_items_total_price?: string;
44
+ extension_list: any[];
45
+ product_uid?: string | number;
46
+ booking_uid?: string | number;
47
+ product_note?: string;
48
+ allergy?: string;
49
+ options?: Array<{
50
+ name: string;
51
+ num?: number;
52
+ price?: string;
53
+ total_price: string;
54
+ value?: string;
55
+ }>;
56
+ variant?: string;
57
+ combinations?: any[];
58
+ }
59
+ export type SmallTicketAppointment = SmallTicketItem[];
60
+ export interface SmallTicketLocaleData {
61
+ base_data: Record<string, any>;
62
+ products: SmallTicketProduct[];
63
+ fees: {
64
+ fees: SmallTicketItem[];
65
+ countFee: Record<string, any>;
66
+ };
67
+ customer: SmallTicketItem[];
68
+ appointment: SmallTicketAppointment;
69
+ delivery?: SmallTicketItem[];
70
+ resources: Array<{
71
+ id: string | number;
72
+ code: string;
73
+ title: string;
74
+ form_title: string;
75
+ }>;
76
+ payment_data: SmallTicketItem[][];
77
+ wallets: SmallTicketItem[][];
78
+ tickets: any[];
79
+ source_shop: any[];
80
+ refund_data: SmallTicketItem[][];
81
+ expend_data: any[];
82
+ }
83
+ export type SmallTicketData = Record<string, SmallTicketLocaleData>;
84
+ export declare function buildSmallTicketData(params: BuildSmallTicketDataParams): SmallTicketData;
85
+ export declare function hasSmallTicketData(value: any): boolean;