@rangka-os/create 0.5.0-alpha.4 → 0.5.0-alpha.6

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 (110) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/crm/processes/lead_to_cash.rk +8 -0
  3. package/template/base/apps/fnb_cabang/dashboards/stock_recap.rk +6 -4
  4. package/template/base/apps/jasa_proyek/app.rk +5 -4
  5. package/template/base/apps/jasa_proyek/dashboards/jasa_overview.rk +20 -0
  6. package/template/base/apps/jasa_proyek/dashboards/project_margin.rk +66 -0
  7. package/template/base/apps/jasa_proyek/processes/quote_to_cash.rk +10 -0
  8. package/template/base/apps/ritel_cabang/app.rk +50 -0
  9. package/template/base/apps/ritel_cabang/dashboards/ritel_overview.rk +123 -0
  10. package/template/base/apps/ritel_cabang/dashboards/ritel_stock.rk +146 -0
  11. package/template/base/apps/ritel_cabang/dashboards/ritel_tax.rk +76 -0
  12. package/template/base/connectors/loyverse/connector.rk +93 -0
  13. package/template/base/connectors/moka/connector.rk +81 -0
  14. package/template/base/connectors/whatsapp_business/connector.rk +16 -0
  15. package/template/base/connectors/whatsapp_business/templates.md +32 -0
  16. package/template/base/connectors/xendit/connector.rk +179 -0
  17. package/template/base/modules/bank_statement/flows/bank_transaction_claim.rk +19 -0
  18. package/template/base/modules/bank_statement/flows/bank_transaction_confirm.rk +43 -0
  19. package/template/base/modules/bank_statement/flows/bank_transaction_link_locked.rk +11 -0
  20. package/template/base/modules/bank_statement/flows/bank_transaction_matched.rk +13 -0
  21. package/template/base/modules/bank_statement/flows/bank_transaction_release.rk +11 -0
  22. package/template/base/modules/bank_statement/flows/bank_transaction_suggest.rk +21 -0
  23. package/template/base/modules/bank_statement/flows/bank_transaction_unmatched.rk +11 -0
  24. package/template/base/modules/bank_statement/imports/bank_statement_csv.rk +25 -0
  25. package/template/base/modules/bank_statement/models/bank_transaction.rk +124 -0
  26. package/template/base/modules/bank_statement/models/bank_transaction_claim.rk +49 -0
  27. package/template/base/modules/bank_statement/module.rk +7 -0
  28. package/template/base/modules/catalogue/imports/item_list.rk +20 -0
  29. package/template/base/modules/catalogue/imports/item_master.rk +25 -0
  30. package/template/base/modules/catalogue/models/item.rk +34 -1
  31. package/template/base/modules/catalogue/models/item_category.rk +26 -0
  32. package/template/base/modules/consignment/flows/consignment_bill.rk +36 -0
  33. package/template/base/modules/consignment/flows/consignment_bill_cancelled.rk +14 -0
  34. package/template/base/modules/consignment/models/consignment_settlement.rk +93 -0
  35. package/template/base/modules/consignment/models/consignment_settlement_item.rk +37 -0
  36. package/template/base/modules/consignment/module.rk +10 -0
  37. package/template/base/modules/contacts/imports/customer_list.rk +17 -0
  38. package/template/base/modules/contacts/imports/vendor_list.rk +16 -0
  39. package/template/base/modules/invoicing/flows/invoice_due_digest.rk +12 -0
  40. package/template/base/modules/invoicing/flows/milestone_invoiced.rk +23 -0
  41. package/template/base/modules/invoicing/flows/milestone_reopened.rk +19 -0
  42. package/template/base/modules/invoicing/flows/project_billed_on_cancel.rk +16 -0
  43. package/template/base/modules/invoicing/flows/project_billed_on_submit.rk +16 -0
  44. package/template/base/modules/invoicing/flows/project_revenue_on_cancel.rk +22 -0
  45. package/template/base/modules/invoicing/flows/project_revenue_on_submit.rk +17 -0
  46. package/template/base/modules/invoicing/models/invoice_reminder.rk +83 -0
  47. package/template/base/modules/invoicing/models/sales_invoice.rk +93 -3
  48. package/template/base/modules/invoicing/models/sales_invoice_item.rk +9 -0
  49. package/template/base/modules/invoicing/module.rk +1 -1
  50. package/template/base/modules/invoicing/print/sales_invoice.html +2 -1
  51. package/template/base/modules/invoicing/print/sales_invoice_whatsapp.html +33 -0
  52. package/template/base/modules/invoicing/print/sales_invoice_whatsapp.rk +8 -0
  53. package/template/base/modules/outlet_sales/flows/moka_legacy_key_overlap.rk +22 -0
  54. package/template/base/modules/outlet_sales/imports/daily_form.rk +3 -1
  55. package/template/base/modules/outlet_sales/imports/loyverse_receipts.rk +28 -0
  56. package/template/base/modules/outlet_sales/imports/moka_item_details.rk +14 -4
  57. package/template/base/modules/outlet_sales/imports/pos_sales_file.rk +28 -0
  58. package/template/base/modules/outlet_sales/imports/takings_file.rk +23 -0
  59. package/template/base/modules/outlet_sales/models/outlet_sales.rk +72 -6
  60. package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +1 -0
  61. package/template/base/modules/outlet_sales/models/outlet_takings.rk +83 -0
  62. package/template/base/modules/outlet_sales/models/outlet_takings_line.rk +37 -0
  63. package/template/base/modules/outlets/models/outlet.rk +17 -0
  64. package/template/base/modules/payments/flows/payment_gateway_claim_created.rk +19 -0
  65. package/template/base/modules/payments/flows/payment_gateway_claim_submitted.rk +19 -0
  66. package/template/base/modules/payments/flows/payment_gateway_release.rk +12 -0
  67. package/template/base/modules/payments/models/gateway_ref_claim.rk +42 -0
  68. package/template/base/modules/payments/models/payment.rk +26 -1
  69. package/template/base/modules/payments/models/withholding.rk +3 -1
  70. package/template/base/modules/payments/module.rk +1 -1
  71. package/template/base/modules/procurement/flows/project_vendor_cost_on_cancel.rk +22 -0
  72. package/template/base/modules/procurement/flows/project_vendor_cost_on_submit.rk +17 -0
  73. package/template/base/modules/procurement/imports/opening_stock.rk +25 -0
  74. package/template/base/modules/procurement/models/goods_receipt.rk +1 -1
  75. package/template/base/modules/procurement/models/purchase_order.rk +15 -7
  76. package/template/base/modules/procurement/models/purchase_request.rk +11 -1
  77. package/template/base/modules/procurement/models/vendor_bill.rk +12 -1
  78. package/template/base/modules/procurement/module.rk +1 -1
  79. package/template/base/modules/projects/flows/milestone_back_on_acceptance_cancel.rk +15 -0
  80. package/template/base/modules/projects/flows/milestone_lock_on_update.rk +16 -0
  81. package/template/base/modules/projects/flows/milestone_ready_on_acceptance.rk +40 -0
  82. package/template/base/modules/projects/flows/milestone_scheduled_on_create.rk +14 -0
  83. package/template/base/modules/projects/flows/milestone_scheduled_on_update.rk +27 -0
  84. package/template/base/modules/projects/flows/project_expense_on_cancel.rk +21 -0
  85. package/template/base/modules/projects/flows/project_expense_on_submit.rk +16 -0
  86. package/template/base/modules/projects/flows/project_labor_on_cancel.rk +22 -0
  87. package/template/base/modules/projects/flows/project_labor_on_submit.rk +17 -0
  88. package/template/base/modules/projects/flows/project_terms_lock.rk +26 -0
  89. package/template/base/modules/projects/flows/vendor_bill_cancel_guard.rk +15 -0
  90. package/template/base/modules/projects/imports/billing_milestone.rk +20 -0
  91. package/template/base/modules/projects/models/assignment.rk +21 -1
  92. package/template/base/modules/projects/models/billing_milestone.rk +217 -0
  93. package/template/base/modules/projects/models/project.rk +76 -2
  94. package/template/base/modules/projects/models/project_expense.rk +119 -0
  95. package/template/base/modules/projects/models/project_guard.rk +27 -0
  96. package/template/base/modules/projects/models/project_ledger.rk +132 -0
  97. package/template/base/modules/projects/models/timesheet.rk +38 -3
  98. package/template/base/modules/projects/module.rk +1 -1
  99. package/template/base/modules/stock/flows/adjustment_value_backfill.rk +94 -0
  100. package/template/base/modules/stock/flows/adjustment_value_on_cancel.rk +19 -0
  101. package/template/base/modules/stock/flows/adjustment_value_on_submit.rk +17 -0
  102. package/template/base/modules/stock/models/recipe.rk +8 -0
  103. package/template/base/modules/stock/models/stock_adjustment.rk +1 -0
  104. package/template/base/modules/stock/models/stock_adjustment_value.rk +75 -0
  105. package/template/base/modules/stock/models/stock_balance.rk +3 -0
  106. package/template/base/modules/stock/models/stock_move.rk +6 -1
  107. package/template/base/modules/workforce/imports/worker_list.rk +16 -0
  108. package/template/base/modules/workforce/models/certification.rk +1 -2
  109. package/template/base/modules/workforce/models/worker.rk +22 -1
  110. package/template/demo/fixtures/demo.rk +2 -2
