@rangka-os/create 0.5.0-alpha.26 → 0.5.0-alpha.28

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 (189) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/absen_karyawan/app.rk +37 -0
  3. package/template/base/apps/absen_karyawan/dashboards/absen_hari_ini.rk +20 -0
  4. package/template/base/apps/absen_karyawan/dashboards/absen_karyawan_saya.rk +14 -0
  5. package/template/base/apps/absen_karyawan/dashboards/rekap_absen_karyawan.rk +12 -0
  6. package/template/base/apps/jasa_proyek/app.rk +1 -1
  7. package/template/base/apps/kasir/app.rk +5 -1
  8. package/template/base/apps/kasir/dashboards/kasir_ringkas.rk +4 -0
  9. package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +20 -0
  10. package/template/base/connectors/email/connector.rk +144 -0
  11. package/template/base/connectors/email/fixtures/email_received.json +33 -0
  12. package/template/base/connectors/email/fixtures/email_received_reply.json +31 -0
  13. package/template/base/connectors/email/fixtures/expect.json +20 -0
  14. package/template/base/connectors/email/fixtures/fetch_email.json +66 -0
  15. package/template/base/connectors/email/fixtures/send_email.json +4 -0
  16. package/template/base/connectors/midtrans/connector.rk +249 -0
  17. package/template/base/connectors/midtrans/fixtures/charge_gopay.json +34 -0
  18. package/template/base/connectors/midtrans/fixtures/charge_qris.json +23 -0
  19. package/template/base/connectors/midtrans/fixtures/charge_va.json +20 -0
  20. package/template/base/connectors/midtrans/fixtures/create_snap.json +4 -0
  21. package/template/base/connectors/midtrans/fixtures/expect.json +88 -0
  22. package/template/base/connectors/midtrans/fixtures/get_status.json +15 -0
  23. package/template/base/connectors/midtrans/fixtures/payment_notified.json +28 -0
  24. package/template/base/connectors/midtrans/fixtures/payment_notified_challenge.json +24 -0
  25. package/template/base/connectors/midtrans/fixtures/payment_notified_expire.json +24 -0
  26. package/template/base/connectors/midtrans/fixtures/payment_notified_other_amount.json +28 -0
  27. package/template/base/connectors/midtrans/fixtures/payment_notified_partial_refund.json +34 -0
  28. package/template/base/connectors/midtrans/fixtures/payment_notified_pending.json +31 -0
  29. package/template/base/connectors/midtrans/fixtures/payment_notified_refund.json +34 -0
  30. package/template/base/connectors/midtrans/fixtures/payment_notified_relabelled.json +28 -0
  31. package/template/base/connectors/midtrans/fixtures/payment_notified_va.json +32 -0
  32. package/template/base/connectors/midtrans/fixtures/signature_vector.txt +3 -0
  33. package/template/base/connectors/midtrans/mock/midtrans_mock.py +335 -0
  34. package/template/base/connectors/rangka_whatsapp/README.md +105 -0
  35. package/template/base/connectors/rangka_whatsapp/connector.rk +141 -0
  36. package/template/base/connectors/rangka_whatsapp/fixtures/expect.json +9 -0
  37. package/template/base/connectors/rangka_whatsapp/fixtures/message_received.json +1 -0
  38. package/template/base/connectors/rangka_whatsapp/fixtures/message_status.json +1 -0
  39. package/template/base/connectors/rangka_whatsapp/fixtures/message_status_refused.json +1 -0
  40. package/template/base/connectors/rangka_whatsapp/fixtures/opted_out.json +1 -0
  41. package/template/base/connectors/rangka_whatsapp/fixtures/send_template.json +1 -0
  42. package/template/base/connectors/rangka_whatsapp/fixtures/send_template_duplicate.json +1 -0
  43. package/template/base/connectors/rangka_whatsapp/fixtures/set_opt_out.json +1 -0
  44. package/template/base/connectors/rangka_whatsapp/mock/rangka_whatsapp_mock.py +354 -0
  45. package/template/base/connectors/shopee/connector.rk +360 -0
  46. package/template/base/connectors/shopee/fixtures/expect.json +119 -0
  47. package/template/base/connectors/shopee/fixtures/get_models.json +52 -0
  48. package/template/base/connectors/shopee/fixtures/get_order_detail.json +396 -0
  49. package/template/base/connectors/shopee/fixtures/get_settlement.json +90 -0
  50. package/template/base/connectors/shopee/fixtures/get_tracking.json +13 -0
  51. package/template/base/connectors/shopee/fixtures/list_items.json +29 -0
  52. package/template/base/connectors/shopee/fixtures/list_orders.json +31 -0
  53. package/template/base/connectors/shopee/fixtures/list_settlements.json +15 -0
  54. package/template/base/connectors/shopee/fixtures/order_changed.json +101 -0
  55. package/template/base/connectors/shopee/fixtures/order_changed_cancelled.json +72 -0
  56. package/template/base/connectors/shopee/fixtures/order_changed_completed.json +101 -0
  57. package/template/base/connectors/shopee/fixtures/order_changed_in_cancel.json +72 -0
  58. package/template/base/connectors/shopee/fixtures/order_changed_unpaid.json +71 -0
  59. package/template/base/connectors/shopee/fixtures/order_settled.json +92 -0
  60. package/template/base/connectors/shopee/fixtures/push_received.json +12 -0
  61. package/template/base/connectors/shopee/fixtures/push_received_tracking.json +11 -0
  62. package/template/base/connectors/shopee/fixtures/update_stock.json +15 -0
  63. package/template/base/connectors/shopee/mock/shopee_mock.py +894 -0
  64. package/template/base/connectors/tiktok_shop/connector.rk +300 -0
  65. package/template/base/connectors/tiktok_shop/fixtures/expect.json +105 -0
  66. package/template/base/connectors/tiktok_shop/fixtures/get_order_detail.json +136 -0
  67. package/template/base/connectors/tiktok_shop/fixtures/get_settlement.json +83 -0
  68. package/template/base/connectors/tiktok_shop/fixtures/get_tracking.json +28 -0
  69. package/template/base/connectors/tiktok_shop/fixtures/list_orders.json +242 -0
  70. package/template/base/connectors/tiktok_shop/fixtures/list_products.json +77 -0
  71. package/template/base/connectors/tiktok_shop/fixtures/list_settlements.json +22 -0
  72. package/template/base/connectors/tiktok_shop/fixtures/list_shops.json +17 -0
  73. package/template/base/connectors/tiktok_shop/fixtures/order_changed.json +129 -0
  74. package/template/base/connectors/tiktok_shop/fixtures/order_changed_cancelled.json +81 -0
  75. package/template/base/connectors/tiktok_shop/fixtures/order_changed_completed.json +106 -0
  76. package/template/base/connectors/tiktok_shop/fixtures/order_changed_on_hold.json +104 -0
  77. package/template/base/connectors/tiktok_shop/fixtures/order_changed_tokopedia.json +106 -0
  78. package/template/base/connectors/tiktok_shop/fixtures/order_changed_unpaid.json +79 -0
  79. package/template/base/connectors/tiktok_shop/fixtures/order_settled.json +73 -0
  80. package/template/base/connectors/tiktok_shop/fixtures/update_stock.json +6 -0
  81. package/template/base/connectors/tiktok_shop/fixtures/webhook_received.json +12 -0
  82. package/template/base/connectors/tiktok_shop/fixtures/webhook_received_cancellation.json +13 -0
  83. package/template/base/connectors/tiktok_shop/mock/tiktok_shop_mock.py +819 -0
  84. package/template/base/connectors/whatsapp_business/connector.rk +3 -1
  85. package/template/base/connectors/whatsapp_business/templates.md +13 -1
  86. package/template/base/modules/attendance/flows/attendance_missing_digest.rk +30 -0
  87. package/template/base/modules/attendance/flows/attendance_period_on_cancel.rk +15 -0
  88. package/template/base/modules/attendance/flows/attendance_period_on_submit.rk +60 -0
  89. package/template/base/modules/attendance/flows/staff_attendance_cancel_guard.rk +14 -0
  90. package/template/base/modules/attendance/flows/staff_attendance_guard_created.rk +16 -0
  91. package/template/base/modules/attendance/flows/staff_attendance_guard_submitted.rk +37 -0
  92. package/template/base/modules/attendance/flows/staff_attendance_guard_updated.rk +14 -0
  93. package/template/base/modules/attendance/models/attendance_period.rk +62 -0
  94. package/template/base/modules/attendance/models/attendance_summary.rk +37 -0
  95. package/template/base/modules/attendance/models/staff_attendance.rk +281 -0
  96. package/template/base/modules/attendance/models/staff_attendance_guard.rk +50 -0
  97. package/template/base/modules/attendance/module.rk +18 -0
  98. package/template/base/modules/attendance/screens/absen_outlet.rk +22 -0
  99. package/template/base/modules/catalogue/models/item.rk +69 -0
  100. package/template/base/modules/catalogue/module.rk +1 -1
  101. package/template/base/modules/contacts/models/customer.rk +43 -19
  102. package/template/base/modules/contacts/module.rk +1 -1
  103. package/template/base/modules/coretax/module.rk +1 -1
  104. package/template/base/modules/coretax/print/coretax_faktur.rk +3 -2
  105. package/template/base/modules/coretax/print/coretax_faktur.xml +3 -1
  106. package/template/base/modules/coretax/print/rekap_ppn.html +9 -7
  107. package/template/base/modules/courses/flows/charge_invoice_on_submit.rk +15 -0
  108. package/template/base/modules/courses/module.rk +1 -1
  109. package/template/base/modules/courses/screens/absen_kelas.rk +1 -0
  110. package/template/base/modules/invoicing/flows/invoice_due_digest.rk +45 -7
  111. package/template/base/modules/invoicing/models/sales_invoice_item.rk +4 -1
  112. package/template/base/modules/invoicing/module.rk +15 -2
  113. package/template/base/modules/kitchen/screens/dapur.rk +1 -0
  114. package/template/base/modules/outlets/models/outlet.rk +69 -0
  115. package/template/base/modules/outlets/module.rk +1 -1
  116. package/template/base/modules/payments/flows/payment_from_midtrans.rk +85 -0
  117. package/template/base/modules/payments/flows/payment_refund_from_midtrans.rk +22 -0
  118. package/template/base/modules/payments/models/payment.rk +2 -1
  119. package/template/base/modules/payments/module.rk +1 -1
  120. package/template/base/modules/payroll/flows/payroll_close_on_cancel.rk +8 -5
  121. package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +8 -5
  122. package/template/base/modules/payroll/flows/payroll_reminder.rk +106 -0
  123. package/template/base/modules/payroll/flows/payroll_run_overlap_guard_created.rk +5 -3
  124. package/template/base/modules/payroll/flows/payroll_run_overlap_guard_updated.rk +5 -3
  125. package/template/base/modules/payroll/flows/payslip_from_recap.rk +1 -1
  126. package/template/base/modules/payroll/imports/payroll_profile_list.rk +27 -0
  127. package/template/base/modules/payroll/models/payroll_close.rk +10 -6
  128. package/template/base/modules/payroll/models/payroll_run.rk +64 -15
  129. package/template/base/modules/payroll/models/payslip.rk +48 -9
  130. package/template/base/modules/payroll/module.rk +22 -5
  131. package/template/base/modules/payroll/print/payslip.html +4 -1
  132. package/template/base/modules/pos/models/pos_sale.rk +136 -9
  133. package/template/base/modules/pos/models/pos_sale_item.rk +33 -1
  134. package/template/base/modules/pos/module.rk +5 -3
  135. package/template/base/modules/pos/print/pos_receipt.html +7 -3
  136. package/template/base/modules/pos/screens/kasir.rk +7 -2
  137. package/template/base/modules/procurement/flows/reorder_draft_po.rk +57 -0
  138. package/template/base/modules/procurement/models/vendor_bill.rk +14 -1
  139. package/template/base/modules/procurement/module.rk +11 -2
  140. package/template/base/modules/projects/screens/absen.rk +1 -0
  141. package/template/base/modules/promotions/flows/promo_code_batch_on_submit.rk +26 -0
  142. package/template/base/modules/promotions/flows/promotion_apply.rk +110 -0
  143. package/template/base/modules/promotions/flows/promotion_apply_on_create.rk +110 -0
  144. package/template/base/modules/promotions/flows/promotion_apply_on_delete.rk +111 -0
  145. package/template/base/modules/promotions/flows/promotion_apply_on_update.rk +110 -0
  146. package/template/base/modules/promotions/flows/promotion_on_sale.rk +95 -0
  147. package/template/base/modules/promotions/flows/promotion_on_sale_cancel.rk +43 -0
  148. package/template/base/modules/promotions/models/promo_code.rk +27 -0
  149. package/template/base/modules/promotions/models/promo_code_batch.rk +36 -0
  150. package/template/base/modules/promotions/models/promo_guard.rk +44 -0
  151. package/template/base/modules/promotions/models/promotion.rk +197 -0
  152. package/template/base/modules/promotions/models/promotion_ledger.rk +35 -0
  153. package/template/base/modules/promotions/module.rk +20 -0
  154. package/template/base/modules/rental/screens/alat_keluar.rk +1 -0
  155. package/template/base/modules/rental/screens/alat_kembali.rk +1 -0
  156. package/template/base/modules/rental/screens/jadwal_alat.rk +1 -0
  157. package/template/base/modules/stock/flows/stock_low_alert.rk +65 -0
  158. package/template/base/modules/stock/flows/stock_negative_alert.rk +14 -5
  159. package/template/base/modules/stock/models/stock_reorder.rk +34 -0
  160. package/template/base/modules/stock/module.rk +17 -2
  161. package/template/base/modules/subscriptions/screens/catat_tagih.rk +1 -0
  162. package/template/base/modules/subscriptions/screens/rute_tagih.rk +1 -0
  163. package/template/base/modules/users/flows/summary_daily.rk +83 -0
  164. package/template/base/modules/users/flows/summary_monthly.rk +83 -0
  165. package/template/base/modules/users/flows/summary_weekly.rk +83 -0
  166. package/template/base/modules/users/models/business_summary.rk +67 -0
  167. package/template/base/modules/users/models/summary_setting.rk +35 -0
  168. package/template/base/modules/users/models/user.rk +11 -3
  169. package/template/base/modules/users/module.rk +21 -2
  170. package/template/base/modules/users/roles/employee.rk +8 -0
  171. package/template/base/modules/users/roles/outlet_supervisor.rk +7 -0
  172. package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out.rk +16 -0
  173. package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out_new.rk +17 -0
  174. package/template/base/modules/whatsapp/flows/whatsapp_message_status.rk +24 -0
  175. package/template/base/modules/whatsapp/flows/whatsapp_opted_out.rk +26 -0
  176. package/template/base/modules/whatsapp/models/whatsapp_message.rk +99 -0
  177. package/template/base/modules/whatsapp/models/whatsapp_opt_out.rk +44 -0
  178. package/template/base/modules/whatsapp/module.rk +23 -0
  179. package/template/base/modules/whatsapp_booking/flows/whatsapp_booking_tomorrow.rk +48 -0
  180. package/template/base/modules/whatsapp_booking/module.rk +13 -0
  181. package/template/base/modules/whatsapp_order_ready/flows/whatsapp_pickup_on_sale.rk +19 -0
  182. package/template/base/modules/whatsapp_order_ready/flows/whatsapp_ticket_ready.rk +40 -0
  183. package/template/base/modules/whatsapp_order_ready/models/whatsapp_pickup.rk +22 -0
  184. package/template/base/modules/whatsapp_order_ready/module.rk +14 -0
  185. package/template/base/modules/whatsapp_receipt/flows/whatsapp_receipt_on_sale.rk +43 -0
  186. package/template/base/modules/whatsapp_receipt/module.rk +13 -0
  187. package/template/base/modules/whatsapp_reminder/flows/whatsapp_invoice_overdue.rk +64 -0
  188. package/template/base/modules/whatsapp_reminder/module.rk +15 -0
  189. package/template/base/modules/workforce/imports/worker_list.rk +4 -1
