@rangka-os/create 0.5.0-alpha.7 → 0.5.0-alpha.9

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 (32) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/jasa_proyek/dashboards/jasa_overview.rk +4 -0
  3. package/template/base/apps/jasa_proyek/dashboards/project_margin.rk +28 -0
  4. package/template/base/connectors/biteship/connector.rk +241 -0
  5. package/template/base/connectors/biteship/fixtures/cancel_order.json +1 -0
  6. package/template/base/connectors/biteship/fixtures/create_order.json +8 -0
  7. package/template/base/connectors/biteship/fixtures/expect.json +9 -0
  8. package/template/base/connectors/biteship/fixtures/get_order.json +2 -0
  9. package/template/base/connectors/biteship/fixtures/get_rates.json +7 -0
  10. package/template/base/connectors/biteship/fixtures/get_tracking.json +7 -0
  11. package/template/base/connectors/biteship/fixtures/order_price.json +11 -0
  12. package/template/base/connectors/biteship/fixtures/order_status.json +15 -0
  13. package/template/base/connectors/biteship/fixtures/order_status_cancelled.json +15 -0
  14. package/template/base/connectors/biteship/fixtures/order_waybill.json +7 -0
  15. package/template/base/connectors/biteship/fixtures/search_areas.json +1 -0
  16. package/template/base/modules/bank_statement/flows/bank_transaction_suggest.rk +13 -3
  17. package/template/base/modules/invoicing/flows/payment_instruction_on_submit.rk +24 -0
  18. package/template/base/modules/invoicing/models/bank_account.rk +134 -0
  19. package/template/base/modules/invoicing/models/payment_instruction.rk +68 -0
  20. package/template/base/modules/invoicing/module.rk +1 -1
  21. package/template/base/modules/payments/flows/payment_from_xendit_invoice.rk +59 -0
  22. package/template/base/modules/payments/flows/payment_from_xendit_qr.rk +59 -0
  23. package/template/base/modules/payments/flows/payment_from_xendit_va.rk +59 -0
  24. package/template/base/modules/payments/models/payment.rk +3 -1
  25. package/template/base/modules/payments/module.rk +1 -1
  26. package/template/base/modules/projects/flows/timesheet_assignment_on_create.rk +28 -0
  27. package/template/base/modules/projects/imports/attendance_recap.rk +23 -0
  28. package/template/base/modules/projects/models/assignment.rk +16 -3
  29. package/template/base/modules/projects/models/project_ledger.rk +5 -2
  30. package/template/base/modules/projects/models/timesheet.rk +58 -14
  31. package/template/base/modules/workforce/imports/worker_list.rk +6 -1
  32. package/template/base/modules/workforce/models/worker.rk +28 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rangka-os/create",
3
- "version": "0.5.0-alpha.7",
3
+ "version": "0.5.0-alpha.9",
4
4
  "description": "Start a Rangka OS project: npm create @rangka-os@latest my-shop",
5
5
  "license": "Elastic-2.0",
6
6
  "homepage": "https://rangka-os.github.io/rangka-os/guide/quick-start",
@@ -63,6 +63,8 @@ widgets:
63
63
  filter: state == 'planned' || state == 'running'
64
64
  span: 3
65
65
  - name: active_workers
66
+ # worker carries pay: only roles that may read it (audit L1)
67
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
66
68
  type: number
67
69
  label: {id: Tenaga kerja aktif}
68
70
  model: worker
@@ -110,6 +112,8 @@ widgets:
110
112
  # Certification expiry cannot be a widget: `expired` lives on child rows (certification) and is a stored compute that goes
111
113
  # stale once expires_on passes. The closest honest view is the list of active workers; open one to see its certifications.
112
114
  - name: workers_certifications
115
+ # worker carries pay: only roles that may read it (audit L1)
116
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
113
117
  type: list
114
118
  label: {id: Tenaga kerja aktif}
115
119
  description: {id: Buka satu untuk melihat masa berlaku sertifikasinya}
@@ -3,9 +3,14 @@
3
3
  name: project_margin
4
4
  label: {id: Untung per proyek, en: Project margin}
5
5
  default_period: 365
6
+ # Margin is cost: owner, finance and the project admin only. Sales and purchasing read only their own rows of the
7
+ # ledger, so a sum would show them revenue as "untung". The kernel enforces `roles` from alpha.9 (contract 0027); every
8
+ # widget on the ledger, timesheets or workers also keeps the same `if` for older kernels.
9
+ roles: [finance_manager, project_admin]
6
10
  cache: 5m
7
11
  widgets:
8
12
  - name: margin_total
13
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
9
14
  type: number
10
15
  label: {id: Untung proyek}
11
16
  description: {id: 'Pendapatan dikurangi biaya tenaga kerja, proyek dan pemasok (DPP), dari dokumen yang diajukan sejak buku ini aktif'}
@@ -16,6 +21,7 @@ widgets:
16
21
  compact: true
17
22
  span: 4