@@ -0,0 +1,81 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/connector.json
2
+ # Moka POS (GoTo): transactions, refunds, outlets and items through the Moka Connect API with OAuth 2.0
3
+ # (authorization code; the owner approves Juragan in Moka Backoffice).
4
+ # Status: spec. API access needs Moka's approval of the integration (developer application at Moka); the paths
5
+ # below follow Moka's published API reference and must be confirmed once access is granted. The kernel does not run
6
+ # connectors yet (contract 0002); until it does, rangka-apps imports the Item Details export
7
+ # (modules/outlet_sales/imports/moka_item_details), whose headers were checked against real exports.
8
+ name: moka
9
+ label: {id: Moka POS}
10
+ version: 0.1.0
11
+ vendor: Moka (GoTo)
12
+ docs: https://api.mokapos.com/docs
13
+ auth:
14
+ type: oauth2
15
+ fields:
16
+ - name: client_id
17
+ label: {id: Client ID}
18
+ - name: client_secret
19
+ label: {id: Client secret}
20
+ secret: true
21
+ - name: access_token
22
+ label: {id: Access token}
23
+ secret: true
24
+ help: {id: Diisi setelah pemilik menyetujui Juragan di Moka Backoffice}
25
+ - name: refresh_token
26
+ label: {id: Refresh token}
27
+ secret: true
28
+ triggers:
29
+ # Moka has no webhook for sales: a scheduled flow polls get_latest_transactions per outlet every 15 minutes and
30
+ # keeps the last `since` it saw; the transaction id is the idempotency key.
31
+ - name: transaction_created
32
+ label: {id: Transaksi baru}
33
+ via: poll
34
+ every: 15m
35
+ for_each: data.payments[]
36
+ emit:
37
+ transaction_id: item.id
38
+ outlet_id: item.outlet_id
39
+ receipt_no: item.payment_no
40
+ created_at: item.created_at
41
+ is_refunded: item.is_refunded
42
+ checkouts: item.checkouts
43
+ payment_type: item.payment_type
44
+ total_collected: item.total_collected
45
+ actions:
46
+ - name: latest_transactions
47
+ label: {id: Ambil transaksi terbaru}
48
+ request:
49
+ method: GET
50
+ url: https://api.mokapos.com/v3/outlets/{input.outlet_id}/reports/get_latest_transactions
51
+ headers: {Authorization: 'Bearer {auth.access_token}'}
52
+ query: {since: '{input.since}', per_page: '100', page: '{input.page}'}
53
+ input:
54
+ - {name: outlet_id, type: data, required: true}
55
+ - {name: since, type: datetime, required: true}
56
+ - {name: page, type: int}
57
+ output: {payments: data.payments, next: data.completed}
58
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
59
+ - name: list_outlets
60
+ label: {id: Daftar outlet}
61
+ request:
62
+ method: GET
63
+ url: https://api.mokapos.com/v1/businesses/outlets
64
+ headers: {Authorization: 'Bearer {auth.access_token}'}
65
+ output: {outlets: data}
66
+ retry: {max: 3, backoff: exponential, on: [429, 500, 502, 503]}
67
+ - name: list_items
68
+ label: {id: Daftar barang}
69
+ request:
70
+ method: GET
71
+ url: https://api.mokapos.com/v1/outlets/{input.outlet_id}/items
72
+ headers: {Authorization: 'Bearer {auth.access_token}'}
73
+ query: {per_page: '100', page: '{input.page}'}
74
+ input:
75
+ - {name: outlet_id, type: data, required: true}
76
+ - {name: page, type: int}
77
+ output: {items: data.items}
78
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
79
+ limits:
80
+ rate: per Moka partner agreement
81
+ note: {id: 'Akses API Moka lewat persetujuan integrasi dari Moka; ekspor file tetap jalan tanpa akses API'}
@@ -37,6 +37,22 @@ triggers:
37
37
  text: item.text.body
