@moksa/plugin-ecpay 0.0.0-stage → 0.1.0

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.
package/dist/index.mjs ADDED
@@ -0,0 +1,1410 @@
1
+ // Auto-generated by emdash-plugin build. Do not edit.
2
+ // Source: emdash-plugin.jsonc + package.json
3
+ //
4
+ // Default-exports a sandboxed plugin descriptor. Pass it directly into
5
+ // emdash's `plugins:` or `sandboxed:` array — no factory call needed.
6
+
7
+ /** @type {import("emdash").PluginDescriptor} */
8
+ const descriptor = Object.freeze({
9
+ "id": "moksa-ecpay",
10
+ "version": "0.1.0",
11
+ "format": "standard",
12
+ "entrypoint": "@moksa/plugin-ecpay/sandbox",
13
+ "capabilities": [
14
+ "network:request"
15
+ ],
16
+ "allowedHosts": [
17
+ "payment-stage.ecpay.com.tw",
18
+ "payment.ecpay.com.tw",
19
+ "ecpayment-stage.ecpay.com.tw",
20
+ "ecpayment.ecpay.com.tw",
21
+ "logistics-stage.ecpay.com.tw",
22
+ "logistics.ecpay.com.tw",
23
+ "einvoice-stage.ecpay.com.tw",
24
+ "einvoice.ecpay.com.tw"
25
+ ],
26
+ "storage": {
27
+ "trades": {
28
+ "indexes": [
29
+ "orderNumber",
30
+ "status",
31
+ "createdAt",
32
+ [
33
+ "orderNumber",
34
+ "createdAt"
35
+ ]
36
+ ]
37
+ },
38
+ "events": {
39
+ "indexes": [
40
+ "createdAt"
41
+ ]
42
+ },
43
+ "orders": {
44
+ "indexes": [
45
+ "updatedAt",
46
+ "invoiceDueAt"
47
+ ]
48
+ },
49
+ "shipments": {
50
+ "indexes": [
51
+ "orderNumber",
52
+ "status",
53
+ "updatedAt",
54
+ [
55
+ "open",
56
+ "updatedAt"
57
+ ],
58
+ [
59
+ "orderNumber",
60
+ "updatedAt"
61
+ ]
62
+ ]
63
+ },
64
+ "invoices": {
65
+ "indexes": [
66
+ "status",
67
+ "updatedAt"
68
+ ]
69
+ },
70
+ "reports": {
71
+ "indexes": [
72
+ "status",
73
+ "nextAt",
74
+ [
75
+ "status",
76
+ "nextAt"
77
+ ]
78
+ ]
79
+ }
80
+ },
81
+ "hooks": [
82
+ "plugin:activate",
83
+ "cron"
84
+ ],
85
+ "routes": [
86
+ {
87
+ "name": "migrate/import",
88
+ "methods": [
89
+ "POST"
90
+ ],
91
+ "permission": "plugins:manage"
92
+ },
93
+ {
94
+ "name": "migrate/kv",
95
+ "methods": [
96
+ "POST"
97
+ ],
98
+ "permission": "plugins:manage"
99
+ },
100
+ {
101
+ "name": "migrate/stats",
102
+ "methods": [
103
+ "GET",
104
+ "POST"
105
+ ],
106
+ "permission": "plugins:manage"
107
+ },
108
+ {
109
+ "name": "bus/methods",
110
+ "methods": [
111
+ "POST"
112
+ ],
113
+ "request": {
114
+ "body": "text",
115
+ "maxBytes": 262144,
116
+ "headers": [
117
+ "x-moksa-bus-ts",
118
+ "x-moksa-bus-id",
119
+ "x-moksa-bus-sig"
120
+ ]
121
+ },
122
+ "public": true
123
+ },
124
+ {
125
+ "name": "bus/checkout",
126
+ "methods": [
127
+ "POST"
128
+ ],
129
+ "request": {
130
+ "body": "text",
131
+ "maxBytes": 262144,
132
+ "headers": [
133
+ "x-moksa-bus-ts",
134
+ "x-moksa-bus-id",
135
+ "x-moksa-bus-sig"
136
+ ]
137
+ },
138
+ "public": true
139
+ },
140
+ {
141
+ "name": "bus/notify",
142
+ "methods": [
143
+ "POST"
144
+ ],
145
+ "request": {
146
+ "body": "text",
147
+ "maxBytes": 262144,
148
+ "headers": [
149
+ "x-moksa-bus-ts",
150
+ "x-moksa-bus-id",
151
+ "x-moksa-bus-sig"
152
+ ]
153
+ },
154
+ "public": true
155
+ },
156
+ {
157
+ "name": "bus/gw/return",
158
+ "methods": [
159
+ "POST"
160
+ ],
161
+ "request": {
162
+ "body": "text",
163
+ "maxBytes": 262144,
164
+ "headers": [
165
+ "x-moksa-bus-ts",
166
+ "x-moksa-bus-id",
167
+ "x-moksa-bus-sig"
168
+ ]
169
+ },
170
+ "public": true
171
+ },
172
+ {
173
+ "name": "bus/events",
174
+ "methods": [
175
+ "POST"
176
+ ],
177
+ "request": {
178
+ "body": "text",
179
+ "maxBytes": 262144,
180
+ "headers": [
181
+ "x-moksa-bus-ts",
182
+ "x-moksa-bus-id",
183
+ "x-moksa-bus-sig"
184
+ ]
185
+ },
186
+ "public": true
187
+ },
188
+ {
189
+ "name": "bus/reports/due",
190
+ "methods": [
191
+ "POST"
192
+ ],
193
+ "request": {
194
+ "body": "text",
195
+ "maxBytes": 262144,
196
+ "headers": [
197
+ "x-moksa-bus-ts",
198
+ "x-moksa-bus-id",
199
+ "x-moksa-bus-sig"
200
+ ]
201
+ },
202
+ "public": true
203
+ },
204
+ {
205
+ "name": "bus/reports/ack",
206
+ "methods": [
207
+ "POST"
208
+ ],
209
+ "request": {
210
+ "body": "text",
211
+ "maxBytes": 262144,
212
+ "headers": [
213
+ "x-moksa-bus-ts",
214
+ "x-moksa-bus-id",
215
+ "x-moksa-bus-sig"
216
+ ]
217
+ },
218
+ "public": true
219
+ },
220
+ {
221
+ "name": "bus/shipping/methods",
222
+ "methods": [
223
+ "POST"
224
+ ],
225
+ "request": {
226
+ "body": "text",
227
+ "maxBytes": 262144,
228
+ "headers": [
229
+ "x-moksa-bus-ts",
230
+ "x-moksa-bus-id",
231
+ "x-moksa-bus-sig"
232
+ ]
233
+ },
234
+ "public": true
235
+ },
236
+ {
237
+ "name": "bus/invoice/options",
238
+ "methods": [
239
+ "POST"
240
+ ],
241
+ "request": {
242
+ "body": "text",
243
+ "maxBytes": 262144,
244
+ "headers": [
245
+ "x-moksa-bus-ts",
246
+ "x-moksa-bus-id",
247
+ "x-moksa-bus-sig"
248
+ ]
249
+ },
250
+ "public": true
251
+ },
252
+ {
253
+ "name": "bus/invoice/verify",
254
+ "methods": [
255
+ "POST"
256
+ ],
257
+ "request": {
258
+ "body": "text",
259
+ "maxBytes": 262144,
260
+ "headers": [
261
+ "x-moksa-bus-ts",
262
+ "x-moksa-bus-id",
263
+ "x-moksa-bus-sig"
264
+ ]
265
+ },
266
+ "public": true
267
+ },
268
+ {
269
+ "name": "bus/gw/logistics-map",
270
+ "methods": [
271
+ "POST"
272
+ ],
273
+ "request": {
274
+ "body": "text",
275
+ "maxBytes": 262144,
276
+ "headers": [
277
+ "x-moksa-bus-ts",
278
+ "x-moksa-bus-id",
279
+ "x-moksa-bus-sig"
280
+ ]
281
+ },
282
+ "public": true
283
+ },
284
+ {
285
+ "name": "bus/gw/logistics-map-reply",
286
+ "methods": [
287
+ "POST"
288
+ ],
289
+ "request": {
290
+ "body": "text",
291
+ "maxBytes": 262144,
292
+ "headers": [
293
+ "x-moksa-bus-ts",
294
+ "x-moksa-bus-id",
295
+ "x-moksa-bus-sig"
296
+ ]
297
+ },
298
+ "public": true
299
+ },
300
+ {
301
+ "name": "bus/gw/logistics-notify",
302
+ "methods": [
303
+ "POST"
304
+ ],
305
+ "request": {
306
+ "body": "text",
307
+ "maxBytes": 262144,
308
+ "headers": [
309
+ "x-moksa-bus-ts",
310
+ "x-moksa-bus-id",
311
+ "x-moksa-bus-sig"
312
+ ]
313
+ },
314
+ "public": true
315
+ },
316
+ {
317
+ "name": "bus/refund",
318
+ "methods": [
319
+ "POST"
320
+ ],
321
+ "request": {
322
+ "body": "text",
323
+ "maxBytes": 262144,
324
+ "headers": [
325
+ "x-moksa-bus-ts",
326
+ "x-moksa-bus-id",
327
+ "x-moksa-bus-sig"
328
+ ]
329
+ },
330
+ "public": true
331
+ },
332
+ {
333
+ "name": "trades/list",
334
+ "methods": [
335
+ "GET",
336
+ "POST"
337
+ ],
338
+ "permission": "plugins:manage"
339
+ },
340
+ {
341
+ "name": "trades/query",
342
+ "methods": [
343
+ "GET",
344
+ "POST"
345
+ ],
346
+ "permission": "plugins:manage"
347
+ },
348
+ {
349
+ "name": "trades/refund",
350
+ "methods": [
351
+ "POST"
352
+ ],
353
+ "permission": "plugins:manage"
354
+ },
355
+ {
356
+ "name": "trades/capture",
357
+ "methods": [
358
+ "POST"
359
+ ],
360
+ "permission": "plugins:manage"
361
+ },
362
+ {
363
+ "name": "trades/card-status",
364
+ "methods": [
365
+ "GET",
366
+ "POST"
367
+ ],
368
+ "permission": "plugins:manage"
369
+ },
370
+ {
371
+ "name": "shipments/create",
372
+ "methods": [
373
+ "POST"
374
+ ],
375
+ "permission": "plugins:manage"
376
+ },
377
+ {
378
+ "name": "shipments/list",
379
+ "methods": [
380
+ "GET",
381
+ "POST"
382
+ ],
383
+ "permission": "plugins:manage"
384
+ },
385
+ {
386
+ "name": "shipments/sync",
387
+ "methods": [
388
+ "GET",
389
+ "POST"
390
+ ],
391
+ "permission": "plugins:manage"
392
+ },
393
+ {
394
+ "name": "shipments/print",
395
+ "methods": [
396
+ "GET",
397
+ "POST"
398
+ ],
399
+ "permission": "plugins:manage"
400
+ },
401
+ {
402
+ "name": "shipments/sync-all",
403
+ "methods": [
404
+ "POST"
405
+ ],
406
+ "permission": "plugins:manage"
407
+ },
408
+ {
409
+ "name": "shipments/void",
410
+ "methods": [
411
+ "POST"
412
+ ],
413
+ "permission": "plugins:manage"
414
+ },
415
+ {
416
+ "name": "shipments/print-batch",
417
+ "methods": [
418
+ "GET",
419
+ "POST"
420
+ ],
421
+ "permission": "plugins:manage"
422
+ },
423
+ {
424
+ "name": "invoices/issue",
425
+ "methods": [
426
+ "POST"
427
+ ],
428
+ "permission": "plugins:manage"
429
+ },
430
+ {
431
+ "name": "invoices/get",
432
+ "methods": [
433
+ "GET",
434
+ "POST"
435
+ ],
436
+ "permission": "plugins:manage"
437
+ },
438
+ {
439
+ "name": "invoices/void",
440
+ "methods": [
441
+ "POST"
442
+ ],
443
+ "permission": "plugins:manage"
444
+ },
445
+ {
446
+ "name": "invoices/allowance",
447
+ "methods": [
448
+ "POST"
449
+ ],
450
+ "permission": "plugins:manage"
451
+ },
452
+ {
453
+ "name": "invoices/due",
454
+ "methods": [
455
+ "POST"
456
+ ],
457
+ "permission": "plugins:manage"
458
+ },
459
+ {
460
+ "name": "invoices/query",
461
+ "methods": [
462
+ "GET",
463
+ "POST"
464
+ ],
465
+ "permission": "plugins:manage"
466
+ },
467
+ {
468
+ "name": "admin",
469
+ "permission": "plugins:manage"
470
+ }
471
+ ],
472
+ "mcp": {
473
+ "tools": [
474
+ {
475
+ "name": "list_trades",
476
+ "description": "List ECPay trades (one per payment attempt), newest first, optionally for one order number. Status: created, awaiting (ATM/CVS code issued), paid, failed.",
477
+ "route": "trades/list",
478
+ "permission": "plugins:manage",
479
+ "destructive": false,
480
+ "inputSchema": {
481
+ "$schema": "http://json-schema.org/draft-07/schema#",
482
+ "type": "object",
483
+ "properties": {
484
+ "orderNumber": {
485
+ "type": "string",
486
+ "minLength": 1,
487
+ "maxLength": 18,
488
+ "pattern": "^[A-Z0-9]+$"
489
+ },
490
+ "limit": {
491
+ "type": "integer",
492
+ "minimum": 1,
493
+ "maximum": 100,
494
+ "default": 20
495
+ }
496
+ },
497
+ "additionalProperties": true
498
+ }
499
+ },
500
+ {
501
+ "name": "query_trade",
502
+ "description": "Ask ECPay for the current status of a trade by MerchantTradeNo (TradeStatus 1 = paid, 0 = not paid).",
503
+ "route": "trades/query",
504
+ "permission": "plugins:manage",
505
+ "destructive": false,
506
+ "inputSchema": {
507
+ "$schema": "http://json-schema.org/draft-07/schema#",
508
+ "type": "object",
509
+ "properties": {
510
+ "merchantTradeNo": {
511
+ "type": "string",
512
+ "minLength": 1,
513
+ "maxLength": 20,
514
+ "pattern": "^[A-Za-z0-9]+$"
515
+ }
516
+ },
517
+ "additionalProperties": true,
518
+ "required": [
519
+ "merchantTradeNo"
520
+ ]
521
+ }
522
+ },
523
+ {
524
+ "name": "card_status",
525
+ "description": "A paid ECPay card trade's authorization and capture status (Authorized, To be captured, Captured, Refunded, Cancelled) with the captured amount and history.",
526
+ "route": "trades/card-status",
527
+ "permission": "plugins:manage",
528
+ "destructive": false,
529
+ "inputSchema": {
530
+ "$schema": "http://json-schema.org/draft-07/schema#",
531
+ "type": "object",
532
+ "properties": {
533
+ "merchantTradeNo": {
534
+ "type": "string",
535
+ "minLength": 1,
536
+ "maxLength": 20,
537
+ "pattern": "^[A-Za-z0-9]+$"
538
+ }
539
+ },
540
+ "additionalProperties": true,
541
+ "required": [
542
+ "merchantTradeNo"
543
+ ]
544
+ }
545
+ },
546
+ {
547
+ "name": "capture_trade",
548
+ "description": "Capture (關帳) a paid ECPay card trade for its amount less refunds, when automatic capture is off.",
549
+ "route": "trades/capture",
550
+ "permission": "plugins:manage",
551
+ "destructive": true,
552
+ "inputSchema": {
553
+ "$schema": "http://json-schema.org/draft-07/schema#",
554
+ "type": "object",
555
+ "properties": {
556
+ "merchantTradeNo": {
557
+ "type": "string",
558
+ "minLength": 1,
559
+ "maxLength": 20,
560
+ "pattern": "^[A-Za-z0-9]+$"
561
+ }
562
+ },
563
+ "additionalProperties": true,
564
+ "required": [
565
+ "merchantTradeNo"
566
+ ]
567
+ }
568
+ },
569
+ {
570
+ "name": "list_shipments",
571
+ "description": "List 綠界物流 shipments, newest first, optionally for one order number (status, tracking number, provider fields).",
572
+ "route": "shipments/list",
573
+ "permission": "plugins:manage",
574
+ "destructive": false,
575
+ "inputSchema": {
576
+ "$schema": "http://json-schema.org/draft-07/schema#",
577
+ "type": "object",
578
+ "properties": {
579
+ "orderNumber": {
580
+ "type": "string",
581
+ "maxLength": 20
582
+ },
583
+ "limit": {
584
+ "type": "integer",
585
+ "minimum": 1,
586
+ "maximum": 100,
587
+ "default": 20
588
+ }
589
+ },
590
+ "additionalProperties": true
591
+ }
592
+ },
593
+ {
594
+ "name": "create_shipment",
595
+ "description": "Create the 綠界物流 shipment for a paid (or cash-on-delivery) order; an existing live shipment is returned instead.",
596
+ "route": "shipments/create",
597
+ "permission": "plugins:manage",
598
+ "destructive": true,
599
+ "inputSchema": {
600
+ "$schema": "http://json-schema.org/draft-07/schema#",
601
+ "type": "object",
602
+ "properties": {
603
+ "orderNumber": {
604
+ "type": "string",
605
+ "minLength": 1,
606
+ "maxLength": 20,
607
+ "pattern": "^[A-Z0-9]+$"
608
+ }
609
+ },
610
+ "additionalProperties": true,
611
+ "required": [
612
+ "orderNumber"
613
+ ]
614
+ }
615
+ },
616
+ {
617
+ "name": "sync_all_shipments",
618
+ "description": "Ask 綠界物流 for the status of every open shipment now (up to 100, oldest first) and apply the changes.",
619
+ "route": "shipments/sync-all",
620
+ "permission": "plugins:manage",
621
+ "destructive": false,
622
+ "inputSchema": {
623
+ "$schema": "http://json-schema.org/draft-07/schema#",
624
+ "type": "object",
625
+ "properties": {},
626
+ "additionalProperties": true
627
+ }
628
+ },
629
+ {
630
+ "name": "sync_shipment",
631
+ "description": "Ask 綠界物流 for a shipment's current status and apply it.",
632
+ "route": "shipments/sync",
633
+ "permission": "plugins:manage",
634
+ "destructive": false,
635
+ "inputSchema": {
636
+ "$schema": "http://json-schema.org/draft-07/schema#",
637
+ "type": "object",
638
+ "properties": {
639
+ "shipmentId": {
640
+ "type": "string",
641
+ "minLength": 1,
642
+ "maxLength": 64
643
+ }
644
+ },
645
+ "additionalProperties": true,
646
+ "required": [
647
+ "shipmentId"
648
+ ]
649
+ }
650
+ },
651
+ {
652
+ "name": "print_shipment_label",
653
+ "description": "The 綠界物流 shipping label: a signed form (action + params) to open in a browser, a URL, or label HTML.",
654
+ "route": "shipments/print",
655
+ "permission": "plugins:manage",
656
+ "destructive": false,
657
+ "inputSchema": {
658
+ "$schema": "http://json-schema.org/draft-07/schema#",
659
+ "type": "object",
660
+ "properties": {
661
+ "shipmentId": {
662
+ "type": "string",
663
+ "minLength": 1,
664
+ "maxLength": 64
665
+ }
666
+ },
667
+ "additionalProperties": true,
668
+ "required": [
669
+ "shipmentId"
670
+ ]
671
+ }
672
+ },
673
+ {
674
+ "name": "void_shipment",
675
+ "description": "Void a 綠界物流 shipment that has not shipped yet (cancel at the carrier's back office when it has no cancel API).",
676
+ "route": "shipments/void",
677
+ "permission": "plugins:manage",
678
+ "destructive": true,
679
+ "inputSchema": {
680
+ "$schema": "http://json-schema.org/draft-07/schema#",
681
+ "type": "object",
682
+ "properties": {
683
+ "shipmentId": {
684
+ "type": "string",
685
+ "minLength": 1,
686
+ "maxLength": 64
687
+ }
688
+ },
689
+ "additionalProperties": true,
690
+ "required": [
691
+ "shipmentId"
692
+ ]
693
+ }
694
+ },
695
+ {
696
+ "name": "issue_invoice",
697
+ "description": "Issue the 綠界電子發票 invoice for a paid order (idempotent: an issued invoice is returned).",
698
+ "route": "invoices/issue",
699
+ "permission": "plugins:manage",
700
+ "destructive": false,
701
+ "inputSchema": {
702
+ "$schema": "http://json-schema.org/draft-07/schema#",
703
+ "type": "object",
704
+ "properties": {
705
+ "orderNumber": {
706
+ "type": "string",
707
+ "minLength": 1,
708
+ "maxLength": 20,
709
+ "pattern": "^[A-Z0-9]+$"
710
+ }
711
+ },
712
+ "additionalProperties": true,
713
+ "required": [
714
+ "orderNumber"
715
+ ]
716
+ }
717
+ },
718
+ {
719
+ "name": "get_invoice",
720
+ "description": "The 綠界電子發票 invoice of an order: number, date, random code, allowances.",
721
+ "route": "invoices/get",
722
+ "permission": "plugins:manage",
723
+ "destructive": false,
724
+ "inputSchema": {
725
+ "$schema": "http://json-schema.org/draft-07/schema#",
726
+ "type": "object",
727
+ "properties": {
728
+ "orderNumber": {
729
+ "type": "string",
730
+ "minLength": 1,
731
+ "maxLength": 20,
732
+ "pattern": "^[A-Z0-9]+$"
733
+ }
734
+ },
735
+ "additionalProperties": true,
736
+ "required": [
737
+ "orderNumber"
738
+ ]
739
+ }
740
+ },
741
+ {
742
+ "name": "query_invoice",
743
+ "description": "Ask 綠界電子發票 for the invoice as it recorded it.",
744
+ "route": "invoices/query",
745
+ "permission": "plugins:manage",
746
+ "destructive": false,
747
+ "inputSchema": {
748
+ "$schema": "http://json-schema.org/draft-07/schema#",
749
+ "type": "object",
750
+ "properties": {
751
+ "orderNumber": {
752
+ "type": "string",
753
+ "minLength": 1,
754
+ "maxLength": 20,
755
+ "pattern": "^[A-Z0-9]+$"
756
+ }
757
+ },
758
+ "additionalProperties": true,
759
+ "required": [
760
+ "orderNumber"
761
+ ]
762
+ }
763
+ },
764
+ {
765
+ "name": "void_invoice",
766
+ "description": "Void an order's 綠界電子發票 invoice (its allowances are voided first).",
767
+ "route": "invoices/void",
768
+ "permission": "plugins:manage",
769
+ "destructive": true,
770
+ "inputSchema": {
771
+ "$schema": "http://json-schema.org/draft-07/schema#",
772
+ "type": "object",
773
+ "properties": {
774
+ "orderNumber": {
775
+ "type": "string",
776
+ "minLength": 1,
777
+ "maxLength": 20,
778
+ "pattern": "^[A-Z0-9]+$"
779
+ },
780
+ "reason": {
781
+ "type": "string",
782
+ "minLength": 1,
783
+ "maxLength": 50,
784
+ "default": "訂單取消"
785
+ }
786
+ },
787
+ "additionalProperties": true,
788
+ "required": [
789
+ "orderNumber"
790
+ ]
791
+ }
792
+ },
793
+ {
794
+ "name": "allowance_invoice",
795
+ "description": "Issue a 綠界電子發票 allowance (折讓, whole NT$) against an order's invoice.",
796
+ "route": "invoices/allowance",
797
+ "permission": "plugins:manage",
798
+ "destructive": true,
799
+ "inputSchema": {
800
+ "$schema": "http://json-schema.org/draft-07/schema#",
801
+ "type": "object",
802
+ "properties": {
803
+ "orderNumber": {
804
+ "type": "string",
805
+ "minLength": 1,
806
+ "maxLength": 20,
807
+ "pattern": "^[A-Z0-9]+$"
808
+ },
809
+ "amount": {
810
+ "type": "integer",
811
+ "minimum": 1,
812
+ "maximum": 99999999
813
+ },
814
+ "reason": {
815
+ "type": "string",
816
+ "minLength": 1,
817
+ "maxLength": 50,
818
+ "default": "折讓"
819
+ }
820
+ },
821
+ "additionalProperties": true,
822
+ "required": [
823
+ "orderNumber",
824
+ "amount"
825
+ ]
826
+ }
827
+ },
828
+ {
829
+ "name": "print_shipment_labels",
830
+ "description": "ECPay shipping labels for several shipments at once: one label page (HTML) per logistics subtype. mode A6 applies to 7-ELEVEN and post only; other subtypes print A4.",
831
+ "route": "shipments/print-batch",
832
+ "permission": "plugins:manage",
833
+ "destructive": false,
834
+ "inputSchema": {
835
+ "$schema": "http://json-schema.org/draft-07/schema#",
836
+ "type": "object",
837
+ "properties": {
838
+ "shipmentIds": {
839
+ "type": "array",
840
+ "items": {
841
+ "type": "string",
842
+ "minLength": 1,
843
+ "maxLength": 64
844
+ },
845
+ "minItems": 1,
846
+ "maxItems": 50
847
+ },
848
+ "mode": {
849
+ "enum": [
850
+ "A4",
851
+ "A6"
852
+ ]
853
+ }
854
+ },
855
+ "additionalProperties": true,
856
+ "required": [
857
+ "shipmentIds"
858
+ ]
859
+ }
860
+ },
861
+ {
862
+ "name": "refund_trade",
863
+ "description": "Refund a paid ECPay credit-card trade (whole NT$). An uncaptured charge can only be released in full. ATM / CVS payments must be refunded by hand.",
864
+ "route": "trades/refund",
865
+ "permission": "plugins:manage",
866
+ "destructive": true,
867
+ "inputSchema": {
868
+ "$schema": "http://json-schema.org/draft-07/schema#",
869
+ "type": "object",
870
+ "properties": {
871
+ "merchantTradeNo": {
872
+ "type": "string",
873
+ "minLength": 1,
874
+ "maxLength": 20,
875
+ "pattern": "^[A-Za-z0-9]+$"
876
+ },
877
+ "amount": {
878
+ "type": "integer",
879
+ "minimum": 1,
880
+ "maximum": 99999999
881
+ }
882
+ },
883
+ "additionalProperties": true,
884
+ "required": [
885
+ "merchantTradeNo",
886
+ "amount"
887
+ ]
888
+ }
889
+ }
890
+ ]
891
+ },
892
+ "adminPages": [
893
+ {
894
+ "path": "/trades",
895
+ "label": "綠界金流",
896
+ "icon": "credit-card"
897
+ },
898
+ {
899
+ "path": "/payment-labels",
900
+ "label": "付款方式名稱與說明",
901
+ "icon": "list"
902
+ },
903
+ {
904
+ "path": "/shipments",
905
+ "label": "綠界物流",
906
+ "icon": "truck"
907
+ },
908
+ {
909
+ "path": "/shipping-methods",
910
+ "label": "物流方式設定",
911
+ "icon": "list"
912
+ },
913
+ {
914
+ "path": "/invoices",
915
+ "label": "綠界電子發票",
916
+ "icon": "receipt"
917
+ }
918
+ ],
919
+ "settingsSchema": {
920
+ "environment": {
921
+ "label": "環境",
922
+ "type": "select",
923
+ "options": [
924
+ {
925
+ "value": "stage",
926
+ "label": "測試環境(stage)"
927
+ },
928
+ {
929
+ "value": "production",
930
+ "label": "正式環境"
931
+ }
932
+ ],
933
+ "default": "stage"
934
+ },
935
+ "merchantId": {
936
+ "label": "特店編號(MerchantID)",
937
+ "description": "測試環境留空時使用綠界公開測試帳號 3002607。",
938
+ "type": "string",
939
+ "default": ""
940
+ },
941
+ "hashKey": {
942
+ "label": "HashKey",
943
+ "type": "secret"
944
+ },
945
+ "hashIv": {
946
+ "label": "HashIV",
947
+ "type": "secret"
948
+ },
949
+ "methodCredit": {
950
+ "label": "信用卡",
951
+ "type": "boolean",
952
+ "default": true
953
+ },
954
+ "methodCredit3": {
955
+ "label": "信用卡分 3 期(需向綠界申請)",
956
+ "type": "boolean",
957
+ "default": false
958
+ },
959
+ "methodCredit6": {
960
+ "label": "信用卡分 6 期(需向綠界申請)",
961
+ "type": "boolean",
962
+ "default": false
963
+ },
964
+ "methodCredit12": {
965
+ "label": "信用卡分 12 期(需向綠界申請)",
966
+ "type": "boolean",
967
+ "default": false
968
+ },
969
+ "methodCredit18": {
970
+ "label": "信用卡分 18 期(需向綠界申請)",
971
+ "type": "boolean",
972
+ "default": false
973
+ },
974
+ "methodCredit24": {
975
+ "label": "信用卡分 24 期(需向綠界申請)",
976
+ "type": "boolean",
977
+ "default": false
978
+ },
979
+ "methodCredit30N": {
980
+ "label": "信用卡分 30 期(永豐,需向綠界申請)",
981
+ "type": "boolean",
982
+ "default": false
983
+ },
984
+ "credit30NMinAmount": {
985
+ "label": "永豐 30 期最低交易金額",
986
+ "description": "綠界廠商後台可查;訂單金額大於這個金額才提供 30 期。0 表示不提供。",
987
+ "type": "number",
988
+ "default": 0,
989
+ "min": 0
990
+ },
991
+ "methodUnionPay": {
992
+ "label": "銀聯卡(需向綠界申請)",
993
+ "type": "boolean",
994
+ "default": false
995
+ },
996
+ "creditRedeem": {
997
+ "label": "信用卡紅利折抵(需向綠界申請)",
998
+ "description": "一次付清的信用卡付款頁提供紅利折抵;分期與銀聯卡不適用。",
999
+ "type": "boolean",
1000
+ "default": false
1001
+ },
1002
+ "methodATM": {
1003
+ "label": "ATM 轉帳",
1004
+ "type": "boolean",
1005
+ "default": false
1006
+ },
1007
+ "methodCVS": {
1008
+ "label": "超商代碼繳費",
1009
+ "type": "boolean",
1010
+ "default": false
1011
+ },
1012
+ "methodBARCODE": {
1013
+ "label": "超商條碼繳費",
1014
+ "type": "boolean",
1015
+ "default": false
1016
+ },
1017
+ "methodWebATM": {
1018
+ "label": "網路 ATM(手機版不支援)",
1019
+ "type": "boolean",
1020
+ "default": false
1021
+ },
1022
+ "methodApplePay": {
1023
+ "label": "Apple Pay",
1024
+ "type": "boolean",
1025
+ "default": false
1026
+ },
1027
+ "methodTWQR": {
1028
+ "label": "TWQR 行動支付(需申請,6–49,999 元)",
1029
+ "type": "boolean",
1030
+ "default": false
1031
+ },
1032
+ "methodBNPL": {
1033
+ "label": "無卡分期:裕富/中租(需申請,50–500,000 元)",
1034
+ "type": "boolean",
1035
+ "default": false
1036
+ },
1037
+ "methodWeiXin": {
1038
+ "label": "微信支付(需申請,6–500,000 元)",
1039
+ "type": "boolean",
1040
+ "default": false
1041
+ },
1042
+ "methodJkopay": {
1043
+ "label": "街口支付(需申請)",
1044
+ "type": "boolean",
1045
+ "default": false
1046
+ },
1047
+ "methodiPASS": {
1048
+ "label": "一卡通 iPASS MONEY(需申請)",
1049
+ "type": "boolean",
1050
+ "default": false
1051
+ },
1052
+ "methodALL": {
1053
+ "label": "綠界付款頁自選",
1054
+ "type": "boolean",
1055
+ "default": false
1056
+ },
1057
+ "atmExpireDays": {
1058
+ "label": "ATM 繳費期限(天)",
1059
+ "type": "number",
1060
+ "default": 3,
1061
+ "min": 1,
1062
+ "max": 60
1063
+ },
1064
+ "cvsExpireDays": {
1065
+ "label": "超商代碼繳費期限(天,最多 30)",
1066
+ "type": "number",
1067
+ "default": 7,
1068
+ "min": 1,
1069
+ "max": 30
1070
+ },
1071
+ "barcodeExpireDays": {
1072
+ "label": "超商條碼繳費期限(天,最多 30)",
1073
+ "type": "number",
1074
+ "default": 7,
1075
+ "min": 1,
1076
+ "max": 30
1077
+ },
1078
+ "orderPrefix": {
1079
+ "label": "訂單編號前綴(最多 5 個英數字)",
1080
+ "description": "多個商店共用同一個綠界帳號時,用前綴區分訂單編號。",
1081
+ "type": "string",
1082
+ "default": ""
1083
+ },
1084
+ "itemName": {
1085
+ "label": "付款頁顯示的商品名稱",
1086
+ "description": "留空時列出訂單的商品;填寫固定文字(例如「網路商品」)時每筆訂單都顯示這段文字。",
1087
+ "type": "string",
1088
+ "default": ""
1089
+ },
1090
+ "siteUrl": {
1091
+ "label": "網站網址",
1092
+ "description": "例:https://shop.example.com。物流狀態回呼使用;留空時沿用網站最近一次轉來的網址。",
1093
+ "type": "string",
1094
+ "default": ""
1095
+ },
1096
+ "logisticsEnabled": {
1097
+ "label": "啟用綠界物流",
1098
+ "type": "boolean",
1099
+ "default": false
1100
+ },
1101
+ "logisticsEnvironment": {
1102
+ "label": "物流環境",
1103
+ "type": "select",
1104
+ "options": [
1105
+ {
1106
+ "value": "stage",
1107
+ "label": "測試環境(stage)"
1108
+ },
1109
+ {
1110
+ "value": "production",
1111
+ "label": "正式環境"
1112
+ }
1113
+ ],
1114
+ "default": "stage"
1115
+ },
1116
+ "logisticsContract": {
1117
+ "label": "超商合約類型",
1118
+ "type": "select",
1119
+ "options": [
1120
+ {
1121
+ "value": "C2C",
1122
+ "label": "C2C 店到店"
1123
+ },
1124
+ {
1125
+ "value": "B2C",
1126
+ "label": "B2C 大宗寄倉"
1127
+ }
1128
+ ],
1129
+ "default": "C2C"
1130
+ },
1131
+ "logisticsC2cMerchantId": {
1132
+ "label": "C2C 物流特店編號",
1133
+ "description": "店到店(交貨便)用。測試環境未填時使用綠界公開測試帳號 2000933。",
1134
+ "type": "string",
1135
+ "default": ""
1136
+ },
1137
+ "logisticsC2cHashKey": {
1138
+ "label": "C2C 物流 HashKey",
1139
+ "type": "secret"
1140
+ },
1141
+ "logisticsC2cHashIv": {
1142
+ "label": "C2C 物流 HashIV",
1143
+ "type": "secret"
1144
+ },
1145
+ "logisticsB2cMerchantId": {
1146
+ "label": "B2C/宅配物流特店編號",
1147
+ "description": "大宗寄倉、黑貓、郵局用。測試環境未填時使用綠界公開測試帳號 2000132。",
1148
+ "type": "string",
1149
+ "default": ""
1150
+ },
1151
+ "logisticsB2cHashKey": {
1152
+ "label": "B2C/宅配物流 HashKey",
1153
+ "type": "secret"
1154
+ },
1155
+ "logisticsB2cHashIv": {
1156
+ "label": "B2C/宅配物流 HashIV",
1157
+ "type": "secret"
1158
+ },
1159
+ "cvsUnimart": {
1160
+ "label": "7-ELEVEN 取貨(B2C 可含冷凍,另拆一張冷凍單)",
1161
+ "type": "boolean",
1162
+ "default": true
1163
+ },
1164
+ "cvsFami": {
1165
+ "label": "全家取貨",
1166
+ "type": "boolean",
1167
+ "default": true
1168
+ },
1169
+ "cvsHilife": {
1170
+ "label": "萊爾富取貨",
1171
+ "type": "boolean",
1172
+ "default": false
1173
+ },
1174
+ "cvsOkmart": {
1175
+ "label": "OK 取貨",
1176
+ "type": "boolean",
1177
+ "default": false
1178
+ },
1179
+ "cvsUnimartFreeze": {
1180
+ "label": "7-ELEVEN 冷凍取貨(僅 B2C)",
1181
+ "type": "boolean",
1182
+ "default": false
1183
+ },
1184
+ "homeTcat": {
1185
+ "label": "黑貓宅急便(常溫/冷藏/冷凍,依溫層拆單)",
1186
+ "type": "boolean",
1187
+ "default": true
1188
+ },
1189
+ "homePost": {
1190
+ "label": "中華郵政(僅常溫)",
1191
+ "type": "boolean",
1192
+ "default": false
1193
+ },
1194
+ "cvsFee": {
1195
+ "label": "超商取貨運費",
1196
+ "type": "number",
1197
+ "default": 60,
1198
+ "min": 0
1199
+ },
1200
+ "homeFee": {
1201
+ "label": "宅配運費(常溫)",
1202
+ "type": "number",
1203
+ "default": 100,
1204
+ "min": 0
1205
+ },
1206
+ "coldFee": {
1207
+ "label": "低溫配送運費",
1208
+ "type": "number",
1209
+ "default": 160,
1210
+ "min": 0
1211
+ },
1212
+ "senderName": {
1213
+ "label": "寄件人姓名(最多 10 字)",
1214
+ "type": "string",
1215
+ "default": ""
1216
+ },
1217
+ "senderPhone": {
1218
+ "label": "寄件人電話",
1219
+ "type": "string",
1220
+ "default": ""
1221
+ },
1222
+ "senderCellphone": {
1223
+ "label": "寄件人手機",
1224
+ "type": "string",
1225
+ "default": ""
1226
+ },
1227
+ "senderZipcode": {
1228
+ "label": "寄件人郵遞區號(宅配用)",
1229
+ "description": "3、5 或 6 碼數字。留空時只採用寄件地址開頭的郵遞區號。",
1230
+ "type": "string",
1231
+ "default": ""
1232
+ },
1233
+ "senderAddress": {
1234
+ "label": "寄件地址(宅配用)",
1235
+ "description": "沒填郵遞區號時,地址開頭的 3–6 位數字當作郵遞區號。",
1236
+ "type": "string",
1237
+ "default": ""
1238
+ },
1239
+ "labelMode": {
1240
+ "label": "託運單格式",
1241
+ "description": "A6 只用於 7-ELEVEN(含冷凍)與中華郵政;全家、萊爾富、OK、黑貓沒有 A6,一律印 A4。",
1242
+ "type": "select",
1243
+ "options": [
1244
+ {
1245
+ "value": "1",
1246
+ "label": "A4"
1247
+ },
1248
+ {
1249
+ "value": "2",
1250
+ "label": "A6"
1251
+ }
1252
+ ],
1253
+ "default": "1"
1254
+ },
1255
+ "logisticsAutoShip": {
1256
+ "label": "付款後(貨到付款為下單後)自動建立物流單",
1257
+ "type": "boolean",
1258
+ "default": false
1259
+ },
1260
+ "invoiceEnabled": {
1261
+ "label": "啟用綠界電子發票",
1262
+ "type": "boolean",
1263
+ "default": false
1264
+ },
1265
+ "invoiceEnvironment": {
1266
+ "label": "發票環境",
1267
+ "type": "select",
1268
+ "options": [
1269
+ {
1270
+ "value": "stage",
1271
+ "label": "測試環境(stage)"
1272
+ },
1273
+ {
1274
+ "value": "production",
1275
+ "label": "正式環境"
1276
+ }
1277
+ ],
1278
+ "default": "stage"
1279
+ },
1280
+ "invoiceMerchantId": {
1281
+ "label": "發票特店編號",
1282
+ "description": "未填時使用綠界公開測試帳號 2000132(測試環境開立的發票不會上傳財政部)。",
1283
+ "type": "string",
1284
+ "default": ""
1285
+ },
1286
+ "invoiceHashKey": {
1287
+ "label": "發票 HashKey",
1288
+ "type": "secret"
1289
+ },
1290
+ "invoiceHashIv": {
1291
+ "label": "發票 HashIV",
1292
+ "type": "secret"
1293
+ },
1294
+ "invoicePrefix": {
1295
+ "label": "發票關聯編號前綴(最多 5 個英數字)",
1296
+ "description": "多個商店共用同一個綠界發票帳號時,用前綴區分。",
1297
+ "type": "string",
1298
+ "default": ""
1299
+ },
1300
+ "invoiceAuto": {
1301
+ "label": "自動開立",
1302
+ "type": "boolean",
1303
+ "default": true
1304
+ },
1305
+ "invoiceIssueWhen": {
1306
+ "label": "開立時機",
1307
+ "type": "select",
1308
+ "options": [
1309
+ {
1310
+ "value": "paid",
1311
+ "label": "付款完成(貨到付款於下單後)"
1312
+ },
1313
+ {
1314
+ "value": "completed",
1315
+ "label": "訂單完成(取貨完成)"
1316
+ }
1317
+ ],
1318
+ "default": "paid"
1319
+ },
1320
+ "invoiceDelayDays": {
1321
+ "label": "延後開立天數(0–30)",
1322
+ "type": "number",
1323
+ "default": 0,
1324
+ "min": 0,
1325
+ "max": 30
1326
+ },
1327
+ "invoiceAutoVoid": {
1328
+ "label": "訂單取消或全額退款時自動作廢",
1329
+ "type": "boolean",
1330
+ "default": false
1331
+ },
1332
+ "invoiceAutoAllowance": {
1333
+ "label": "部分退款時自動開立折讓",
1334
+ "type": "boolean",
1335
+ "default": false
1336
+ },
1337
+ "invoiceVerifyOnline": {
1338
+ "label": "結帳時向綠界驗證捐贈碼與手機條碼",
1339
+ "type": "boolean",
1340
+ "default": true
1341
+ },
1342
+ "invoiceAllowDonate": {
1343
+ "label": "結帳可選捐贈發票",
1344
+ "type": "boolean",
1345
+ "default": true
1346
+ },
1347
+ "invoiceAllowB2b": {
1348
+ "label": "結帳可打統編(三聯式)",
1349
+ "type": "boolean",
1350
+ "default": true
1351
+ },
1352
+ "invoiceChannelMember": {
1353
+ "label": "個人載具:綠界會員載具",
1354
+ "type": "boolean",
1355
+ "default": true
1356
+ },
1357
+ "invoiceChannelMobile": {
1358
+ "label": "個人載具:手機條碼",
1359
+ "type": "boolean",
1360
+ "default": true
1361
+ },
1362
+ "invoiceChannelCert": {
1363
+ "label": "個人載具:自然人憑證",
1364
+ "type": "boolean",
1365
+ "default": true
1366
+ },
1367
+ "invoiceChannelPaper": {
1368
+ "label": "個人載具:紙本發票",
1369
+ "description": "至少保留一種;全部取消時自動保留紙本。紙本發票請到綠界後台列印寄送。",
1370
+ "type": "boolean",
1371
+ "default": true
1372
+ },
1373
+ "invoiceDefaultCarrier": {
1374
+ "label": "預設的個人載具",
1375
+ "type": "select",
1376
+ "options": [
1377
+ {
1378
+ "value": "member",
1379
+ "label": "綠界會員載具"
1380
+ },
1381
+ {
1382
+ "value": "mobile",
1383
+ "label": "手機條碼"
1384
+ },
1385
+ {
1386
+ "value": "cert",
1387
+ "label": "自然人憑證"
1388
+ },
1389
+ {
1390
+ "value": "paper",
1391
+ "label": "紙本發票"
1392
+ }
1393
+ ],
1394
+ "default": "member"
1395
+ },
1396
+ "invoiceDonateOrgs": {
1397
+ "label": "捐贈單位(每行「名稱|愛心碼」)",
1398
+ "description": "例:伊甸社會福利基金會|25885。填寫後結帳改為下拉選單。",
1399
+ "type": "string",
1400
+ "default": ""
1401
+ },
1402
+ "busKey": {
1403
+ "label": "匯流排金鑰",
1404
+ "description": "由網站部署腳本寫入(scripts/provision-bus.mjs),請勿手動修改。",
1405
+ "type": "secret"
1406
+ }
1407
+ }
1408
+ });
1409
+
1410
+ export default descriptor;