18
23
  - name: revenue_total
24
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
19
25
  type: number
20
26
  label: {id: Pendapatan proyek}
21
27
  model: project_ledger
@@ -35,7 +41,27 @@ widgets:
35
41
  filter: state == 'planned' || state == 'running'
36
42
  compact: true
37
43
  span: 4
44
+ # A margin is only as good as its labour cost: absensi without pay add no cost, so they are counted here (G5).
45
+ - name: timesheets_without_pay
46
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
47
+ type: number
48
+ label: {id: Absensi tanpa upah}
49
+ description: {id: 'Absensi diajukan yang upahnya belum diisi: untung proyek di atas belum termasuk biaya tenaga ini'}
50
+ model: timesheet
51
+ filter: docstatus == 1 && cost_missing
52
+ good_when: down
53
+ span: 6
54
+ - name: workers_without_pay
55
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
56
+ type: number
57
+ label: {id: Tenaga tanpa upah}
58
+ description: {id: 'Tenaga aktif yang upah per hari dan per jamnya belum diisi'}
59
+ model: worker
60
+ filter: active && cost_day_rate == 0 && cost_hour_rate == 0
61
+ good_when: down
62
+ span: 6
38
63
  - name: margin_by_project
64
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
39
65
  type: chart
40
66
  chart: bar
41
67
  label: {id: Untung per proyek}
@@ -47,6 +73,7 @@ widgets:
47
73
  sort: -value
48
74
  span: 6
49
75
  - name: result_by_kind
76
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
50
77
  type: chart
51
78
  chart: bar
52
79
  label: {id: Pendapatan dan biaya}
@@ -57,6 +84,7 @@ widgets:
57
84
  period: posting_date
58
85
  span: 6
59
86
  - name: latest_rows
87
+ if: "'owner' in user.roles || 'finance_manager' in user.roles || 'project_admin' in user.roles"
60
88
  type: list
61
89
  label: {id: Catatan terakhir}
62
90
  model: project_ledger