38
38
  profile_name: value.contacts[0].profile.name
39
39
  at: item.timestamp
40
+ # Delivery receipts of messages we sent (sent, delivered, read, failed), so a reminder can be logged as delivered.
41
+ - name: message_status
42
+ label: {id: Status pesan terkirim}
43
+ via: webhook
44
+ verify:
45
+ signature:
46
+ header: X-Hub-Signature-256
47
+ alg: hmac-sha256
48
+ key: auth.app_secret
49
+ for_each: entry[].changes[].value.statuses[]
50
+ emit:
51
+ message_id: item.id
52
+ status: item.status
53
+ to: item.recipient_id
54
+ at: item.timestamp
55
+ error: item.errors[0].title
40
56
  actions:
41
57
  - name: send_template
42
58
  label: {id: Kirim pesan template}
@@ -0,0 +1,32 @@
1
+ # Message templates for payment collection
2
+
3
+ Templates sent outside the 24-hour window must be approved by Meta first (category **Utility**, language `id`).
4
+ Names are lowercase `snake_case`, as Meta requires; rangka-apps uses the same names in `invoice_reminder.template`
5
+ and in the print *Pesan tagihan WA*, so the manual reminder (sent from the owner's phone) and the automatic one say
6
+ the same thing. Utility templates carry no promotion; Meta charges per delivered message.
7
+
8
+ | Name | When | Body (`{{n}}` = parameter) |
9
+ | --- | --- | --- |
10
+ | `tagihan_terbit` | invoice submitted | Halo {{1}}, berikut tagihan {{2}} no. {{3}} sebesar {{4}}, jatuh tempo {{5}}. Pembayaran ke {{6}}. Mohon tulis {{3}} di berita transfer. Terima kasih. |
11
+ | `pengingat_jatuh_tempo` | due date passed, still owed | Halo {{1}}, kami mengingatkan faktur {{2}} sebesar {{3}} sudah lewat {{4}} hari dari jatuh tempo ({{5}}). Pembayaran ke {{6}}. Mohon tulis {{2}} di berita transfer. Abaikan pesan ini kalau sudah membayar. Terima kasih. |
12
+ | `terima_kasih_lunas` | invoice paid | Halo {{1}}, terima kasih. Pembayaran faktur {{2}} sudah kami terima dan faktur ini sudah lunas. |
13
+
14
+ Parameters, in order:
15
+
16
+ - `tagihan_terbit`: customer name, business name, invoice number, amount (`Rp 1.234.000`), due date, bank account
17
+ (`Bank Contoh 111 000 0001 a.n. PT Contoh`)
18
+ - `pengingat_jatuh_tempo`: customer name, invoice number, outstanding amount, days late, due date, bank account
19
+ - `terima_kasih_lunas`: customer name, invoice number
20
+
21
+ `send_template` takes them as `components`:
22
+
23
+ ```yaml
24
+ - call: whatsapp_business.send_template
25
+ with:
26
+ to: customer.phone
27
+ template: "'pengingat_jatuh_tempo'"
28
+ components: "[{'type': 'body', 'parameters': [{'type': 'text', 'text': customer.customer_name}, ...]}]"
29
+ ```
30
+
31
+ Onboarding a business's own number goes through Meta's Embedded Signup as a Tech Provider; the older Embedded
32
+ Signup flow stopped on 15 October 2026.
@@ -0,0 +1,179 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/connector.json
2
+ # Xendit (Indonesia): fixed virtual accounts, dynamic QRIS and payment links, for one business or a xenPlatform
3
+ # sub-account (header for-user-id). Every request uses the secret key as the Basic auth user name with an empty password.
4
+ # Callbacks carry the account's callback token in the x-callback-token header (a static token, not an HMAC).
5
+ # Every trigger emits gateway_ref (Xendit's payment id): flows use it as idempotency key and as payment.gateway_ref,
6
+ # held by one live payment at a time in rangka-apps (gateway_ref_claim), so a callback delivered twice cannot pay an
7
+ # invoice twice.
8
+ # A trigger fires for every callback of its kind, not only for payments: Xendit sends the invoice callback for
9
+ # EXPIRED links too, and a QR callback carries event (qr.payment, qr.refund) and data.status. Every trigger therefore emits `paid` (true only for a
10
+ # completed payment: VA always, QR qr.payment SUCCEEDED, link PAID or SETTLED), and a flow that records money starts with
11
+ # `if: event.paid` (the trigger format has no filter of its own). See the README example.
12
+ # Test mode: a secret key starting with xnd_development_ talks to the same URLs; the dashboard simulates VA and QRIS
13
+ # payments and sends the callbacks.
14
+ name: xendit
15
+ label: {id: Xendit}
16
+ version: 0.1.0
17
+ vendor: Xendit
18
+ docs: https://developers.xendit.co/api-reference/
19
+ auth:
20
+ type: basic
21
+ fields:
22
+ - name: secret_key
23
+ label: {id: Secret key}
24
+ secret: true
25
+ help: {id: 'Dashboard Xendit > Settings > API keys. Kunci xnd_development_ untuk mode test.'}
26
+ - name: callback_token
27
+ label: {id: Callback verification token}
28
+ secret: true
29
+ help: {id: Dashboard Xendit > Settings > Callbacks. Dipakai memeriksa header x-callback-token}
30
+ - name: for_user_id
31
+ label: {id: ID sub-account xenPlatform}
32
+ help: {id: Kosongkan kalau akun Xendit milik usaha ini sendiri}
33
+ triggers:
34
+ - name: va_paid
35
+ label: {id: Virtual account dibayar}
36
+ via: webhook
37
+ verify:
38
+ header: x-callback-token
39
+ equals: auth.callback_token
40
+ emit:
41
+ gateway_ref: payment_id
42
+ external_id: external_id
43
+ paid_amount: amount
44
+ paid_at: transaction_timestamp
45
+ method: "'va'"
46
+ paid: 'true'
47
+ bank_code: bank_code
48
+ account_number: account_number
49
+ sub_account: owner_id
50
+ - name: qr_paid
51
+ label: {id: QRIS dibayar}
52
+ via: webhook
53
+ verify:
54
+ header: x-callback-token
55
+ equals: auth.callback_token
56
+ emit:
57
+ gateway_ref: data.id
58
+ external_id: data.reference_id
59
+ paid_amount: data.amount
60
+ paid_at: data.created
61
+ status: data.status
62
+ paid: event == 'qr.payment' && data.status == 'SUCCEEDED'
63
+ method: "'qris'"
64
+ sub_account: business_id
65
+ - name: invoice_paid
66
+ label: {id: Link bayar dibayar}
67
+ via: webhook
68
+ verify:
69
+ header: x-callback-token
70
+ equals: auth.callback_token
71
+ emit:
72
+ gateway_ref: id
73
+ external_id: external_id
74
+ status: status
75
+ paid: status == 'PAID' || status == 'SETTLED'
76
+ paid_amount: paid_amount
77
+ paid_at: paid_at
78
+ # Xendit's payment_method (BANK_TRANSFER, QR_CODE, EWALLET, ...) as rangka-apps payment.method
79
+ method: "payment_method == 'BANK_TRANSFER' ? 'va' : payment_method == 'QR_CODE' ? 'qris' : payment_method == 'EWALLET' ? 'ewallet' : 'other'"
80
+ channel: payment_channel
81
+ fee: fees_paid_amount
82
+ sub_account: user_id
83
+ actions:
84
+ - name: create_fixed_va
85
+ label: {id: Buat virtual account}
86
+ request:
87
+ method: POST
88
+ url: https://api.xendit.co/callback_virtual_accounts
89
+ headers: {for-user-id: '{auth.for_user_id}'}
90
+ body:
91
+ external_id: '{input.external_id}'
92
+ bank_code: '{input.bank_code}'
93
+ name: '{input.customer_name}'
94
+ expected_amount: '{input.amount}'
95
+ is_closed: '{input.amount > 0}'
96
+ is_single_use: '{input.single_use}'
97
+ expiration_date: '{input.expires_at}'
98
+ input:
99
+ - {name: external_id, type: data, required: true, help: {id: Nomor faktur}}
100
+ - {name: bank_code, type: data, required: true, help: {id: 'BCA, BNI, BRI, MANDIRI, PERMATA, BSI, CIMB'}}
101
+ - {name: customer_name, type: data, required: true}
102
+ - {name: amount, type: currency, help: {id: 'Kosong atau 0: VA terbuka, nominal bebas'}}
103
+ - {name: single_use, type: check}
104
+ - {name: expires_at, type: datetime}
105
+ output:
106
+ gateway_ref: id
107
+ account_number: account_number
108
+ bank_code: bank_code
109
+ status: status
110
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
111
+ idempotency: input.external_id + ':' + string(input.amount)
112
+ - name: create_qr_code
113
+ label: {id: Buat QRIS dinamis}
114
+ request:
115
+ method: POST
116
+ url: https://api.xendit.co/qr_codes
117
+ headers: {api-version: '2022-07-31', for-user-id: '{auth.for_user_id}'}
118
+ body:
119
+ reference_id: '{input.external_id}'
120
+ type: DYNAMIC
121
+ currency: IDR
122
+ amount: '{input.amount}'
123
+ expires_at: '{input.expires_at}'
124
+ input:
125
+ - {name: external_id, type: data, required: true}
126
+ - {name: amount, type: currency, required: true}
127
+ - {name: expires_at, type: datetime}
128
+ output:
129
+ gateway_ref: id
130
+ qr_string: qr_string
131
+ expires_at: expires_at
132
+ status: status
133
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
134
+ idempotency: input.external_id + ':' + string(input.amount)
135
+ - name: create_invoice
136
+ label: {id: Buat link bayar}
137
+ request:
138
+ method: POST
139
+ url: https://api.xendit.co/v2/invoices
140
+ headers: {for-user-id: '{auth.for_user_id}'}
141
+ body:
142
+ external_id: '{input.external_id}'
143
+ amount: '{input.amount}'
144
+ description: '{input.description}'
145
+ invoice_duration: '{input.duration_seconds}'
146
+ customer:
147
+ given_names: '{input.customer_name}'
148
+ mobile_number: '{input.phone}'
149
+ currency: IDR
150
+ input:
151
+ - {name: external_id, type: data, required: true}
152
+ - {name: amount, type: currency, required: true}
153
+ - {name: description, type: data}
154
+ - {name: customer_name, type: data}
155
+ - {name: phone, type: phone}
156
+ - {name: duration_seconds, type: int, default: '604800'}
157
+ output:
158
+ gateway_ref: id
159
+ url: invoice_url
160
+ expires_at: expiry_date
161
+ status: status
162
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
163
+ idempotency: input.external_id + ':' + string(input.amount)
164
+ - name: get_invoice
165
+ label: {id: Cek status link bayar}
166
+ request:
167
+ method: GET
168
+ url: https://api.xendit.co/v2/invoices/{input.gateway_ref}
169
+ headers: {for-user-id: '{auth.for_user_id}'}
170
+ input:
171
+ - {name: gateway_ref, type: data, required: true}
172
+ output:
173
+ status: status
174
+ paid_amount: paid_amount
175
+ paid_at: paid_at
176
+ retry: {max: 3, backoff: exponential, on: [429, 500, 502, 503]}
177
+ idempotency: input.gateway_ref
178
+ limits:
179
+ note: {id: 'Biaya per transaksi VA dan QRIS dipotong Xendit sebelum settlement ke rekening usaha.'}
@@ -0,0 +1,19 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # A payment that names a statement line is submitted: it claims the line (bank_transaction_claim). The unique index
3
+ # refuses the claim, and with it the whole submit, when another live payment already holds the line. The claim's
4
+ # rule refuses it too when the payment is not the line's own: not the draft the line made (line.draft_payment, the
5
+ # draft's name before submit) nor the amend of a payment of the same line, or not for the line's amount.
6
+ name: bank_transaction_claim
7
+ label: {id: Klaim mutasi saat pembayaran diajukan}
8
+ on: payment.submitted
9
+ if: event.direction == 'receive' && event.bank_transaction != ''
10
+ steps:
11
+ - {find: bank_transaction, where: name == event.bank_transaction, as: line}
12
+ - find: payment
13
+ where: "event.amended_from != '' && name == event.amended_from && bank_transaction == event.bank_transaction"
14
+ as: source
15
+ - create: bank_transaction_claim
16
+ set:
17
+ bank_transaction: event.bank_transaction
18
+ payment: event.name
19
+ valid: "line != null && line.amount == event.amount && (line.draft_payment == event.before.name || source != null)"
@@ -0,0 +1,43 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # The owner sets a line to "Dikonfirmasi": draft a payment from the customer of the chosen invoice, for the line's
3
+ # amount, allocated to that invoice (up to what it still owes; any rest stays unallocated on the payment), naming the
4
+ # line in payment.bank_transaction. The draft is submitted by a person (finance), which settles the invoice.
5
+ # A draft of this line that is still open (an earlier draft, or the amend of a cancelled one) is pointed at the
6
+ # invoice chosen last instead of drafting another. Extra drafts are harmless anyway: bank_transaction_claim lets only
7
+ # one live payment per line be submitted.
8
+ name: bank_transaction_confirm
9
+ label: {id: Mutasi dikonfirmasi jadi pembayaran}
10
+ on: bank_transaction.updated
11
+ if: event.status == 'confirmed' && event.payment == '' && event.suggested_invoice != ''
12
+ steps:
13
+ - {find: payment, where: "docstatus == 0 && bank_transaction == event.name", as: draft}
14
+ # a live payment already names the line (it is matched then, or a payment typed by hand carries the line in its
15
+ # reference): no new draft, so the same transfer is never drafted twice
16
+ - {find: payment, where: "docstatus == 1 && direction == 'receive' && (bank_transaction == event.name || reference == event.name)", as: paid}
17
+ - {find: sales_invoice, where: name == event.suggested_invoice, as: inv}
18
+ - {find: bank_transaction, where: name == event.name, as: line}
19
+ - update: draft
20
+ if: inv != null && draft != null
21
+ set:
22
+ customer: inv.customer
23
+ amount: event.amount
24
+ allocations: "[{'sales_invoice': inv.name, 'amount': min(event.amount, inv.outstanding)}]"
25
+ - create: payment
26
+ if: inv != null && draft == null && paid == null
27
+ set:
28
+ direction: "'receive'"
29
+ customer: inv.customer
30
+ payment_date: event.date
31
+ method: "'transfer'"
32
+ reference: event.name
33
+ bank_transaction: event.name
34
+ amount: event.amount
35
+ allocations: "[{'sales_invoice': inv.name, 'amount': min(event.amount, inv.outstanding)}]"
36
+ notes: "'Dari mutasi ' + event.name + ': ' + event.description"
37
+ as: pay
38
+ - update: line
39
+ if: inv != null && draft != null && draft.name != event.draft_payment
40
+ set: {draft_payment: draft.name}
41
+ - update: line
42
+ if: inv != null && draft == null && paid == null
43
+ set: {draft_payment: pay.name}
@@ -0,0 +1,11 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # payment.bank_transaction is set when the payment is made (the line's draft, or by hand) and never changed after:
3
+ # clearing it would let the draft be submitted without claiming the line, moving it would let it claim another line.
4
+ # A change is refused by creating an invalid claim, whose rule rolls the whole save back.
5
+ name: bank_transaction_link_locked
6
+ label: {id: Mutasi bank di pembayaran tidak bisa diubah}
7
+ on: payment.updated
8
+ if: event.before != null && event.before.bank_transaction != event.bank_transaction
9
+ steps:
10
+ - create: bank_transaction_claim
11
+ set: {bank_transaction: "''", payment: event.name, valid: 'false'}
@@ -0,0 +1,13 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # A payment that names a statement line (payment.bank_transaction) is submitted: the line is matched to it. By then
3
+ # bank_transaction_claim (same event, earlier in name order) has made sure no other live payment holds the line.
4
+ # reference is free text and never picks the line.
5
+ name: bank_transaction_matched
6
+ label: {id: Mutasi cocok saat pembayaran diajukan}
7
+ on: payment.submitted
8
+ if: event.direction == 'receive' && event.bank_transaction != ''
9
+ steps:
10
+ - {find: bank_transaction, where: name == event.bank_transaction, as: line}
11
+ - update: line
12
+ if: line != null
13
+ set: {status: "'matched'", payment: event.name, draft_payment: "''"}
@@ -0,0 +1,11 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # A payment that held a statement line is cancelled: its claim gives the line back.
3
+ name: bank_transaction_release
4
+ label: {id: Lepas klaim mutasi saat pembayaran dibatalkan}
5
+ on: payment.cancelled
6
+ if: event.direction == 'receive' && event.bank_transaction != ''
7
+ steps:
8
+ - {find: bank_transaction_claim, where: bank_transaction == event.bank_transaction && payment == event.name, as: held}
9
+ - update: held
10
+ if: held != null
11
+ set: {bank_transaction: "''", released_line: event.bank_transaction}
@@ -0,0 +1,21 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # A new statement line with money in looks for the invoice it pays. First choice: an open invoice whose number is in
3
+ # the transfer note. Otherwise: exactly one open invoice whose remaining amount equals the line. Two candidates of
4
+ # the same amount -> no suggestion (the owner picks). It only suggests; the payment comes after the owner confirms.
5
+ # outstanding is already net of PPh 23, so a customer who withheld tax still matches.
6
+ name: bank_transaction_suggest
7
+ label: {id: Usulan cocok mutasi ke faktur}
8
+ on: bank_transaction.created
9
+ if: event.amount > 0 && event.status == 'unmatched'
10
+ steps:
11
+ - {find_all: sales_invoice, where: "docstatus == 1 && outstanding > 0 && event.description.contains(name)", as: by_number}
12
+ - {find_all: sales_invoice, where: "docstatus == 1 && outstanding == event.amount", as: by_amount}
13
+ - {find: bank_transaction, where: name == event.name, as: line}
14
+ - if: size(by_number) == 1
15
+ then:
16
+ - update: line
17
+ set: {suggested_invoice: "by_number[0].name", status: "'suggested'"}
18
+ else:
19
+ - update: line
20
+ if: size(by_amount) == 1
21
+ set: {suggested_invoice: "by_amount[0].name", status: "'suggested'"}
@@ -0,0 +1,11 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # The payment of a matched line is cancelled: the line goes back to unmatched and can be matched again (by the amend
3
+ # of that payment, which keeps bank_transaction, or by a new confirmation; only one of them can be submitted).
4
+ name: bank_transaction_unmatched
5
+ label: {id: Mutasi kembali belum cocok saat pembayaran dibatalkan}
6
+ on: payment.cancelled
7
+ steps:
8
+ - {find: bank_transaction, where: payment == event.name && status == 'matched', as: line}
9
+ - update: line
10
+ if: line != null
11
+ set: {status: "'unmatched'", payment: "''"}
@@ -0,0 +1,25 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
+ # Bank statement in a fixed layout: Tanggal (dd/mm/yyyy), Urutan, Keterangan, Masuk, Keluar, Saldo, Rekening.
3
+ # Bank exports differ by bank and channel (KlikBCA, Livin, BRImo), so each gets its own import once a real export
4
+ # is in hand; until then the owner pastes the bank's rows into this layout (template in the module docs).
5
+ # Same file twice -> duplicate (file hash). Overlapping exports -> only rows whose key is new. Urutan (the number of
6
+ # the line within its day in the bank's export: 1, 2, 3, ...) is in the key, so two equal transfers on one day
7
+ # differ whether or not the export has a running balance. Saldo is in the key too when it is filled: it tells lines
8
+ # apart even if a pasted part of a day is numbered from 1 again, so a column more in the key can only add a line
9
+ # (visible, can be ignored), never drop one. Without Saldo, Urutan must be the line's place in the whole day.
10
+ # A file without Urutan is refused (missing column), never deduplicated by content alone.
11
+ name: bank_statement_csv
12
+ label: {id: Mutasi rekening (CSV), en: Bank statement (CSV)}
13
+ model: bank_transaction
14
+ source: csv
15
+ header_row: 1
16
+ per: org
17
+ key: [Rekening, Tanggal, Urutan, Keterangan, Masuk, Keluar, Saldo]
18
+ map:
19
+ account: Rekening
20
+ date: Tanggal
21
+ seq: Urutan
22
+ description: Keterangan
23
+ credit: Masuk
24
+ debit: Keluar
25
+ balance: Saldo
@@ -0,0 +1,124 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # One line of the bank statement. Money in is positive, money out negative. Status:
3
+ # unmatched -> suggested (flow bank_transaction_suggest found exactly one invoice) -> confirmed (the owner agrees,
4
+ # flow bank_transaction_confirm drafts the payment into draft_payment) -> matched (that very draft is submitted;
5
+ # flow bank_transaction_matched sets payment). ignored = not a sale.
6
+ # payment is only ever a submitted payment and only flows write it, so "Cocok" cannot be set by hand. The payment
7
+ # names the line in payment.bank_transaction, and bank_transaction_claim allows one live payment per line, whatever
8
+ # path made it. draft_payment points at the line's open draft, which confirming again reuses; a deleted draft is
9
+ # drafted again by saving the line as "Dikonfirmasi". Cancelling the payment sends the line back to unmatched.
10
+ name: bank_transaction
11
+ label: {id: Mutasi bank, en: Bank transaction}
12
+ icon: bank
13
+ naming: MUT-{YYYY}-{#####}
14
+ title_field: description
15
+ permissions:
16
+ - {role: finance_manager, read: true, create: true, write: true, export: true, import: true}
17
+ # a line that is paid (payment set) is never deleted: its payment and claim would point at nothing
18
+ - {role: finance_manager, delete: true, if: payment == ''}
19
+ - {role: sales_manager, read: true, create: true, write: true, export: true, import: true}
20
+ - {role: head_office, read: true, create: true, write: true, export: true, import: true}
21
+ fields:
22
+ - name: account
23
+ type: data
24
+ label: {id: Rekening}
25
+ in_list: true
26
+ - name: date
27
+ type: date
28
+ label: {id: Tanggal}
29
+ required: true
30
+ in_list: true
31
+ - name: seq
32
+ type: int
33
+ label: {id: Urutan}
34
+ help: {id: 'Nomor baris transaksi di hari itu sesuai mutasi bank (1, 2, 3, ...). Membedakan dua transfer yang sama di hari yang sama.'}
35
+ required: true
36
+ - name: description
37
+ type: data
38
+ label: {id: Keterangan}
39
+ required: true
40
+ in_list: true
41
+ - name: credit
42
+ type: currency
43
+ label: {id: Masuk}
44
+ default: '0'
45
+ - name: debit
46
+ type: currency
47
+ label: {id: Keluar}
48
+ default: '0'
49
+ - name: amount
50
+ type: currency
51
+ label: {id: Jumlah}
52
+ compute: credit - debit
53
+ in_list: true
54
+ - name: balance
55
+ type: currency
56
+ label: {id: Saldo}
57
+ help: {id: 'Salin dari mutasi bank kalau ada. Kalau kosong, Urutan harus nomor baris di seluruh hari itu, bukan nomor di potongan yang ditempel.'}
58
+ - name: status
59
+ type: select
60
+ label: {id: Status cocok}
61
+ default: "'unmatched'"
62
+ required: true
63
+ chip: true
64
+ in_list: true
65
+ in_filter: true
66
+ options:
67
+ - {value: unmatched, label: {id: Belum cocok}}
68
+ - {value: suggested, label: {id: Ada usulan}}
69
+ - {value: confirmed, label: {id: Dikonfirmasi}}
70
+ - {value: matched, label: {id: Cocok, en: Matched}}
71
+ - {value: ignored, label: {id: Abaikan}}
72
+ - name: suggested_invoice
73
+ type: link
74
+ to: sales_invoice
75
+ label: {id: Faktur}
76
+ help: {id: 'Diisi otomatis kalau tepat satu faktur cocok; boleh diganti sebelum konfirmasi.'}
77
+ peek: [customer, outstanding, due_date]
78
+ in_list: true
79
+ # data, not link: the draft may be deleted (and is renamed on submit); a link to a missing record would make the
80
+ # line unsavable.
81
+ - name: draft_payment
82
+ type: data
83
+ label: {id: Draf pembayaran}
84
+ read_only: true
85
+ - name: payment
86
+ type: link
87
+ to: payment
88
+ label: {id: Pembayaran}
89
+ read_only: true
90
+ rules:
91
+ - name: one_side_only
92
+ on: save
93
+ check: credit >= 0 && debit >= 0 && (credit == 0 || debit == 0)
94
+ message: {id: 'Isi Masuk atau Keluar saja, tidak boleh negatif'}
95
+ - name: confirm_needs_invoice
96
+ on: save
97
+ check: status != 'confirmed' || suggested_invoice != ''
98
+ message: {id: Pilih faktur sebelum konfirmasi}
99
+ - name: confirm_only_money_in
100
+ on: save
101
+ check: status != 'confirmed' || amount > 0
102
+ message: {id: Hanya uang masuk yang bisa dicocokkan ke faktur penjualan}
103
+ - name: matched_needs_payment
104
+ on: save
105
+ check: (status == 'matched') == (payment != '')
106
+ message: {id: Status Cocok diisi otomatis saat pembayarannya diajukan dan hanya lepas saat pembayaran itu dibatalkan}
107
+ - name: seq_positive
108
+ on: save
109
+ check: seq > 0
110
+ message: {id: Urutan mulai dari 1}
111
+ views:
112
+ list:
113
+ columns: [date, description, amount, status, suggested_invoice, payment]
114
+ sort: -date
115
+ form:
116
+ layout:
117
+ - section: {id: Mutasi}
118
+ columns:
119
+ - [date, seq, account, description]
120
+ - [credit, debit, amount, balance]
121
+ - section: {id: Pencocokan}
122
+ columns:
123
+ - [status, suggested_invoice]
124
+ - [draft_payment, payment]
@@ -0,0 +1,49 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # The invariant of the money rail: one statement line is paid by at most one live (submitted) payment. A payment
3
+ # names its line in payment.bank_transaction (set when the line is confirmed; amend copies it). When such a payment
4
+ # is submitted, flow bank_transaction_claim creates the claim for the line in the same transaction, and the unique
5
+ # index on bank_transaction refuses the submit (422) when another live payment holds the line, whatever path made the
6
+ # payment (a new draft, an amend, an old draft left behind, two submits at once). Cancelling the payment releases the
7
+ # claim (bank_transaction emptied, the name kept in released_line). Only flows write it.
8
+ # A claim is also only valid for the line's own payment: the draft the line made (line.draft_payment) or the amend of
9
+ # a payment of that line, for the line's amount. The flows set `valid` and the rule refuses the save otherwise; the
10
+ # same rule refuses a change of payment.bank_transaction (flow bank_transaction_link_locked).
11
+ name: bank_transaction_claim
12
+ label: {id: Klaim mutasi bank, en: Bank transaction claim}
13
+ icon: bank
14
+ naming: MTC-{YYYY}-{#####}
15
+ title_field: bank_transaction
16
+ permissions:
17
+ - {role: finance_manager, read: true, create: true, write: true, export: true}
18
+ - {role: sales_manager, read: true, create: true, write: true, export: true}
19
+ - {role: head_office, read: true, create: true, write: true}
20
+ fields:
21
+ - name: bank_transaction
22
+ type: data
23
+ label: {id: Mutasi bank yang sudah dibayar}
24
+ unique: true
25
+ read_only: true
26
+ in_list: true
27
+ - name: payment
28
+ type: data
29
+ label: {id: Pembayaran}
30
+ read_only: true
31
+ in_list: true
32
+ - name: released_line
33
+ type: data
34
+ label: {id: Mutasi yang dilepas}
35
+ read_only: true
36
+ in_list: true
37
+ - name: valid
38
+ type: check
39
+ label: {id: Sah}
40
+ default: 'true'
41
+ read_only: true
42
+ rules:
43
+ - name: own_payment_only
44
+ on: save
45
+ check: valid
46
+ message: {id: 'Mutasi bank hanya bisa dibayar oleh draf dari mutasi itu (atau amend-nya) sebesar nilai mutasi, dan tidak bisa diubah'}
47
+ views:
48
+ list:
49
+ columns: [bank_transaction, payment, released_line]
@@ -0,0 +1,7 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
+ # Bank statement lines (mutasi rekening) imported from the bank's export, matched to sales invoices and turned into
3
+ # payments. A payment stays the only thing that settles an invoice: a statement line never pays one by itself.
4
+ name: bank_statement
5
+ version: 1.0.0
6
+ title: {id: Mutasi bank, en: Bank statement}
7
+ requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, invoicing: ^1.0, payments: ^1.0}