@@ -0,0 +1,249 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/connector.json
2
+ # Midtrans (Indonesia): Snap makes a payment page for an invoice (QRIS, virtual accounts, e-wallets, whatever the
3
+ # account has enabled); the Core API charges one channel directly (a dynamic QRIS for the counter, a bank transfer
4
+ # virtual account, GoPay). Midtrans sends an HTTP notification on every status change.
5
+ # Every request uses the server key as the Basic auth user name with an empty password.
6
+ # Notifications carry their own signature in the body: signature_key = hex(SHA-512(order_id + status_code +
7
+ # gross_amount + server key)), checked by the kernel before any flow runs (rangka-os contract 0002, body-field
8
+ # signatures, refinement of 19 Nov 2026). Research and sources: rangka (Juragan) reports/keputusan-riset/midtrans-connector.md.
9
+ # Only order_id, status_code and gross_amount are signed: a genuine cancel or refund notification (status code 200 too)
10
+ # could be resent with transaction_status changed to settlement. So the trigger confirms every notification with
11
+ # Midtrans before any flow runs (confirm: get_status, rangka-os contract 0002, confirmed webhooks): paid, the status,
12
+ # the channel and a refunded amount come from Midtrans's answer (`confirmed`), and paid also needs that answer to name
13
+ # the same order id and the same amount as the signed fields. gateway_ref is the order id (one Midtrans transaction
14
+ # per order id, the key Midtrans itself names for idempotent handling) and external_id our invoice number read from it.
15
+ # A notification Midtrans cannot confirm (no answer, unknown order) starts no flow; Midtrans sends it again later.
16
+ # An order id is used once at Midtrans: the first page or charge for an invoice uses the invoice number, a later one
17
+ # (the first expired) uses <number>~<attempt>, attempt 2 to 9, and external_id drops that ending again.
18
+ # The trigger fires for every notification (pending, settlement, expire, refund ...): a flow that records money starts
19
+ # with `if: event.paid` and holds gateway_ref in gateway_ref_claim, as with doku and xendit.
20
+ # Test mode: api_host api.sandbox.midtrans.com and snap_host app.sandbox.midtrans.com with the sandbox server key; the
21
+ # sandbox simulator pays and notifies. Until a sandbox account exists, midtrans/mock/midtrans_mock.py answers Snap, the
22
+ # Core API and the status call, and sends signed notifications locally.
23
+ name: midtrans
24
+ label: {id: Midtrans}
25
+ summary:
26
+ id: Terima pembayaran QRIS, virtual account dan e-wallet lewat Midtrans.
27
+ en: Take QRIS, virtual account and e-wallet payments through Midtrans.
28
+ category: payments
29
+ icon: secure-payment-line
30
+ version: 0.1.0
31
+ vendor: Midtrans
32
+ docs: https://docs.midtrans.com/
33
+ hosts: [api.sandbox.midtrans.com, api.midtrans.com, app.sandbox.midtrans.com, app.midtrans.com]
34
+ auth:
35
+ type: basic
36
+ fields:
37
+ - name: server_key
38
+ label: {id: Server key}
39
+ secret: true
40
+ required: true
41
+ help: {id: 'Dashboard Midtrans > Settings > Access Keys. Kunci sandbox (diawali SB-Mid-server-) untuk uji'}
42
+ - name: api_host
43
+ label: {id: Server Core API}
44
+ required: true
45
+ help: {id: 'api.sandbox.midtrans.com untuk uji, api.midtrans.com untuk transaksi nyata'}
46
+ - name: snap_host
47
+ label: {id: Server Snap}
48
+ required: true
49
+ help: {id: 'app.sandbox.midtrans.com untuk uji, app.midtrans.com untuk transaksi nyata'}
50
+ triggers:
51
+ - name: payment_notified
52
+ label: {id: Notifikasi pembayaran Midtrans}
53
+ via: webhook
54
+ verify:
55
+ signature:
56
+ field: signature_key
57
+ alg: sha512
58
+ key: server_key
59
+ concat: ['{body.order_id}', '{body.status_code}', '{body.gross_amount}', '{auth.server_key}']
60
+ confirm:
61
+ action: get_status
62
+ input: {gateway_ref: order_id}
63
+ emit:
64
+ # the order id (signed): stable per payment, the idempotency key and payment.gateway_ref
65
+ gateway_ref: order_id
66
+ # our invoice number: the order id without the ~<attempt> ending of a second or later page (invoice numbers
67
+ # never hold a ~, so replacing the ending anywhere is safe)
68
+ external_id: >-
69
+ order_id.endsWith('~2') ? order_id.replace('~2', '') : order_id.endsWith('~3') ? order_id.replace('~3', '')
70
+ : order_id.endsWith('~4') ? order_id.replace('~4', '') : order_id.endsWith('~5') ? order_id.replace('~5', '')
71
+ : order_id.endsWith('~6') ? order_id.replace('~6', '') : order_id.endsWith('~7') ? order_id.replace('~7', '')
72
+ : order_id.endsWith('~8') ? order_id.replace('~8', '') : order_id.endsWith('~9') ? order_id.replace('~9', '')
73
+ : order_id
74
+ # gross_amount (signed, and equal to what Midtrans reports when paid) is a text with two decimals ("750000.00")
75
+ paid_amount: gross_amount
76
+ # the status as Midtrans reports it now, not as the notification says
77
+ status: confirmed.status
78
+ status_code: status_code
79
+ # paid only when Midtrans confirms it: status code 200, settlement (or capture with fraud status accept) for this
80
+ # order id and this amount
81
+ paid: "confirmed.paid == true && confirmed.gateway_ref == order_id && confirmed.paid_amount == gross_amount"
82
+ # a refund made in the Midtrans dashboard: money out of the Midtrans balance, never money in
83
+ refunded: "confirmed.status == 'refund' || confirmed.status == 'partial_refund'"
84
+ # Midtrans's payment_type (qris, bank_transfer, echannel, gopay, ...); flows map it to payment.method
85
+ channel: confirmed.channel
86
+ transaction_id: confirmed.transaction_id
87
+ refund_amount: confirmed.refund_amount
88
+ # not signed and not confirmed, for people to read only
89
+ paid_at: transaction_time
90
+ actions:
91
+ - name: create_snap
92
+ label: {id: Buat halaman bayar Midtrans}
93
+ request:
94
+ method: POST
95
+ url: https://{auth.snap_host}/snap/v1/transactions
96
+ body:
97
+ transaction_details:
98
+ order_id: '{input.order_id}'
99
+ gross_amount: '{input.amount}'
100
+ enabled_payments: '{input.methods}'
101
+ expiry:
102
+ unit: minutes
103
+ duration: '{input.due_minutes}'
104
+ customer_details:
105
+ first_name: '{input.customer_name}'
106
+ phone: '{input.customer_phone}'
107
+ callbacks:
108
+ finish: '{input.return_url}'
109
+ input:
110
+ - {name: external_id, type: data, required: true, help: {id: 'Nomor faktur (huruf, angka, - _ . ; maks 48), kembali sebagai external_id. Bayar dicatat ke faktur saja'}}
111
+ - {name: amount, type: currency, required: true, help: {id: Rupiah utuh}}
112
+ - {name: methods, type: json, default: "['other_qris', 'gopay', 'bca_va', 'bni_va', 'bri_va', 'permata_va']", help: {id: 'Saluran yang ditawarkan di halaman bayar (enabled_payments Midtrans)'}}
113
+ - {name: due_minutes, type: int, default: '60'}
114
+ - {name: return_url, type: data}
115
+ - {name: customer_name, type: data}
116
+ - {name: customer_phone, type: data}
117
+ # an order id is used once at Midtrans: a new page for the same invoice after the old one expired is the next
118
+ # attempt (2 to 9), sent as <number>~<attempt>
119
+ - {name: attempt, type: int, default: '1', help: {id: 'Naikkan (2 sampai 9) untuk membuat halaman bayar baru setelah yang lama kedaluwarsa'}}
120
+ # derived, leave it out: the invoice number, or <number>~<attempt> from the second attempt on (a request
121
+ # template only fills placeholders, so the order id is worked out here, as a default)
122
+ - {name: order_id, type: data, default: "input.attempt > 1 ? input.external_id + '~' + string(input.attempt) : input.external_id"}
123
+ output:
124
+ payment_url: redirect_url
125
+ token_id: token
126
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
127
+ idempotency: input.external_id + ':' + string(input.amount) + ':' + string(input.attempt)
128
+ - name: charge_qris
129
+ label: {id: Buat QRIS dinamis}
130
+ request:
131
+ method: POST
132
+ url: https://{auth.api_host}/v2/charge
133
+ body:
134
+ payment_type: qris
135
+ transaction_details:
136
+ order_id: '{input.order_id}'
137
+ gross_amount: '{input.amount}'
138
+ qris:
139
+ acquirer: '{input.acquirer}'
140
+ custom_expiry:
141
+ expiry_duration: '{input.due_minutes}'
142
+ unit: minute
143
+ input:
144
+ - {name: external_id, type: data, required: true, help: {id: Nomor faktur penjualan}}
145
+ - {name: amount, type: currency, required: true, help: {id: Rupiah utuh}}
146
+ - {name: acquirer, type: data, default: "'gopay'", help: {id: 'gopay atau airpay shopee, sesuai yang aktif di akun'}}
147
+ - {name: due_minutes, type: int, default: '15'}
148
+ - {name: attempt, type: int, default: '1'}
149
+ - {name: order_id, type: data, default: "input.attempt > 1 ? input.external_id + '~' + string(input.attempt) : input.external_id"}
150
+ output:
151
+ gateway_ref: order_id
152
+ transaction_id: transaction_id
153
+ status: transaction_status
154
+ status_code: status_code
155
+ # the QR as an image (actions[0], generate-qr-code) and, when Midtrans sends it, the QRIS text itself
156
+ qr_url: "size(actions) > 0 ? actions[0].url : null"
157
+ qr_string: "'qr_string' in response ? qr_string : null"
158
+ expires_at: "'expiry_time' in response ? expiry_time : null"
159
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
160
+ idempotency: input.external_id + ':' + string(input.amount) + ':' + string(input.attempt)
161
+ - name: charge_va
162
+ label: {id: Buat virtual account}
163
+ request:
164
+ method: POST
165
+ url: https://{auth.api_host}/v2/charge
166
+ body:
167
+ payment_type: bank_transfer
168
+ transaction_details:
169
+ order_id: '{input.order_id}'
170
+ gross_amount: '{input.amount}'
171
+ bank_transfer:
172
+ bank: '{input.bank}'
173
+ customer_details:
174
+ first_name: '{input.customer_name}'
175
+ custom_expiry:
176
+ expiry_duration: '{input.due_minutes}'
177
+ unit: minute
178
+ input:
179
+ - {name: external_id, type: data, required: true, help: {id: Nomor faktur penjualan}}
180
+ - {name: amount, type: currency, required: true, help: {id: Rupiah utuh}}
181
+ - {name: bank, type: data, required: true, help: {id: 'bca, bni, bri, permata atau cimb'}}
182
+ - {name: customer_name, type: data}
183
+ - {name: due_minutes, type: int, default: '1440'}
184
+ - {name: attempt, type: int, default: '1'}
185
+ - {name: order_id, type: data, default: "input.attempt > 1 ? input.external_id + '~' + string(input.attempt) : input.external_id"}
186
+ output:
187
+ gateway_ref: order_id
188
+ transaction_id: transaction_id
189
+ status: transaction_status
190
+ status_code: status_code
191
+ # BCA, BNI, BRI and CIMB answer with va_numbers; Permata with permata_va_number
192
+ account_number: "'va_numbers' in response && size(va_numbers) > 0 ? va_numbers[0].va_number : ('permata_va_number' in response ? permata_va_number : null)"
193
+ bank_code: "'va_numbers' in response && size(va_numbers) > 0 ? va_numbers[0].bank : ('permata_va_number' in response ? 'permata' : null)"
194
+ expires_at: "'expiry_time' in response ? expiry_time : null"
195
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
196
+ idempotency: input.external_id + ':' + string(input.amount) + ':' + string(input.attempt)
197
+ - name: charge_gopay
198
+ label: {id: Buat tagihan GoPay}
199
+ request:
200
+ method: POST
201
+ url: https://{auth.api_host}/v2/charge
202
+ body:
203
+ payment_type: gopay
204
+ transaction_details:
205
+ order_id: '{input.order_id}'
206
+ gross_amount: '{input.amount}'
207
+ gopay:
208
+ enable_callback: '{input.use_callback}'
209
+ callback_url: '{input.return_url}'
210
+ input:
211
+ - {name: external_id, type: data, required: true, help: {id: Nomor faktur penjualan}}
212
+ - {name: amount, type: currency, required: true, help: {id: Rupiah utuh}}
213
+ - {name: return_url, type: data, help: {id: 'Alamat kembali setelah bayar di aplikasi Gojek'}}
214
+ # derived, leave it out: GoPay returns to return_url only when there is one
215
+ - {name: use_callback, type: check, default: "'return_url' in input && input.return_url != ''"}
216
+ - {name: attempt, type: int, default: '1'}
217
+ - {name: order_id, type: data, default: "input.attempt > 1 ? input.external_id + '~' + string(input.attempt) : input.external_id"}
218
+ output:
219
+ gateway_ref: order_id
220
+ transaction_id: transaction_id
221
+ status: transaction_status
222
+ status_code: status_code
223
+ # actions: generate-qr-code, deeplink-redirect, get-status, cancel
224
+ qr_url: "size(actions) > 0 ? actions[0].url : null"
225
+ deeplink_url: "size(actions) > 1 ? actions[1].url : null"
226
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
227
+ idempotency: input.external_id + ':' + string(input.amount) + ':' + string(input.attempt)
228
+ - name: get_status
229
+ label: {id: Cek status pembayaran}
230
+ request:
231
+ method: GET
232
+ url: https://{auth.api_host}/v2/{input.gateway_ref}/status
233
+ input:
234
+ - {name: gateway_ref, type: data, required: true, help: {id: 'Order id Midtrans (gateway_ref pembayaran)'}}
235
+ output:
236
+ gateway_ref: "'order_id' in response ? order_id : null"
237
+ status: "'transaction_status' in response ? transaction_status : null"
238
+ # 200 settled, 201 pending, 202 denied, 404 no such transaction, 407 expired
239
+ status_code: status_code
240
+ paid: "status_code == '200' && 'transaction_status' in response && (transaction_status == 'settlement' || transaction_status == 'capture') && (!('fraud_status' in response) || fraud_status == 'accept')"
241
+ paid_amount: "'gross_amount' in response ? gross_amount : null"
242
+ channel: "'payment_type' in response ? payment_type : null"
243
+ transaction_id: "'transaction_id' in response ? transaction_id : null"
244
+ refund_amount: "'refund_amount' in response ? refund_amount : null"
245
+ retry: {max: 3, backoff: exponential, on: [429, 500, 502, 503]}
246
+ idempotency: input.gateway_ref
247
+ limits:
248
+ rate: per Midtrans account
249
+ note: {id: 'Biaya per transaksi dipotong Midtrans sebelum settlement. Refund dibuat di dashboard Midtrans'}
@@ -0,0 +1,34 @@
1
+ {
2
+ "status_code": "201",
3
+ "status_message": "GO-PAY billing created",
4
+ "transaction_id": "231c79c5-e39e-4993-86da-000000000011",
5
+ "order_id": "INV-2026-00011",
6
+ "gross_amount": "85000.00",
7
+ "currency": "IDR",
8
+ "payment_type": "gopay",
9
+ "transaction_time": "2026-11-19 10:30:00",
10
+ "transaction_status": "pending",
11
+ "fraud_status": "accept",
12
+ "actions": [
13
+ {
14
+ "name": "generate-qr-code",
15
+ "method": "GET",
16
+ "url": "https://api.sandbox.midtrans.com/v2/gopay/231c79c5-e39e-4993-86da-000000000011/qr-code"
17
+ },
18
+ {
19
+ "name": "deeplink-redirect",
20
+ "method": "GET",
21
+ "url": "https://simulator.sandbox.midtrans.com/gopay/partner/app/payment-pin?id=contoh-0011"
22
+ },
23
+ {
24
+ "name": "get-status",
25
+ "method": "GET",
26
+ "url": "https://api.sandbox.midtrans.com/v2/231c79c5-e39e-4993-86da-000000000011/status"
27
+ },
28
+ {
29
+ "name": "cancel",
30
+ "method": "POST",
31
+ "url": "https://api.sandbox.midtrans.com/v2/231c79c5-e39e-4993-86da-000000000011/cancel"
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "status_code": "201",
3
+ "status_message": "QRIS transaction is created",
4
+ "transaction_id": "0d8178e1-c6c7-4ab4-81a6-000000000007",
5
+ "order_id": "INV-2026-00007",
6
+ "merchant_id": "G000000001",
7
+ "gross_amount": "750000.00",
8
+ "currency": "IDR",
9
+ "payment_type": "qris",
10
+ "transaction_time": "2026-11-19 10:12:00",
11
+ "transaction_status": "pending",
12
+ "fraud_status": "accept",
13
+ "acquirer": "gopay",
14
+ "actions": [
15
+ {
16
+ "name": "generate-qr-code",
17
+ "method": "GET",
18
+ "url": "https://api.sandbox.midtrans.com/v2/qris/0d8178e1-c6c7-4ab4-81a6-000000000007/qr-code"
19
+ }
20
+ ],
21
+ "qr_string": "00020101021226620014COM.GO-JEK.WWW011993600914300000000070210G0000000010303UKE51440014ID.CO.QRIS.WWW0215ID10200000000070303UKE5204581253033605405750005802ID5913Tahu Contoh6007BANDUNG61054011162070703A016304ABCD",
22
+ "expiry_time": "2026-11-19 10:27:00"
23
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "status_code": "201",
3
+ "status_message": "Success, Bank Transfer transaction is created",
4
+ "transaction_id": "be03df7d-2f97-4c8c-a53c-000000000008",
5
+ "order_id": "INV-2026-00008",
6
+ "merchant_id": "G000000001",
7
+ "gross_amount": "400000.00",
8
+ "currency": "IDR",
9
+ "payment_type": "bank_transfer",
10
+ "transaction_time": "2026-11-19 10:20:00",
11
+ "transaction_status": "pending",
12
+ "fraud_status": "accept",
13
+ "va_numbers": [
14
+ {
15
+ "bank": "bca",
16
+ "va_number": "812785002530231"
17
+ }
18
+ ],
19
+ "expiry_time": "2026-11-20 10:20:00"
20
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "token": "tok-contoh-0007",
3
+ "redirect_url": "https://app.sandbox.midtrans.com/snap/v3/redirection/tok-contoh-0007"
4
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "payment_notified.json": {
3
+ "gateway_ref": "INV-2026-00007",
4
+ "external_id": "INV-2026-00007",
5
+ "paid_amount": "750000.00",
6
+ "status": "settlement",
7
+ "status_code": "200",
8
+ "paid": true,
9
+ "refunded": false,
10
+ "channel": "qris",
11
+ "refund_amount": null
12
+ },
13
+ "payment_notified_pending.json": {
14
+ "external_id": "INV-2026-00008",
15
+ "paid": false,
16
+ "refunded": false,
17
+ "channel": "bank_transfer"
18
+ },
19
+ "payment_notified_va.json": {
20
+ "gateway_ref": "INV-2026-00008~2",
21
+ "external_id": "INV-2026-00008",
22
+ "paid_amount": "400000.00",
23
+ "paid": true,
24
+ "channel": "bank_transfer"
25
+ },
26
+ "payment_notified_expire.json": {
27
+ "status": "expire",
28
+ "status_code": "407",
29
+ "paid": false,
30
+ "refunded": false
31
+ },
32
+ "payment_notified_refund.json": {
33
+ "gateway_ref": "INV-2026-00007",
34
+ "paid": false,
35
+ "refunded": true,
36
+ "refund_amount": "750000.00"
37
+ },
38
+ "payment_notified_partial_refund.json": {
39
+ "paid": false,
40
+ "refunded": true,
41
+ "refund_amount": "250000.00",
42
+ "paid_amount": "750000.00"
43
+ },
44
+ "payment_notified_challenge.json": {
45
+ "status": "capture",
46
+ "paid": false
47
+ },
48
+ "create_snap.json": {
49
+ "payment_url": "https://app.sandbox.midtrans.com/snap/v3/redirection/tok-contoh-0007",
50
+ "token_id": "tok-contoh-0007"
51
+ },
52
+ "charge_qris.json": {
53
+ "gateway_ref": "INV-2026-00007",
54
+ "status": "pending",
55
+ "status_code": "201",
56
+ "qr_url": "https://api.sandbox.midtrans.com/v2/qris/0d8178e1-c6c7-4ab4-81a6-000000000007/qr-code",
57
+ "expires_at": "2026-11-19 10:27:00"
58
+ },
59
+ "charge_va.json": {
60
+ "gateway_ref": "INV-2026-00008",
61
+ "account_number": "812785002530231",
62
+ "bank_code": "bca",
63
+ "expires_at": "2026-11-20 10:20:00"
64
+ },
65
+ "charge_gopay.json": {
66
+ "gateway_ref": "INV-2026-00011",
67
+ "deeplink_url": "https://simulator.sandbox.midtrans.com/gopay/partner/app/payment-pin?id=contoh-0011"
68
+ },
69
+ "get_status.json": {
70
+ "gateway_ref": "INV-2026-00007",
71
+ "status": "settlement",
72
+ "status_code": "200",
73
+ "paid": true,
74
+ "paid_amount": "750000.00",
75
+ "channel": "qris",
76
+ "refund_amount": null
77
+ },
78
+ "payment_notified_relabelled.json": {
79
+ "gateway_ref": "INV-2026-00012",
80
+ "status": "cancel",
81
+ "paid": false,
82
+ "refunded": false
83
+ },
84
+ "payment_notified_other_amount.json": {
85
+ "paid": false,
86
+ "paid_amount": "750000.00"
87
+ }
88
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "transaction_time": "2026-11-19 10:12:40",
3
+ "transaction_status": "settlement",
4
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
5
+ "status_message": "Success, transaction is found",
6
+ "status_code": "200",
7
+ "signature_key": "(hex SHA-512, see signature_vector.txt)",
8
+ "payment_type": "qris",
9
+ "order_id": "INV-2026-00007",
10
+ "merchant_id": "G000000001",
11
+ "gross_amount": "750000.00",
12
+ "fraud_status": "accept",
13
+ "currency": "IDR",
14
+ "settlement_time": "2026-11-19 10:13:05"
15
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "transaction_time": "2026-11-19 10:12:40",
3
+ "transaction_status": "settlement",
4
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
5
+ "status_message": "midtrans payment notification",
6
+ "status_code": "200",
7
+ "signature_key": "(hex SHA-512, see signature_vector.txt)",
8
+ "payment_type": "qris",
9
+ "order_id": "INV-2026-00007",
10
+ "merchant_id": "G000000001",
11
+ "gross_amount": "750000.00",
12
+ "fraud_status": "accept",
13
+ "currency": "IDR",
14
+ "transaction_type": "on-us",
15
+ "settlement_time": "2026-11-19 10:13:05",
16
+ "issuer": "gopay",
17
+ "acquirer": "gopay",
18
+ "confirmed": {
19
+ "gateway_ref": "INV-2026-00007",
20
+ "status": "settlement",
21
+ "status_code": "200",
22
+ "paid": true,
23
+ "paid_amount": "750000.00",
24
+ "channel": "qris",
25
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
26
+ "refund_amount": null
27
+ }
28
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "transaction_time": "2026-11-19 10:12:40",
3
+ "transaction_status": "capture",
4
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
5
+ "status_message": "midtrans payment notification",
6
+ "status_code": "200",
7
+ "signature_key": "(hex SHA-512, see signature_vector.txt)",
8
+ "payment_type": "credit_card",
9
+ "order_id": "INV-2026-00010",
10
+ "merchant_id": "G000000001",
11
+ "gross_amount": "990000.00",
12
+ "fraud_status": "challenge",
13
+ "currency": "IDR",
14
+ "confirmed": {
15
+ "gateway_ref": "INV-2026-00010",
16
+ "status": "capture",
17
+ "status_code": "200",
18
+ "paid": false,
19
+ "paid_amount": "990000.00",
20
+ "channel": "credit_card",
21
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
22
+ "refund_amount": null
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "transaction_time": "2026-11-19 10:12:40",
3
+ "transaction_status": "expire",
4
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
5
+ "status_message": "midtrans payment notification",
6
+ "status_code": "407",
7
+ "signature_key": "(hex SHA-512, see signature_vector.txt)",
8
+ "payment_type": "qris",
9
+ "order_id": "INV-2026-00009",
10
+ "merchant_id": "G000000001",
11
+ "gross_amount": "120000.00",
12
+ "fraud_status": "accept",
13
+ "currency": "IDR",
14
+ "confirmed": {
15
+ "gateway_ref": "INV-2026-00009",
16
+ "status": "expire",
17
+ "status_code": "407",
18
+ "paid": false,
19
+ "paid_amount": "120000.00",
20
+ "channel": "qris",
21
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
22
+ "refund_amount": null
23
+ }
24
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "transaction_time": "2026-11-19 10:12:40",
3
+ "transaction_status": "settlement",
4
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
5
+ "status_message": "midtrans payment notification",
6
+ "status_code": "200",
7
+ "signature_key": "(hex SHA-512, see signature_vector.txt)",
8
+ "payment_type": "qris",
9
+ "order_id": "INV-2026-00013",
10
+ "merchant_id": "G000000001",
11
+ "gross_amount": "750000.00",
12
+ "fraud_status": "accept",
13
+ "currency": "IDR",
14
+ "transaction_type": "on-us",
15
+ "settlement_time": "2026-11-19 10:13:05",
16
+ "issuer": "gopay",
17
+ "acquirer": "gopay",
18
+ "confirmed": {
19
+ "gateway_ref": "INV-2026-00013",
20
+ "status": "settlement",
21
+ "status_code": "200",
22
+ "paid": true,
23
+ "paid_amount": "7500.00",
24
+ "channel": "qris",
25
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
26
+ "refund_amount": null
27
+ }
28
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "transaction_time": "2026-11-19 10:12:40",
3
+ "transaction_status": "partial_refund",
4
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
5
+ "status_message": "midtrans payment notification",
6
+ "status_code": "200",
7
+ "signature_key": "(hex SHA-512, see signature_vector.txt)",
8
+ "payment_type": "gopay",
9
+ "order_id": "INV-2026-00007",
10
+ "merchant_id": "G000000001",
11
+ "gross_amount": "750000.00",
12
+ "fraud_status": "accept",
13
+ "currency": "IDR",
14
+ "refund_amount": "250000.00",
15
+ "refunds": [
16
+ {
17
+ "refund_chargeback_id": 2,
18
+ "refund_amount": "250000.00",
19
+ "created_at": "2026-11-20 09:00:00",
20
+ "reason": "barang kurang",
21
+ "refund_key": "retur-2"
22
+ }
23
+ ],
24
+ "confirmed": {
25
+ "gateway_ref": "INV-2026-00007",
26
+ "status": "partial_refund",
27
+ "status_code": "200",
28
+ "paid": false,
29
+ "paid_amount": "750000.00",
30
+ "channel": "gopay",
31
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
32
+ "refund_amount": "250000.00"
33
+ }
34
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "transaction_time": "2026-11-19 10:12:40",
3
+ "transaction_status": "pending",
4
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
5
+ "status_message": "midtrans payment notification",
6
+ "status_code": "201",
7
+ "signature_key": "(hex SHA-512, see signature_vector.txt)",
8
+ "payment_type": "bank_transfer",
9
+ "order_id": "INV-2026-00008",
10
+ "merchant_id": "G000000001",
11
+ "gross_amount": "400000.00",
12
+ "fraud_status": "accept",
13
+ "currency": "IDR",
14
+ "va_numbers": [
15
+ {
16
+ "va_number": "812785002530231",
17
+ "bank": "bca"
18
+ }
19
+ ],
20
+ "payment_amounts": [],
21
+ "confirmed": {
22
+ "gateway_ref": "INV-2026-00008",
23
+ "status": "pending",
24
+ "status_code": "201",
25
+ "paid": false,
26
+ "paid_amount": "400000.00",
27
+ "channel": "bank_transfer",
28
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
29
+ "refund_amount": null
30
+ }
31
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "transaction_time": "2026-11-19 10:12:40",
3
+ "transaction_status": "refund",
4
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
5
+ "status_message": "midtrans payment notification",
6
+ "status_code": "200",
7
+ "signature_key": "(hex SHA-512, see signature_vector.txt)",
8
+ "payment_type": "qris",
9
+ "order_id": "INV-2026-00007",
10
+ "merchant_id": "G000000001",
11
+ "gross_amount": "750000.00",
12
+ "fraud_status": "accept",
13
+ "currency": "IDR",
14
+ "refund_amount": "750000.00",
15
+ "refunds": [
16
+ {
17
+ "refund_chargeback_id": 1,
18
+ "refund_amount": "750000.00",
19
+ "created_at": "2026-11-20 09:00:00",
20
+ "reason": "salah tagih",
21
+ "refund_key": "retur-1"
22
+ }
23
+ ],
24
+ "confirmed": {
25
+ "gateway_ref": "INV-2026-00007",
26
+ "status": "refund",
27
+ "status_code": "200",
28
+ "paid": false,
29
+ "paid_amount": "750000.00",
30
+ "channel": "qris",
31
+ "transaction_id": "9f1c7a52-3b8e-4d61-a2f4-000000000007",
32
+ "refund_amount": "750000.00"
33
+ }
34
+ }