@@ -0,0 +1,241 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/connector.json
2
+ # Biteship (Indonesia): one shipping aggregator for many couriers (JNE, J&T, SiCepat, AnterAja, GoSend, Grab Express,
3
+ # Paxel and more): area search, courier rates, shipping orders (pickup or drop off, COD, insurance), tracking and
4
+ # status webhooks. Every request sends the API key in the Authorization header (as is or as Bearer; both accepted).
5
+ # Test mode: a key starting with biteship_test. talks to the same URLs; test orders are simulated from the dashboard
6
+ # (to delivered or cancelled) and send the same webhooks. Live keys start with biteship_live.
7
+ # Status: spec, no flow calls it yet. The kernel does not run connectors (contract 0002). Fields follow Biteship's public
8
+ # API reference (biteship.com/docs/api: rates/retrieve, orders/create, orders/delete, trackings/retrieve,
9
+ # webhook/overview) and have not been checked against a live account; the query parameters of maps/areas are to confirm.
10
+ # Synthetic payloads of every webhook and answer are in fixtures/ (tests/check_fixtures.py checks the emits against them).
11
+ # Webhooks: the owner adds one webhook per event in the dashboard (Integrations > Webhook) with the URL of the trigger
12
+ # and a Headers Signature Key / Secret. Biteship sends that pair as an HTTP header on every request; the key must be
13
+ # x-biteship-secret (the header verify below reads; the name is ours, chosen in the dashboard, not fixed by Biteship;
14
+ # the header pairing is from help.biteship.com, to confirm on a test account), the secret is auth.webhook_secret. Deliveries can repeat: a flow
15
+ # keys its work on shipment_ref + status (order.status), shipment_ref + price (order.price) or shipment_ref + waybill.
16
+ name: biteship
17
+ label: {id: Biteship}
18
+ version: 0.1.0
19
+ vendor: Biteship
20
+ docs: https://biteship.com/docs/api
21
+ auth:
22
+ type: token
23
+ fields:
24
+ - name: api_key
25
+ label: {id: API key}
26
+ secret: true
27
+ help: {id: 'Dashboard Biteship > Integrasi > API Key. Kunci biteship_test. untuk mode test.'}
28
+ - name: webhook_secret
29
+ label: {id: Headers signature secret}
30
+ secret: true
31
+ generate: true
32
+ help: {id: 'Isi di Dashboard Biteship > Integrasi > Webhook: Headers Signature Key x-biteship-secret, Secret nilai ini'}
33
+ settings:
34
+ - name: couriers
35
+ label: {id: Kurir yang ditawarkan}
36
+ default: "'jne,jnt,sicepat,anteraja,gojek,grab'"
37
+ help: {id: 'Kode kurir Biteship, dipisah koma'}
38
+ - name: origin_area_id
39
+ label: {id: Area asal (gudang)}
40
+ help: {id: 'ID area Biteship gudang pengirim, dari aksi Cari area'}
41
+ triggers:
42
+ # order.status: every change of a shipment's status, with the courier and (instant couriers) the driver
43
+ - name: order_status
44
+ label: {id: Status pengiriman berubah}
45
+ via: webhook
46
+ verify:
47
+ header: x-biteship-secret
48
+ equals: auth.webhook_secret
49
+ emit:
50
+ event: event
51
+ shipment_ref: order_id
52
+ tracking_id: courier_tracking_id
53
+ waybill: courier_waybill_id
54
+ courier: courier_company
55
+ service: courier_type
56
+ status: status
57
+ price: order_price
58
+ driver_name: courier_driver_name
59
+ driver_phone: courier_driver_phone
60
+ driver_plate: courier_driver_plate_number
61
+ link: courier_link
62
+ # what a flow acts on without knowing Biteship's status list (help.biteship.com shipping statuses, not in the API
63
+ # reference; to confirm on a test account: confirmed, scheduled, allocated,
64
+ # picking_up, picked, dropping_off, delivered, on_hold, courier_not_found, cancelled, return_in_transit, returned)
65
+ delivered: status == 'delivered'
66
+ failed: status == 'cancelled' || status == 'courier_not_found' || status == 'return_in_transit' || status == 'returned'
67
+ on_the_way: status == 'picked' || status == 'dropping_off'
68
+ # order.price: the courier re-weighed the parcel; the shipping cost the business pays changed
69
+ - name: order_price
70
+ label: {id: Ongkir berubah}
71
+ via: webhook
72
+ verify:
73
+ header: x-biteship-secret
74
+ equals: auth.webhook_secret
75
+ emit:
76
+ event: event
77
+ shipment_ref: order_id
78
+ tracking_id: courier_tracking_id
79
+ waybill: courier_waybill_id
80
+ status: status
81
+ price: price
82
+ shipping_fee: shippment_fee # sic: Biteship's field name
83
+ cod_fee: cash_on_delivery_fee
84
+ pod_fee: proof_of_delivery_fee
85
+ # order.waybill_id: the courier issued or changed the airway bill (resi), usually after pickup
86
+ - name: order_waybill
87
+ label: {id: Nomor resi terbit}
88
+ via: webhook
89
+ verify:
90
+ header: x-biteship-secret
91
+ equals: auth.webhook_secret
92
+ emit:
93
+ event: event
94
+ shipment_ref: order_id
95
+ tracking_id: courier_tracking_id
96
+ waybill: courier_waybill_id
97
+ status: status
98
+ actions:
99
+ - name: search_areas
100
+ label: {id: Cari area}
101
+ request:
102
+ method: GET
103
+ url: https://api.biteship.com/v1/maps/areas
104
+ headers: {Authorization: '{auth.api_key}'}
105
+ query: {countries: ID, input: '{input.query}', type: single}
106
+ input:
107
+ - {name: query, type: data, required: true, help: {id: 'Nama kecamatan, kota atau kode pos'}}
108
+ output: {areas: areas}
109
+ retry: {max: 3, backoff: exponential, on: [429, 500, 502, 503]}
110
+ - name: get_rates
111
+ label: {id: Cek ongkir}
112
+ request:
113
+ method: POST
114
+ url: https://api.biteship.com/v1/rates/couriers
115
+ headers: {Authorization: '{auth.api_key}'}
116
+ body:
117
+ origin_area_id: '{input.origin_area_id}'
118
+ destination_area_id: '{input.destination_area_id}'
119
+ destination_postal_code: '{input.destination_postal_code}'
120
+ couriers: '{input.couriers}'
121
+ destination_cash_on_delivery: '{input.cod_amount}'
122
+ destination_cash_on_delivery_type: '{input.cod_type}'
123
+ courier_insurance: '{input.insured_value}'
124
+ items: '{input.items}'
125
+ input:
126
+ - {name: origin_area_id, type: data, default: settings.origin_area_id}
127
+ - {name: destination_area_id, type: data}
128
+ - {name: destination_postal_code, type: int, help: {id: 'Dipakai kalau area tujuan kosong'}}
129
+ - {name: couriers, type: data, default: settings.couriers}
130
+ - {name: cod_amount, type: currency, help: {id: 'Nilai COD, maksimal Rp 15.000.000'}}
131
+ - {name: cod_type, type: data, help: {id: '3_days, 5_days atau 7_days; wajib kalau ada COD'}}
132
+ - {name: insured_value, type: currency}
133
+ - {name: items, type: json, required: true, help: {id: 'Daftar barang: name, value, quantity, weight (gram), length/width/height (cm)'}}
134
+ # one row per courier service: courier_code, courier_service_code, price (final, with insurance and COD fees),
135
+ # shipment_duration_range + shipment_duration_unit, available_for_cash_on_delivery
136
+ output: {pricing: pricing}
137
+ retry: {max: 3, backoff: exponential, on: [429, 500, 502, 503]}
138
+ - name: create_order
139
+ label: {id: Buat pengiriman}
140
+ request:
141
+ method: POST
142
+ url: https://api.biteship.com/v1/orders
143
+ headers: {Authorization: '{auth.api_key}'}
144
+ body:
145
+ reference_id: '{input.reference}'
146
+ shipper_contact_name: '{input.shipper_name}'
147
+ shipper_contact_phone: '{input.shipper_phone}'
148
+ shipper_organization: '{input.shipper_organization}'
149
+ origin_contact_name: '{input.origin_contact_name}'
150
+ origin_contact_phone: '{input.origin_contact_phone}'
151
+ origin_address: '{input.origin_address}'
152
+ origin_area_id: '{input.origin_area_id}'
153
+ origin_collection_method: '{input.collection_method}'
154
+ destination_contact_name: '{input.destination_contact_name}'
155
+ destination_contact_phone: '{input.destination_contact_phone}'
156
+ destination_address: '{input.destination_address}'
157
+ destination_area_id: '{input.destination_area_id}'
158
+ destination_postal_code: '{input.destination_postal_code}'
159
+ destination_note: '{input.destination_note}'
160
+ destination_cash_on_delivery: '{input.cod_amount}'
161
+ destination_cash_on_delivery_type: '{input.cod_type}'
162
+ courier_company: '{input.courier_company}'
163
+ courier_type: '{input.courier_type}'
164
+ courier_insurance: '{input.insured_value}'
165
+ delivery_type: '{input.delivery_type}'
166
+ order_note: '{input.note}'
167
+ items: '{input.items}'
168
+ input:
169
+ - {name: reference, type: data, required: true, help: {id: 'Nomor surat jalan atau faktur; Biteship menolak reference_id yang sudah dipakai'}}
170
+ - {name: shipper_name, type: data}
171
+ - {name: shipper_phone, type: data}
172
+ - {name: shipper_organization, type: data}
173
+ - {name: origin_contact_name, type: data, required: true}
174
+ - {name: origin_contact_phone, type: data, required: true}
175
+ - {name: origin_address, type: text, required: true}
176
+ - {name: origin_area_id, type: data, default: settings.origin_area_id}
177
+ - {name: collection_method, type: data, default: "'pickup'", help: {id: 'pickup (kurir menjemput) atau drop_off'}}
178
+ - {name: destination_contact_name, type: data, required: true}
179
+ - {name: destination_contact_phone, type: data, required: true}
180
+ - {name: destination_address, type: text, required: true}
181
+ - {name: destination_area_id, type: data}
182
+ - {name: destination_postal_code, type: int}
183
+ - {name: destination_note, type: data}
184
+ - {name: cod_amount, type: currency}
185
+ - {name: cod_type, type: data}
186
+ - {name: courier_company, type: data, required: true, help: {id: 'courier_code dari Cek ongkir, misalnya jne'}}
187
+ - {name: courier_type, type: data, required: true, help: {id: 'courier_service_code dari Cek ongkir, misalnya reg'}}
188
+ - {name: insured_value, type: currency}
189
+ - {name: delivery_type, type: data, default: "'now'", help: {id: 'now atau scheduled'}}
190
+ - {name: note, type: data}
191
+ - {name: items, type: json, required: true}
192
+ output:
193
+ shipment_ref: id
194
+ tracking_id: courier.tracking_id
195
+ waybill: courier.waybill_id
196
+ courier: courier.company
197
+ service: courier.type
198
+ price: price
199
+ status: status
200
+ reference: reference_id
201
+ retry: {max: 3, backoff: exponential, on: [429, 500, 502, 503]}
202
+ # Biteship refuses a second order with the same reference_id, so a retried call cannot ship twice
203
+ idempotency: input.reference
204
+ - name: get_order
205
+ label: {id: Ambil data pengiriman}
206
+ request:
207
+ method: GET
208
+ url: https://api.biteship.com/v1/orders/{input.shipment_ref}
209
+ headers: {Authorization: '{auth.api_key}'}
210
+ input:
211
+ - {name: shipment_ref, type: data, required: true}
212
+ output: {status: status, price: price, waybill: courier.waybill_id, tracking_id: courier.tracking_id}
213
+ retry: {max: 3, backoff: exponential, on: [429, 500, 502, 503]}
214
+ - name: cancel_order
215
+ label: {id: Batalkan pengiriman}
216
+ request:
217
+ method: POST
218
+ url: https://api.biteship.com/v1/orders/{input.shipment_ref}/cancel
219
+ headers: {Authorization: '{auth.api_key}'}
220
+ body:
221
+ cancellation_reason_code: '{input.reason_code}'
222
+ cancellation_reason: '{input.reason}'
223
+ input:
224
+ - {name: shipment_ref, type: data, required: true}
225
+ - {name: reason_code, type: data, default: "'others'", help: {id: 'change_courier, pickup_delay, change_address atau others'}}
226
+ - {name: reason, type: data}
227
+ output: {status: status, reason_code: cancellation_reason_code}
228
+ retry: {max: 3, backoff: exponential, on: [429, 500, 502, 503]}
229
+ idempotency: "'cancel:' + input.shipment_ref"
230
+ - name: get_tracking
231
+ label: {id: Lacak paket}
232
+ request:
233
+ method: GET
234
+ url: https://api.biteship.com/v1/trackings/{input.tracking_id}
235
+ headers: {Authorization: '{auth.api_key}'}
236
+ input:
237
+ - {name: tracking_id, type: data, required: true}
238
+ output: {status: status, waybill: waybill_id, courier: courier.company, history: history, link: link}
239
+ retry: {max: 3, backoff: exponential, on: [429, 500, 502, 503]}
240
+ limits:
241
+ note: {id: 'Order test (kunci biteship_test.) tidak dikirim kurir dan tidak ditagih; statusnya disimulasikan dari dashboard'}
@@ -0,0 +1 @@
1
+ {"success": true, "message": "Order successfully deleted", "object": "order", "id": "ord-contoh-0002", "status": "cancelled", "cancellation_reason_code": "others", "cancellation_reason": "Salah alamat"}
@@ -0,0 +1,8 @@
1
+ {"success": true, "message": "Order successfully created", "object": "order", "id": "ord-contoh-0001", "draft_order_id": null,
2
+ "shipper": {"name": "Toko Contoh", "phone": "081100000000", "organization": "Toko Contoh"},
3
+ "origin": {"contact_name": "Gudang Contoh", "contact_phone": "081100000000", "address": "Jl. Contoh No. 1, Bandung", "area_id": "IDNP9IDNC23IDND0001", "postal_code": 40132},
4
+ "destination": {"contact_name": "Pelanggan Contoh", "contact_phone": "081300000000", "address": "Jl. Tujuan No. 2, Bandung", "area_id": "IDNP9IDNC23IDND0002", "postal_code": 40617},
5
+ "courier": {"tracking_id": "trk-contoh-0001", "waybill_id": "WYB-CONTOH-0001", "company": "jne", "type": "reg", "insurance": {"amount": 0, "fee": 0}, "routing_code": null},
6
+ "delivery": {"datetime": "2026-11-07T10:00+07:00", "type": "now"},
7
+ "reference_id": "SJ-2026-00001", "items": [{"name": "Mi goreng (dus)", "value": 110000, "quantity": 2, "weight": 4000}],
8
+ "currency": "IDR", "tax_lines": [], "price": 18000, "metadata": {}, "note": "", "status": "confirmed"}
@@ -0,0 +1,9 @@
1
+ {
2
+ "order_status.json": {"shipment_ref": "ord-contoh-0001", "waybill": "WYB-CONTOH-0001", "status": "delivered", "price": 18000, "delivered": true, "failed": false, "on_the_way": false},
3
+ "order_status_cancelled.json": {"shipment_ref": "ord-contoh-0002", "waybill": null, "delivered": false, "failed": true},
4
+ "order_price.json": {"price": 27000, "shipping_fee": 27000, "status": "picked"},
5
+ "order_waybill.json": {"waybill": "WYB-CONTOH-0001", "tracking_id": "trk-contoh-0001"},
6
+ "create_order.json": {"shipment_ref": "ord-contoh-0001", "tracking_id": "trk-contoh-0001", "waybill": "WYB-CONTOH-0001", "price": 18000, "status": "confirmed", "reference": "SJ-2026-00001"},
7
+ "cancel_order.json": {"status": "cancelled"},
8
+ "get_tracking.json": {"status": "delivered", "courier": "jne"}
9
+ }
@@ -0,0 +1,2 @@
1
+ {"success": true, "object": "order", "id": "ord-contoh-0001", "status": "dropping_off", "price": 18000, "reference_id": "SJ-2026-00001",
2
+ "courier": {"tracking_id": "trk-contoh-0001", "waybill_id": "WYB-CONTOH-0001", "company": "jne", "type": "reg"}}
@@ -0,0 +1,7 @@
1
+ {"success": true, "object": "courier_pricing", "message": "Success to retrieve courier pricing", "code": 20001003,
2
+ "origin": {"area_id": "IDNP9IDNC23IDND0001", "postal_code": 40132},
3
+ "destination": {"area_id": "IDNP9IDNC23IDND0002", "postal_code": 40617},
4
+ "pricing": [
5
+ {"company": "jne", "courier_name": "JNE", "courier_code": "jne", "courier_service_name": "Reguler", "courier_service_code": "reg", "type": "reg", "service_type": "standard", "shipping_type": "parcel", "description": "Layanan reguler", "duration": "1 - 2 days", "shipment_duration_range": "1 - 2", "shipment_duration_unit": "days", "available_for_cash_on_delivery": true, "available_for_proof_of_delivery": false, "available_for_instant_waybill_id": true, "available_for_insurance": true, "available_collection_method": ["pickup", "drop_off"], "currency": "IDR", "shipping_fee": 18000, "insurance_fee": 0, "cash_on_delivery_fee": 0, "price": 18000, "tax_lines": []},
6
+ {"company": "sicepat", "courier_name": "SiCepat", "courier_code": "sicepat", "courier_service_name": "Reguler", "courier_service_code": "reg", "type": "reg", "service_type": "standard", "shipping_type": "parcel", "description": "Layanan reguler", "duration": "1 - 2 days", "shipment_duration_range": "1 - 2", "shipment_duration_unit": "days", "available_for_cash_on_delivery": true, "available_for_proof_of_delivery": false, "available_for_instant_waybill_id": true, "available_for_insurance": true, "available_collection_method": ["pickup"], "currency": "IDR", "shipping_fee": 15000, "insurance_fee": 0, "cash_on_delivery_fee": 0, "price": 15000, "tax_lines": []}
7
+ ]}
@@ -0,0 +1,7 @@
1
+ {"success": true, "message": "Successfully get tracking info", "object": "tracking", "id": "trk-contoh-0001", "waybill_id": "WYB-CONTOH-0001",
2
+ "courier": {"company": "jne", "driver_name": null, "driver_phone": null, "driver_photo_url": null, "driver_plate_number": null},
3
+ "origin": {"contact_name": "Gudang Contoh", "address": "Jl. Contoh No. 1, Bandung"},
4
+ "destination": {"contact_name": "Pelanggan Contoh", "address": "Jl. Tujuan No. 2, Bandung"},
5
+ "history": [{"note": "Paket dijemput kurir", "status": "picked", "updated_at": "2026-11-07T11:00:00+07:00", "service_type": "reg"},
6
+ {"note": "Paket diterima", "status": "delivered", "updated_at": "2026-11-08T14:00:00+07:00", "service_type": "reg"}],
7
+ "link": "https://track.example.test/WYB-CONTOH-0001", "order_id": "ord-contoh-0001", "status": "delivered"}
@@ -0,0 +1,11 @@
1
+ {
2
+ "event": "order.price",
3
+ "order_id": "ord-contoh-0001",
4
+ "courier_tracking_id": "trk-contoh-0001",
5
+ "courier_waybill_id": "WYB-CONTOH-0001",
6
+ "status": "picked",
7
+ "price": 27000,
8
+ "shippment_fee": 27000,
9
+ "cash_on_delivery_fee": 0,
10
+ "proof_of_delivery_fee": 0
11
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "event": "order.status",
3
+ "courier_tracking_id": "trk-contoh-0001",
4
+ "courier_waybill_id": "WYB-CONTOH-0001",
5
+ "courier_company": "jne",
6
+ "courier_type": "reg",
7
+ "courier_driver_name": "Kurir Contoh",
8
+ "courier_driver_phone": "081200000000",
9
+ "courier_driver_photo_url": "",
10
+ "courier_driver_plate_number": "D 0000 XX",
11
+ "courier_link": "https://track.example.test/WYB-CONTOH-0001",
12
+ "order_id": "ord-contoh-0001",
13
+ "order_price": 18000,
14
+ "status": "delivered"
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "event": "order.status",
3
+ "courier_tracking_id": "trk-contoh-0002",
4
+ "courier_waybill_id": null,
5
+ "courier_company": "sicepat",
6
+ "courier_type": "reg",
7
+ "courier_driver_name": null,
8
+ "courier_driver_phone": null,
9
+ "courier_driver_photo_url": null,
10
+ "courier_driver_plate_number": null,
11
+ "courier_link": null,
12
+ "order_id": "ord-contoh-0002",
13
+ "order_price": 15000,
14
+ "status": "courier_not_found"
15
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "event": "order.waybill_id",
3
+ "order_id": "ord-contoh-0001",
4
+ "courier_tracking_id": "trk-contoh-0001",
5
+ "courier_waybill_id": "WYB-CONTOH-0001",
6
+ "status": "picked"
7
+ }
@@ -0,0 +1 @@
1
+ {"success": true, "areas": [{"id": "IDNP9IDNC23IDND0001", "name": "Coblong, Bandung, Jawa Barat. 40132", "country_name": "Indonesia", "country_code": "ID", "administrative_division_level_1_name": "Jawa Barat", "administrative_division_level_2_name": "Bandung", "administrative_division_level_3_name": "Coblong", "postal_code": 40132}]}
@@ -1,14 +1,24 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
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.
3
+ # the transfer note (written loosely, see below). Otherwise: exactly one open invoice whose remaining amount equals
4
+ # the line. Two candidates of the same amount -> no suggestion (the owner picks). It only suggests; the payment comes after the owner confirms.
5
5
  # outstanding is already net of PPh 23, so a customer who withheld tax still matches.
6
6
  name: bank_transaction_suggest
7
7
  label: {id: Usulan cocok mutasi ke faktur}
8
8
  on: bank_transaction.created
9
9
  if: event.amount > 0 && event.status == 'unmatched'
10
10
  steps:
11
- - {find_all: sales_invoice, where: "docstatus == 1 && outstanding > 0 && event.description.contains(name)", as: by_number}
11
+ # The invoice number is the payment reference (payment_instruction.reference). Customers type it as they like:
12
+ # "INV-2026-00012", "inv 2026 00012", "INV202600012", "INV/2026/00012" all match, compared without case, spaces,
13
+ # dashes, slashes and dots on both sides. The number decides only when the line fits what the invoice still owes
14
+ # (a part payment fits, an overpayment does not): "0004 2" typed for invoice 00042 must not pull a larger line
15
+ # to invoice 0004; such a line falls back to the amount match.
16
+ - find_all: sales_invoice
17
+ where: >-
18
+ docstatus == 1 && outstanding >= event.amount && (event.description.contains(name) ||
19
+ event.description.upperAscii().replace(' ', '').replace('-', '').replace('/', '').replace('.', '')
20
+ .contains(name.upperAscii().replace(' ', '').replace('-', '').replace('/', '').replace('.', '')))
21
+ as: by_number
12
22
  - {find_all: sales_invoice, where: "docstatus == 1 && outstanding == event.amount", as: by_amount}
13
23
  - {find: bank_transaction, where: name == event.name, as: line}
14
24
  - if: size(by_number) == 1
@@ -0,0 +1,24 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # An invoice is submitted: copy the org's default bank account (rekening, QRIS, instruction) into its
3
+ # payment_instruction, with the invoice number as payment reference. The copy is what the print and the WhatsApp
4
+ # bill show, so an invoice keeps the account it was billed with. No default account: nothing is copied (the print
5
+ # falls back to the letterhead). Runs in the submit's transaction as the submitter: if the copy fails, the submit does.
6
+ name: payment_instruction_on_submit
7
+ label: {id: Salin cara bayar saat faktur diajukan}
8
+ on: sales_invoice.submitted
9
+ steps:
10
+ - {find: bank_account, where: "default_claim == 'default'", as: acct}
11
+ - create: payment_instruction
12
+ if: acct != null
13
+ set:
14
+ sales_invoice: event.name
15
+ bank_account: acct.name
16
+ reference: event.name
17
+ amount: event.amount_due
18
+ bank: acct.bank
19
+ account_no: acct.account_no
20
+ holder: acct.holder
21
+ instructions: acct.instructions
22
+ qris_payload: acct.qris_payload
23
+ qris_nmid: acct.qris_nmid
24
+ qris_merchant_name: acct.qris_merchant_name
@@ -0,0 +1,134 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # Where customers pay: the business's own bank account and its static QRIS (from the bank or QRIS provider; no
3
+ # gateway). One active account per org is the default: invoices take their "cara bayar" from it when they are
4
+ # submitted (payment_instruction keeps that copy, so changing the account later never changes an old invoice).
5
+ # The QRIS text is optional (the text inside the QR, from scanning the sticker); when given it must be a static QRIS
6
+ # (EMVCo frame and CRC, point of initiation 11, rupiah, no fixed amount), and NMID and merchant name are read from it.
7
+ # The invoice print draws the QR from this text (a print page shows only data: images), so there is no image field:
8
+ # a photo of the sticker, if wanted, goes in the record's attachments.
9
+ name: bank_account
10
+ label: {id: Rekening & QRIS, en: Bank account & QRIS}
11
+ icon: bank
12
+ naming: REK-{####}
13
+ title_field: title
14
+ permissions:
15
+ # Changing where customers pay is a money control: only finance (and the owner's head office) write it.
16
+ - {role: finance_manager, read: true, create: true, write: true, delete: true, export: true}
17
+ # head office does not delete: removing the default account leaves the next invoices without "cara bayar" and the
18
+ # owner would not see it (card t_5b705279); finance and the owner delete
19
+ - {role: head_office, read: true, create: true, write: true, export: true}
20
+ # whoever submits an invoice reads the default account: the flow payment_instruction_on_submit runs as them
21
+ - {role: sales_manager, read: true}
22
+ - {role: sales_rep, read: true}
23
+ - {role: field_sales, read: true}
24
+ - {role: project_admin, read: true}
25
+ fields:
26
+ - name: bank
27
+ type: data
28
+ label: {id: Bank}
29
+ required: true
30
+ in_list: true
31
+ - name: account_no
32
+ type: data
33
+ label: {id: Nomor rekening}
34
+ help: {id: 'Angka saja, tanpa spasi, titik atau strip.'}
35
+ required: true
36
+ in_list: true
37
+ - name: holder
38
+ type: data
39
+ label: {id: Atas nama}
40
+ required: true
41
+ in_list: true
42
+ - name: title
43
+ type: data
44
+ label: {id: Rekening}
45
+ hidden: true
46
+ compute: "bank + ' ' + account_no + ' a.n. ' + holder"
47
+ - name: is_default
48
+ type: check
49
+ label: {id: Rekening utama di faktur}
50
+ default: 'false'
51
+ in_list: true
52
+ - name: active
53
+ type: check
54
+ label: {id: Aktif}
55
+ default: 'true'
56
+ # unique per org (the kernel's unique index is per org and skips ''): at most one active default account
57
+ - name: default_claim
58
+ type: data
59
+ label: {id: Rekening utama}
60
+ hidden: true
61
+ unique: true
62
+ compute: "is_default && active ? 'default' : ''"
63
+ - name: instructions
64
+ type: text
65
+ label: {id: Instruksi bayar}
66
+ help: {id: 'Satu dua kalimat untuk pelanggan, misalnya jam konfirmasi atau kirim bukti ke WhatsApp. Maksimal 280 huruf.'}
67
+ - name: qris_payload
68
+ type: text
69
+ label: {id: Isi QRIS (teks)}
70
+ help: {id: 'Opsional: teks hasil pindai QRIS statis, diawali 000201. Dicek formatnya; NMID dan nama merchant dibaca dari sini.'}
71
+ - name: qris_nmid
72
+ type: data
73
+ label: {id: NMID}
74
+ compute: "qris_payload == '' ? '' : qris_payload.emvcoTag('51').emvcoTag('02')"
75
+ - name: qris_merchant_name
76
+ type: data
77
+ label: {id: Nama merchant QRIS}
78
+ compute: "qris_payload == '' ? '' : qris_payload.emvcoTag('59')"
79
+ rules:
80
+ - name: account_digits
81
+ on: save
82
+ check: "account_no.matches('^[0-9]{5,20}$')"
83
+ message: {id: 'Nomor rekening hanya angka (5 sampai 20 digit), tanpa spasi, titik atau strip'}
84
+ - name: holder_not_blank
85
+ on: save
86
+ check: "holder.trim() != '' && bank.trim() != ''"
87
+ message: {id: Isi nama bank dan nama pemilik rekening}
88
+ - name: default_is_active
89
+ on: save
90
+ check: "!is_default || active"
91
+ message: {id: Rekening utama harus aktif}
92
+ - name: instructions_short
93
+ on: save
94
+ check: "size(instructions) <= 280"
95
+ message: {id: 'Instruksi bayar maksimal 280 huruf'}
96
+ - name: qris_format
97
+ on: save
98
+ check: "qris_payload == '' || qris_payload.emvcoValid()"
99
+ message: {id: 'Isi QRIS tidak valid (format atau kode CRC salah). Pindai ulang stiker QRIS dan tempel teksnya tanpa spasi'}
100
+ - name: qris_static
101
+ on: save
102
+ check: "qris_payload == '' || qris_payload.emvcoTag('01') == '11'"
103
+ message: {id: 'Ini QRIS dinamis (sekali pakai). Faktur butuh QRIS statis dari stiker toko'}
104
+ - name: qris_rupiah
105
+ on: save
106
+ check: "qris_payload == '' || qris_payload.emvcoTag('53') == '360'"
107
+ message: {id: QRIS harus dalam rupiah}
108
+ - name: qris_no_fixed_amount
109
+ on: save
110
+ check: "qris_payload == '' || qris_payload.emvcoTag('54') == ''"
111
+ message: {id: 'QRIS ini memuat nominal tetap; pakai QRIS statis tanpa nominal supaya pelanggan mengisi jumlah tagihan'}
112
+ # 55 = tip or convenience indicator: 02 a fixed fee (amount in 56), 03 a percentage (in 57). Either makes the
113
+ # customer pay more than the invoice, so the transfer never matches it. 01 (the customer may add a tip) is allowed.
114
+ - name: qris_no_fee
115
+ on: save
116
+ check: "qris_payload == '' || (qris_payload.emvcoTag('55') != '02' && qris_payload.emvcoTag('55') != '03' && qris_payload.emvcoTag('56') == '' && qris_payload.emvcoTag('57') == '')"
117
+ message: {id: 'QRIS ini menambah biaya layanan ke pelanggan; pakai QRIS statis tanpa biaya supaya nominal transfer sama dengan tagihan'}
118
+ - name: qris_has_merchant
119
+ on: save
120
+ check: "qris_payload == '' || (qris_payload.emvcoTag('59').trim() != '' && qris_payload.emvcoTag('51').emvcoTag('02').trim() != '')"
121
+ message: {id: 'QRIS tanpa nama merchant atau NMID; pakai QRIS dari bank atau penyedia QRIS resmi'}
122
+ views:
123
+ list:
124
+ columns: [name, bank, account_no, holder, is_default, active, qris_nmid]
125
+ form:
126
+ layout:
127
+ - section: {id: Rekening}
128
+ columns:
129
+ - [bank, account_no, holder]
130
+ - [is_default, active, instructions]
131
+ - section: {id: QRIS statis}
132
+ columns:
133
+ - [qris_payload]
134
+ - [qris_nmid, qris_merchant_name]