@rangka-os/create 0.5.0-alpha.33 → 0.5.0-alpha.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/base/apps/faktur_piutang/app.rk +4 -0
- package/template/base/apps/faktur_piutang/skills/rangka-app-faktur-piutang/SKILL.md +35 -0
- package/template/base/apps/fnb_cabang/app.rk +7 -0
- package/template/base/apps/fnb_cabang/skills/rangka-app-fnb-cabang/SKILL.md +43 -0
- package/template/base/apps/jasa_proyek/app.rk +11 -1
- package/template/base/apps/jasa_proyek/skills/rangka-app-jasa-proyek/SKILL.md +51 -0
- package/template/base/apps/karyawan_gaji/app.rk +2 -0
- package/template/base/apps/kasir/app.rk +2 -0
- package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +1 -1
- package/template/base/apps/pembelian_pemasok/app.rk +8 -0
- package/template/base/apps/pembelian_pemasok/skills/rangka-app-pembelian-pemasok/SKILL.md +43 -0
- package/template/base/apps/pesanan_whatsapp/app.rk +28 -0
- package/template/base/apps/ritel_cabang/app.rk +7 -0
- package/template/base/apps/ritel_cabang/dashboards/ritel_overview.rk +16 -0
- package/template/base/apps/ritel_cabang/dashboards/ritel_stock.rk +13 -0
- package/template/base/apps/ritel_cabang/skills/rangka-app-ritel-cabang/SKILL.md +43 -0
- package/template/base/apps/sewa_alat/skills/rangka-app-sewa-alat/SKILL.md +3 -3
- package/template/base/connectors/rangka_whatsapp/README.md +3 -2
- package/template/base/connectors/rangka_whatsapp/connector.rk +12 -4
- package/template/base/connectors/rangka_whatsapp/fixtures/expect.json +3 -2
- package/template/base/connectors/rangka_whatsapp/fixtures/message_received.json +1 -1
- package/template/base/connectors/rangka_whatsapp/fixtures/message_received_order.json +1 -0
- package/template/base/connectors/rangka_whatsapp/mock/rangka_whatsapp_mock.py +9 -4
- package/template/base/modules/accounting/flows/financial_report_compute.rk +1 -1
- package/template/base/modules/accounting/flows/financial_report_recompute.rk +1 -1
- package/template/base/modules/accounting/flows/gl_pos_sale_post.rk +38 -2
- package/template/base/modules/accounting/models/gl_entry.rk +3 -0
- package/template/base/modules/attendance/module.rk +4 -4
- package/template/base/modules/attendance/screens/absen_outlet.rk +3 -0
- package/template/base/modules/catalogue/defaults/uom.rk +19 -0
- package/template/base/modules/catalogue/models/item.rk +12 -0
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_draft.rk +44 -0
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_sale.rk +6 -5
- package/template/base/modules/loyalty/flows/loyalty_on_sale.rk +6 -5
- package/template/base/modules/loyalty/flows/loyalty_on_sale_cancel.rk +2 -2
- package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +1 -0
- package/template/base/modules/outlets/models/outlet.rk +48 -0
- package/template/base/modules/outlets/module.rk +1 -1
- package/template/base/modules/payroll/flows/pph21_annual_on_slip_cancel.rk +28 -0
- package/template/base/modules/payroll/flows/pph21_annual_on_slip_submit.rk +84 -0
- package/template/base/modules/payroll/models/payslip.rk +4 -0
- package/template/base/modules/payroll/models/pph21_annual.rk +84 -0
- package/template/base/modules/payroll/models/pph21_period.rk +77 -0
- package/template/base/modules/payroll/module.rk +3 -2
- package/template/base/modules/payroll/print/bukti_potong_a1.html +53 -0
- package/template/base/modules/payroll/print/bukti_potong_a1.rk +9 -0
- package/template/base/modules/payroll/print/coretax_bp21.rk +44 -0
- package/template/base/modules/payroll/print/coretax_bp21.xml +36 -0
- package/template/base/modules/payroll/print/coretax_bpa1.rk +21 -0
- package/template/base/modules/payroll/print/coretax_bpa1.xml +46 -0
- package/template/base/modules/payroll/print/coretax_bpmp.rk +23 -0
- package/template/base/modules/payroll/print/coretax_bpmp.xml +31 -0
- package/template/base/modules/pos/flows/pos_sale_merge.rk +34 -0
- package/template/base/modules/pos/flows/pos_sale_on_cancel.rk +3 -0
- package/template/base/modules/pos/flows/pos_sale_on_submit.rk +28 -1
- package/template/base/modules/pos/flows/pos_sale_split.rk +37 -0
- package/template/base/modules/pos/flows/pos_shift_on_create.rk +9 -1
- package/template/base/modules/pos/flows/pos_table_guard_on_create.rk +24 -0
- package/template/base/modules/pos/flows/pos_table_guard_on_update.rk +23 -0
- package/template/base/modules/pos/models/dining_area.rk +23 -0
- package/template/base/modules/pos/models/dining_table.rk +38 -0
- package/template/base/modules/pos/models/pos_guard.rk +39 -0
- package/template/base/modules/pos/models/pos_payment.rk +2 -0
- package/template/base/modules/pos/models/pos_sale.rk +153 -7
- package/template/base/modules/pos/models/pos_sale_item.rk +4 -0
- package/template/base/modules/pos/models/pos_shift.rk +11 -1
- package/template/base/modules/pos/module.rk +9 -4
- package/template/base/modules/pos/print/pos_receipt.html +5 -2
- package/template/base/modules/pos/print/pos_receipt_part.html +30 -0
- package/template/base/modules/pos/print/pos_receipt_part.rk +8 -0
- package/template/base/modules/pos/screens/kasir.rk +6 -3
- package/template/base/modules/pos/screens/kasir_meja.rk +62 -0
- package/template/base/modules/reimbursement/models/expense_claim.rk +1 -1
- package/template/base/modules/shifts/module.rk +1 -1
- package/template/base/modules/stock/flows/stock_balance_variant_group.rk +26 -0
- package/template/base/modules/stock/models/stock_balance.rk +1 -0
- package/template/base/modules/stock/models/stock_move.rk +1 -0
- package/template/base/modules/users/flows/summary_daily.rk +3 -1
- package/template/base/modules/users/flows/summary_monthly.rk +3 -1
- package/template/base/modules/users/flows/summary_weekly.rk +3 -1
- package/template/base/modules/whatsapp/models/whatsapp_message.rk +2 -0
- package/template/base/modules/whatsapp/module.rk +2 -2
- package/template/base/modules/whatsapp_order/README.md +44 -0
- package/template/base/modules/whatsapp_order/flows/whatsapp_order_intake.rk +118 -0
- package/template/base/modules/whatsapp_order/flows/whatsapp_order_locked.rk +12 -0
- package/template/base/modules/whatsapp_order/flows/whatsapp_order_on_update.rk +124 -0
- package/template/base/modules/whatsapp_order/models/whatsapp_inbound.rk +62 -0
- package/template/base/modules/whatsapp_order/models/whatsapp_order.rk +164 -0
- package/template/base/modules/whatsapp_order/models/whatsapp_order_guard.rk +46 -0
- package/template/base/modules/whatsapp_order/models/whatsapp_order_line.rk +45 -0
- package/template/base/modules/whatsapp_order/module.rk +42 -0
- package/template/base/modules/whatsapp_order/screens/pesanan_wa.rk +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rangka-os/create",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.35",
|
|
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",
|
|
@@ -29,3 +29,7 @@ onboarding:
|
|
|
29
29
|
- ask: {id: 'Apakah usaha kamu PKP (memungut PPN)?'}
|
|
30
30
|
options: ['true', 'false']
|
|
31
31
|
sets: tax.pkp
|
|
32
|
+
# Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
|
|
33
|
+
- ask: {id: 'Mau pasang Persetujuan diskon besar? Faktur dengan diskon di atas 20% menunggu persetujuan dulu.'}
|
|
34
|
+
options: ['ya', 'tidak']
|
|
35
|
+
sets: approvals.big_discount
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rangka-app-faktur-piutang
|
|
3
|
+
description: "Rangka Faktur dan Piutang (app faktur_piutang): sales invoices, payments received and reminders. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
|
|
4
|
+
metadata: {rangka: {version: 1.0.0, app: faktur_piutang, requires: [rangka-compose, rangka-changesets]}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rangka approval presets for this app
|
|
8
|
+
|
|
9
|
+
Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
|
|
10
|
+
document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
|
|
11
|
+
and the document proceeds when approved; a rejected one stays a draft.
|
|
12
|
+
|
|
13
|
+
## Rules
|
|
14
|
+
|
|
15
|
+
- **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
|
|
16
|
+
- **Roles only.** No per-person limits. The approver of the spending and big discount presets is the owner only (`approvers: [owner]`): finance can submit these documents, and an approver who submits approves their own request.
|
|
17
|
+
- **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
|
|
18
|
+
Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
|
|
19
|
+
- Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
|
|
20
|
+
|
|
21
|
+
## Presets for this app
|
|
22
|
+
|
|
23
|
+
### Persetujuan diskon besar
|
|
24
|
+
|
|
25
|
+
- What the owner gets: a sales invoice with a discount above 20% waits for finance.
|
|
26
|
+
- Say it like this: "Mau aku pasangkan Persetujuan diskon besar? Mulai dari berapa?"
|
|
27
|
+
- Files: `docs/presets/approvals/sales_invoice_discount.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
28
|
+
change set to custom/sales_invoice.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
29
|
+
- After install, tell the owner the request shows in Persetujuan and only the owner approves it.
|
|
30
|
+
|
|
31
|
+
## Checks before you propose the change set
|
|
32
|
+
|
|
33
|
+
- `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
|
|
34
|
+
- The approver role is not the role that normally submits that document: an approver who submits approves their own request.
|
|
35
|
+
- Run the site validation of the change set; do not apply it when it reports an error.
|
|
@@ -45,3 +45,10 @@ onboarding:
|
|
|
45
45
|
- ask: {id: 'Satuan stok apa yang kamu pakai untuk bahan baku? (gram dan karung diisi sebagai kemasan)'}
|
|
46
46
|
options: [kg, liter, pcs]
|
|
47
47
|
sets: item.stock_uom
|
|
48
|
+
# Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
|
|
49
|
+
- ask: {id: 'Mau pasang Persetujuan PO di atas batas? Pesanan pembelian di atas Rp 5.000.000 menunggu persetujuan dulu.'}
|
|
50
|
+
options: ['ya', 'tidak']
|
|
51
|
+
sets: approvals.po_threshold
|
|
52
|
+
- ask: {id: 'Mau pasang Persetujuan pengeluaran? Pembayaran keluar dan tagihan pemasok di atas Rp 5.000.000 menunggu persetujuan dulu.'}
|
|
53
|
+
options: ['ya', 'tidak']
|
|
54
|
+
sets: approvals.spending
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rangka-app-fnb-cabang
|
|
3
|
+
description: "Rangka F&B Cabang (app fnb_cabang): outlets, stock, recipes, purchasing and daily sales for a multi-outlet food business. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
|
|
4
|
+
metadata: {rangka: {version: 1.0.0, app: fnb_cabang, requires: [rangka-compose, rangka-changesets]}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rangka approval presets for this app
|
|
8
|
+
|
|
9
|
+
Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
|
|
10
|
+
document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
|
|
11
|
+
and the document proceeds when approved; a rejected one stays a draft.
|
|
12
|
+
|
|
13
|
+
## Rules
|
|
14
|
+
|
|
15
|
+
- **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
|
|
16
|
+
- **Roles only.** No per-person limits. The approver here is the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve).
|
|
17
|
+
- **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
|
|
18
|
+
Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
|
|
19
|
+
- Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
|
|
20
|
+
|
|
21
|
+
## Presets for this app
|
|
22
|
+
|
|
23
|
+
### Persetujuan PO di atas batas
|
|
24
|
+
|
|
25
|
+
- What the owner gets: a purchase order above Rp 5.000.000 (or in a foreign currency) waits for approval before it can be submitted; a smaller one goes straight through.
|
|
26
|
+
- Say it like this: "Mau aku pasangkan Persetujuan PO di atas batas? Mulai dari berapa?"
|
|
27
|
+
- Files: `docs/presets/approvals/purchase_order_threshold_owner_only.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
28
|
+
change set to custom/purchase_order.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
29
|
+
- After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
|
|
30
|
+
|
|
31
|
+
### Persetujuan pengeluaran
|
|
32
|
+
|
|
33
|
+
- What the owner gets: an outgoing payment above Rp 5.000.000, and a supplier bill above it that has no approved PO, wait for approval; incoming payments are not affected.
|
|
34
|
+
- Say it like this: "Mau aku pasangkan Persetujuan pengeluaran? Mulai dari berapa?"
|
|
35
|
+
- Files: `docs/presets/approvals/payment_payout.rk` and `docs/presets/approvals/vendor_bill_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
36
|
+
change set to custom/payment.rk and custom/vendor_bill.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
37
|
+
- After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
|
|
38
|
+
|
|
39
|
+
## Checks before you propose the change set
|
|
40
|
+
|
|
41
|
+
- `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
|
|
42
|
+
- The approver role is not the role that normally submits that document: an approver who submits approves their own request.
|
|
43
|
+
- Run the site validation of the change set; do not apply it when it reports an error.
|
|
@@ -45,7 +45,7 @@ menu:
|
|
|
45
45
|
- group: {id: Tenaga kerja}
|
|
46
46
|
items: [worker]
|
|
47
47
|
- group: {id: Penggajian}
|
|
48
|
-
items: [payroll_run, payslip, payroll_close, payroll_profile, cash_advance]
|
|
48
|
+
items: [payroll_run, payslip, payroll_close, payroll_profile, cash_advance, pph21_period, pph21_annual]
|
|
49
49
|
- group: {id: Keuangan}
|
|
50
50
|
items: [payment, bank_transaction, invoice_reminder, withholding, vendor_bill, bank_account]
|
|
51
51
|
- group: {id: Pembelian}
|
|
@@ -69,3 +69,13 @@ onboarding:
|
|
|
69
69
|
sets: settings.business_line
|
|
70
70
|
- ask: {id: 'Berapa PT yang kamu kelola?'}
|
|
71
71
|
sets: seed.orgs
|
|
72
|
+
# Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
|
|
73
|
+
- ask: {id: 'Mau pasang Persetujuan PO di atas batas? Pesanan pembelian di atas Rp 5.000.000 menunggu persetujuan dulu.'}
|
|
74
|
+
options: ['ya', 'tidak']
|
|
75
|
+
sets: approvals.po_threshold
|
|
76
|
+
- ask: {id: 'Mau pasang Persetujuan pengeluaran? Pembayaran keluar dan tagihan pemasok di atas Rp 5.000.000 menunggu persetujuan dulu.'}
|
|
77
|
+
options: ['ya', 'tidak']
|
|
78
|
+
sets: approvals.spending
|
|
79
|
+
- ask: {id: 'Mau pasang Persetujuan diskon besar? Faktur dan penawaran dengan diskon di atas 20% menunggu persetujuan dulu.'}
|
|
80
|
+
options: ['ya', 'tidak']
|
|
81
|
+
sets: approvals.big_discount
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rangka-app-jasa-proyek
|
|
3
|
+
description: "Rangka Jasa dan Proyek (app jasa_proyek): quotations, projects, invoices, purchasing and staff work for a service firm. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
|
|
4
|
+
metadata: {rangka: {version: 1.0.0, app: jasa_proyek, requires: [rangka-compose, rangka-changesets]}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rangka approval presets for this app
|
|
8
|
+
|
|
9
|
+
Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
|
|
10
|
+
document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
|
|
11
|
+
and the document proceeds when approved; a rejected one stays a draft.
|
|
12
|
+
|
|
13
|
+
## Rules
|
|
14
|
+
|
|
15
|
+
- **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
|
|
16
|
+
- **Roles only.** No per-person limits. The approver of the spending and big discount presets is the owner only (`approvers: [owner]`): finance can submit these documents, and an approver who submits approves their own request.
|
|
17
|
+
- **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
|
|
18
|
+
Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
|
|
19
|
+
- Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
|
|
20
|
+
|
|
21
|
+
## Presets for this app
|
|
22
|
+
|
|
23
|
+
### Persetujuan PO di atas batas
|
|
24
|
+
|
|
25
|
+
- What the owner gets: a purchase order above Rp 5.000.000 (or in a foreign currency) waits for approval before it can be submitted; a smaller one goes straight through.
|
|
26
|
+
- Say it like this: "Mau aku pasangkan Persetujuan PO di atas batas? Mulai dari berapa?"
|
|
27
|
+
- Files: `docs/presets/approvals/purchase_order_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
28
|
+
change set to custom/purchase_order.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
29
|
+
- After install, tell the owner the request shows in Persetujuan and only the owner approves it.
|
|
30
|
+
|
|
31
|
+
### Persetujuan pengeluaran
|
|
32
|
+
|
|
33
|
+
- What the owner gets: an outgoing payment above Rp 5.000.000, and a supplier bill above it that has no approved PO, wait for approval; incoming payments are not affected.
|
|
34
|
+
- Say it like this: "Mau aku pasangkan Persetujuan pengeluaran? Mulai dari berapa?"
|
|
35
|
+
- Files: `docs/presets/approvals/payment_payout.rk` and `docs/presets/approvals/vendor_bill_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
36
|
+
change set to custom/payment.rk and custom/vendor_bill.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
37
|
+
- After install, tell the owner the request shows in Persetujuan and only the owner approves it.
|
|
38
|
+
|
|
39
|
+
### Persetujuan diskon besar
|
|
40
|
+
|
|
41
|
+
- What the owner gets: a sales invoice or quotation with a discount above 20% waits for finance.
|
|
42
|
+
- Say it like this: "Mau aku pasangkan Persetujuan diskon besar? Mulai dari berapa?"
|
|
43
|
+
- Files: `docs/presets/approvals/sales_invoice_discount.rk` and `docs/presets/approvals/quotation_discount.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
44
|
+
change set to custom/sales_invoice.rk and custom/quotation.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
45
|
+
- After install, tell the owner the request shows in Persetujuan and only the owner approves it.
|
|
46
|
+
|
|
47
|
+
## Checks before you propose the change set
|
|
48
|
+
|
|
49
|
+
- `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
|
|
50
|
+
- The approver role is not the role that normally submits that document: an approver who submits approves their own request.
|
|
51
|
+
- Run the site validation of the change set; do not apply it when it reports an error.
|
|
@@ -38,6 +38,8 @@ work:
|
|
|
38
38
|
menu:
|
|
39
39
|
- group: {id: Gaji}
|
|
40
40
|
items: [payroll_run, payslip, payroll_close, cash_advance, cash_advance_balance]
|
|
41
|
+
- group: {id: Pajak PPh 21}
|
|
42
|
+
items: [pph21_period, pph21_annual]
|
|
41
43
|
- group: {id: Klaim biaya}
|
|
42
44
|
items: [expense_claim, claim_settlement, claim_payment, expense_category]
|
|
43
45
|
- group: {id: Karyawan}
|
|
@@ -33,6 +33,8 @@ home: {model: pos_sale}
|
|
|
33
33
|
work:
|
|
34
34
|
- {screen: kasir, roles: [cashier], home: true}
|
|
35
35
|
- {screen: kasir, roles: [head_office]}
|
|
36
|
+
# tables (rangka-apps#122): a cafe or restaurant opens this one instead of kasir
|
|
37
|
+
- {screen: kasir_meja, roles: [cashier, head_office]}
|
|
36
38
|
menu:
|
|
37
39
|
- group: {id: Kasir}
|
|
38
40
|
items: [pos_sale, pos_shift, pos_shift_close]
|
|
@@ -32,7 +32,7 @@ specific to the cashier.
|
|
|
32
32
|
|
|
33
33
|
## In the studio interview: when the cashier goes on the map
|
|
34
34
|
|
|
35
|
-
For
|
|
35
|
+
For Zafdoz's consultant interview (`rangka-consult`, contract 0042). The deciding fact is the tools the owner uses
|
|
36
36
|
today and whether Juragan replaces them:
|
|
37
37
|
|
|
38
38
|
- A business that serves buyers at a counter (kedai, kafe, restoran, toko) and has **no cashier app yet**, or chose
|
|
@@ -21,3 +21,11 @@ menu:
|
|
|
21
21
|
items: [purchase_request, purchase_order, goods_receipt, vendor_bill]
|
|
22
22
|
- group: {id: Pemasok}
|
|
23
23
|
items: [vendor]
|
|
24
|
+
onboarding:
|
|
25
|
+
# Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
|
|
26
|
+
- ask: {id: 'Mau pasang Persetujuan PO di atas batas? Pesanan pembelian di atas Rp 5.000.000 menunggu persetujuan dulu.'}
|
|
27
|
+
options: ['ya', 'tidak']
|
|
28
|
+
sets: approvals.po_threshold
|
|
29
|
+
- ask: {id: 'Mau pasang Persetujuan pengeluaran? Pembayaran keluar dan tagihan pemasok di atas Rp 5.000.000 menunggu persetujuan dulu.'}
|
|
30
|
+
options: ['ya', 'tidak']
|
|
31
|
+
sets: approvals.spending
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rangka-app-pembelian-pemasok
|
|
3
|
+
description: "Rangka Pembelian (app pembelian_pemasok): purchase requests and orders, goods received, supplier bills. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
|
|
4
|
+
metadata: {rangka: {version: 1.0.0, app: pembelian_pemasok, requires: [rangka-compose, rangka-changesets]}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rangka approval presets for this app
|
|
8
|
+
|
|
9
|
+
Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
|
|
10
|
+
document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
|
|
11
|
+
and the document proceeds when approved; a rejected one stays a draft.
|
|
12
|
+
|
|
13
|
+
## Rules
|
|
14
|
+
|
|
15
|
+
- **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
|
|
16
|
+
- **Roles only.** No per-person limits. The approver here is the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve).
|
|
17
|
+
- **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
|
|
18
|
+
Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
|
|
19
|
+
- Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
|
|
20
|
+
|
|
21
|
+
## Presets for this app
|
|
22
|
+
|
|
23
|
+
### Persetujuan PO di atas batas
|
|
24
|
+
|
|
25
|
+
- What the owner gets: a purchase order above Rp 5.000.000 (or in a foreign currency) waits for approval before it can be submitted; a smaller one goes straight through.
|
|
26
|
+
- Say it like this: "Mau aku pasangkan Persetujuan PO di atas batas? Mulai dari berapa?"
|
|
27
|
+
- Files: `docs/presets/approvals/purchase_order_threshold_owner_only.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
28
|
+
change set to custom/purchase_order.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
29
|
+
- After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
|
|
30
|
+
|
|
31
|
+
### Persetujuan pengeluaran
|
|
32
|
+
|
|
33
|
+
- What the owner gets: an outgoing payment above Rp 5.000.000, and a supplier bill above it that has no approved PO, wait for approval; incoming payments are not affected.
|
|
34
|
+
- Say it like this: "Mau aku pasangkan Persetujuan pengeluaran? Mulai dari berapa?"
|
|
35
|
+
- Files: `docs/presets/approvals/payment_payout.rk` and `docs/presets/approvals/vendor_bill_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
36
|
+
change set to custom/payment.rk and custom/vendor_bill.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
37
|
+
- After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
|
|
38
|
+
|
|
39
|
+
## Checks before you propose the change set
|
|
40
|
+
|
|
41
|
+
- `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
|
|
42
|
+
- The approver role is not the role that normally submits that document: an approver who submits approves their own request.
|
|
43
|
+
- Run the site validation of the change set; do not apply it when it reports an error.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/app.json
|
|
2
|
+
name: pesanan_whatsapp
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
title: {id: Pesanan dari WhatsApp, en: WhatsApp orders}
|
|
5
|
+
label: {id: Rangka Pesanan WhatsApp, en: Rangka WhatsApp Orders}
|
|
6
|
+
summary:
|
|
7
|
+
id: Chat pesanan di WhatsApp jadi draf berharga dari data barang; staf konfirmasi sekali ketuk dan pelanggan dibalas totalnya.
|
|
8
|
+
category: sales
|
|
9
|
+
icon: chat-check-line
|
|
10
|
+
rangka: '>=0.5'
|
|
11
|
+
# A piece on top of kasir (module whatsapp_order, its doc has the rules): the work screen pesanan_wa for the cashier and
|
|
12
|
+
# head office, the orders and the messages they came from in the menu. Needs the WhatsApp service from Rangka Cloud
|
|
13
|
+
# (connector rangka_whatsapp on the site), which reads the text into lines; prices always come from the item records.
|
|
14
|
+
modules:
|
|
15
|
+
users: ^1.2
|
|
16
|
+
contacts: ^1.3
|
|
17
|
+
catalogue: ^1.3
|
|
18
|
+
outlets: ^1.8
|
|
19
|
+
pos: ^1.3
|
|
20
|
+
whatsapp: ^1.1
|
|
21
|
+
whatsapp_order: ^1.0
|
|
22
|
+
roles: [cashier, head_office]
|
|
23
|
+
home: {model: whatsapp_order}
|
|
24
|
+
work:
|
|
25
|
+
- {screen: pesanan_wa, roles: [cashier, head_office]}
|
|
26
|
+
menu:
|
|
27
|
+
- group: {id: Pesanan WhatsApp}
|
|
28
|
+
items: [whatsapp_order, whatsapp_inbound, whatsapp_message]
|
|
@@ -60,3 +60,10 @@ onboarding:
|
|
|
60
60
|
- ask: {id: 'Apakah usaha kamu PKP (memungut PPN)?'}
|
|
61
61
|
options: ['true', 'false']
|
|
62
62
|
sets: tax.pkp
|
|
63
|
+
# Approval presets are opt-in (docs/presets/approvals/README.md): the answer 'ya' makes Raka copy the preset to custom/.
|
|
64
|
+
- ask: {id: 'Mau pasang Persetujuan PO di atas batas? Pesanan pembelian di atas Rp 5.000.000 menunggu persetujuan dulu.'}
|
|
65
|
+
options: ['ya', 'tidak']
|
|
66
|
+
sets: approvals.po_threshold
|
|
67
|
+
- ask: {id: 'Mau pasang Persetujuan pengeluaran? Pembayaran keluar dan tagihan pemasok di atas Rp 5.000.000 menunggu persetujuan dulu.'}
|
|
68
|
+
options: ['ya', 'tidak']
|
|
69
|
+
sets: approvals.spending
|
|
@@ -109,6 +109,22 @@ widgets:
|
|
|
109
109
|
period: date
|
|
110
110
|
sort: -value
|
|
111
111
|
span: 6
|
|
112
|
+
# Terlaris per produk: the sizes and flavours of one product count together (hidden variant_group of the stock move);
|
|
113
|
+
# an item without a group is not in this chart (see Terlaris per barang). Cancelled sales and returns net out.
|
|
114
|
+
- name: best_sellers_by_product
|
|
115
|
+
type: chart
|
|
116
|
+
chart: bar
|
|
117
|
+
label: {id: Terlaris per produk}
|
|
118
|
+
description: {id: 'Jumlah terjual per produk; semua varian satu produk dihitung bersama'}
|
|
119
|
+
model: stock_move
|
|
120
|
+
group_by: variant_group
|
|
121
|
+
aggregate: sum
|
|
122
|
+
field: sold_qty
|
|
123
|
+
filter: "(voucher_type == 'outlet_sales' || voucher_type == 'outlet_return') && variant_group != ''"
|
|
124
|
+
period: posting_date
|
|
125
|
+
sort: -value
|
|
126
|
+
limit: 10
|
|
127
|
+
span: 6
|
|
112
128
|
- name: net_by_day
|
|
113
129
|
type: chart
|
|
114
130
|
chart: line
|
|
@@ -96,6 +96,19 @@ widgets:
|
|
|
96
96
|
limit: 20
|
|
97
97
|
columns: [outlet, item, qty, value]
|
|
98
98
|
span: 12
|
|
99
|
+
- name: stock_by_product
|
|
100
|
+
type: chart
|
|
101
|
+
chart: bar
|
|
102
|
+
label: {id: Stok per produk}
|
|
103
|
+
description: {id: 'Jumlah stok semua varian satu produk (ukuran, rasa) dijumlahkan'}
|
|
104
|
+
model: stock_balance
|
|
105
|
+
group_by: variant_group
|
|
106
|
+
aggregate: sum
|
|
107
|
+
field: qty
|
|
108
|
+
filter: "qty > 0 && variant_group != ''"
|
|
109
|
+
sort: -value
|
|
110
|
+
limit: 10
|
|
111
|
+
span: 6
|
|
99
112
|
- name: stock_value_by_outlet
|
|
100
113
|
type: chart
|
|
101
114
|
chart: bar
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rangka-app-ritel-cabang
|
|
3
|
+
description: "Rangka Ritel Cabang (app ritel_cabang): outlets, stock, purchasing and sales for a multi-outlet shop. Use when an owner asks for approval or a spending limit (\"PO besar harus aku setujui\", \"batasi pengeluaran staf\", \"diskon besar tanya aku dulu\") and during onboarding of this app, to offer the approval presets."
|
|
4
|
+
metadata: {rangka: {version: 1.0.0, app: ritel_cabang, requires: [rangka-compose, rangka-changesets]}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rangka approval presets for this app
|
|
8
|
+
|
|
9
|
+
Read `rangka-compose` first. This skill only covers the approval presets (issue rangka-apps#105). The engine is the
|
|
10
|
+
document approval of contract 0007: a submit that matches a policy is held (202), the approver sees it in Persetujuan
|
|
11
|
+
and the document proceeds when approved; a rejected one stays a draft.
|
|
12
|
+
|
|
13
|
+
## Rules
|
|
14
|
+
|
|
15
|
+
- **Opt-in.** Never switch a preset on by default. Ask the owner (onboarding question) and only an answer `ya` installs it.
|
|
16
|
+
- **Roles only.** No per-person limits. The approver here is the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve).
|
|
17
|
+
- **The limit is the owner's call.** The files use Rp 5.000.000 (purchasing, payouts) and 20% (discount) as examples.
|
|
18
|
+
Ask "mulai dari berapa?" and change the number in the `when:` expression of the copy, never in the preset file.
|
|
19
|
+
- Money or tax questions beyond a threshold are not part of a preset: say so and offer the nearest preset.
|
|
20
|
+
|
|
21
|
+
## Presets for this app
|
|
22
|
+
|
|
23
|
+
### Persetujuan PO di atas batas
|
|
24
|
+
|
|
25
|
+
- What the owner gets: a purchase order above Rp 5.000.000 (or in a foreign currency) waits for approval before it can be submitted; a smaller one goes straight through.
|
|
26
|
+
- Say it like this: "Mau aku pasangkan Persetujuan PO di atas batas? Mulai dari berapa?"
|
|
27
|
+
- Files: `docs/presets/approvals/purchase_order_threshold_owner_only.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
28
|
+
change set to custom/purchase_order.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
29
|
+
- After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
|
|
30
|
+
|
|
31
|
+
### Persetujuan pengeluaran
|
|
32
|
+
|
|
33
|
+
- What the owner gets: an outgoing payment above Rp 5.000.000, and a supplier bill above it that has no approved PO, wait for approval; incoming payments are not affected.
|
|
34
|
+
- Say it like this: "Mau aku pasangkan Persetujuan pengeluaran? Mulai dari berapa?"
|
|
35
|
+
- Files: `docs/presets/approvals/payment_payout.rk` and `docs/presets/approvals/vendor_bill_threshold.rk`. Read each with `rangka_skill_file`, replace the limit if the owner named another, and write it as a
|
|
36
|
+
change set to custom/payment.rk and custom/vendor_bill.rk (a copy of the file, named after its model). Each file starts with a plain-words header comment.
|
|
37
|
+
- After install, tell the owner who will see the request: the owner (this app has no finance role, so the `_owner_only` files are used: the approver role is one nobody holds and the owner may always approve), in Persetujuan.
|
|
38
|
+
|
|
39
|
+
## Checks before you propose the change set
|
|
40
|
+
|
|
41
|
+
- `custom/<model>.rk` does not exist yet for that model (one preset per model; if it does, merge the `approvals:` entry into it).
|
|
42
|
+
- The approver role is not the role that normally submits that document: an approver who submits approves their own request.
|
|
43
|
+
- Run the site validation of the change set; do not apply it when it reports an error.
|
|
@@ -10,15 +10,15 @@ Read `rangka-compose` first. This draft only adds the first day.
|
|
|
10
10
|
|
|
11
11
|
## First day (first-day.json)
|
|
12
12
|
|
|
13
|
-
`first-day.json` next to this file is read by Rangka Cloud after the build (proposal "First day with
|
|
13
|
+
`first-day.json` next to this file is read by Rangka Cloud after the build (proposal "First day with Zafdoz", draft for rangka-os):
|
|
14
14
|
|
|
15
15
|
- `steps`: 3-5 steps in the order a rental business starts. A step is done when the kernel has at least `done.min`
|
|
16
16
|
records of `done.model`; a step without `done` is ticked by the owner.
|
|
17
|
-
- `seed`: what
|
|
17
|
+
- `seed`: what Zafdoz may prepare from the interview. Only values the owner said, each with the owner's quote (engine
|
|
18
18
|
`/v1/seed` drops the rest). Money fields are marked `money` and shown separately; nothing is written before the
|
|
19
19
|
owner agrees.
|
|
20
20
|
- `rename`: model labels that follow the owner's own word for what they rent (`{Word}` capitalised, `{word}` lower),
|
|
21
21
|
proposed as one low-risk change set of label overlays.
|
|
22
|
-
- `menu`: one sentence per menu item, said by
|
|
22
|
+
- `menu`: one sentence per menu item, said by Zafdoz when the owner first opens it.
|
|
23
23
|
|
|
24
24
|
Say these in the owner's words. Never invent units, plates, rates or fees the owner did not say.
|
|
@@ -34,7 +34,7 @@ What the kernel holds works for this business only and is not Meta's:
|
|
|
34
34
|
|
|
35
35
|
`send_template {to, template, type, components, idempotency_key}` → `{message_id, status}`.
|
|
36
36
|
|
|
37
|
-
- `type` is the business's message type: `receipt`, `reminder`, `order_ready`, `appointment`. Each can be switched off
|
|
37
|
+
- `type` is the business's message type: `receipt`, `reminder`, `order_ready`, `appointment`, `order_reply`. Each can be switched off
|
|
38
38
|
on its own.
|
|
39
39
|
- `components` is one body component with text parameters, in the template's order. The host rebuilds what goes to
|
|
40
40
|
Meta from them; a header, a button or media is refused.
|
|
@@ -74,7 +74,7 @@ Every event is one JSON object, signed over the raw body: `X-Rangka-Signature: s
|
|
|
74
74
|
| Trigger | Fields | When |
|
|
75
75
|
| --- | --- | --- |
|
|
76
76
|
| `message_status` | `message_id`, `idempotency_key`, `type`, `status` (`sent`, `delivered`, `read`, `failed`), `at`, `error` | Meta reported a status, or the host refused a send (`failed`, `message_id` empty, the code in `error`) |
|
|
77
|
-
| `message_received` | `message_id`, `from`, `text`, `profile_name`, `at` | a customer wrote to the number (it only sends in phase 1) |
|
|
77
|
+
| `message_received` | `message_id`, `from`, `text`, `kind`, `profile_name`, `at`, `lines`, `notes`, `order_signal` | a customer wrote to the number (it only sends in phase 1). The host reads a text as an order (deterministic, no catalogue): `lines` are `{qty, qty_given, unit, name, note, text}` with `name` lower-case ASCII words, `notes` the pick-up, delivery or time remarks, `order_signal` true when it reads as an order (an order word, a quantity, or a list of two or more). rangka-apps module `whatsapp_order` matches the lines against the business's items |
|
|
78
78
|
| `opted_out` | `phone`, `at`, `source` (`keyword`, `meta`, `staff`) | a customer replied `BERHENTI` or `STOP`, or Meta reported a block |
|
|
79
79
|
|
|
80
80
|
A status never carries the phone: the flow finds its document by `idempotency_key`.
|
|
@@ -92,6 +92,7 @@ language `id`, and end with *Balas BERHENTI untuk berhenti menerima pesan.*
|
|
|
92
92
|
| `terima_kasih_lunas` | `reminder` | Halo {{1}}, terima kasih. Pembayaran faktur {{2}} sudah kami terima dan faktur ini sudah lunas. |
|
|
93
93
|
| `pesanan_siap` | `order_ready` | Halo {{1}}, pesanan {{2}} di {{3}} sudah siap diambil. Sebutkan nomor pesanan saat mengambil. Terima kasih. |
|
|
94
94
|
| `pengingat_janji` | `appointment` | Halo {{1}}, kami mengingatkan {{2}} di {{3}} pada {{4}}. Kalau perlu mengubah jadwal, hubungi kami sebelum waktunya. Terima kasih. |
|
|
95
|
+
| `pesanan_diterima` | `order_reply` | Halo {{1}}, pesanan {{2}} di {{3}} sudah kami terima: {{4}}. Total {{5}}. Terima kasih. |
|
|
95
96
|
|
|
96
97
|
## Local mock
|
|
97
98
|
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
name: rangka_whatsapp
|
|
13
13
|
label: {id: WhatsApp dari Rangka Cloud, en: WhatsApp from Rangka Cloud}
|
|
14
14
|
summary:
|
|
15
|
-
id: Kirim struk, pengingat
|
|
15
|
+
id: Kirim struk, pengingat dan kabar pesanan, dan terima pesanan pelanggan, lewat nomor WhatsApp bisnismu dari Rangka Cloud.
|
|
16
16
|
en: Send receipts, payment reminders and order updates to customers from the WhatsApp number Rangka Cloud provides for your business.
|
|
17
17
|
category: messaging
|
|
18
18
|
icon: send-plane-line
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.2.0
|
|
20
20
|
vendor: Rangka Cloud
|
|
21
21
|
docs: https://github.com/rangka-os/rangka-connectors/blob/main/rangka_whatsapp/README.md
|
|
22
22
|
# The host's public service address. A placeholder under the reserved .example domain until Rangka Cloud has one:
|
|
@@ -55,7 +55,11 @@ triggers:
|
|
|
55
55
|
status: status
|
|
56
56
|
at: at
|
|
57
57
|
error: error
|
|
58
|
-
# A customer wrote to the number. The number only sends (phase 1), so this is for the business to see.
|
|
58
|
+
# A customer wrote to the number. The number only sends (phase 1), so this is for the business to see. The host
|
|
59
|
+
# also reads a text as an order (Rangka Cloud internal/whatsapp/orderparse, deterministic, no catalogue): `lines`
|
|
60
|
+
# [{qty, qty_given, unit, name, note, text}], `notes` (pick-up, delivery, time) and `order_signal` (an order word,
|
|
61
|
+
# a quantity or a list). rangka-apps module whatsapp_order matches the lines against the business's own items;
|
|
62
|
+
# `kind` is Meta's message type (text, image, …; a non-text message has no text and no lines).
|
|
59
63
|
- name: message_received
|
|
60
64
|
label: {id: Pesan masuk, en: Incoming message}
|
|
61
65
|
via: webhook
|
|
@@ -69,8 +73,12 @@ triggers:
|
|
|
69
73
|
message_id: message_id
|
|
70
74
|
from: from
|
|
71
75
|
text: text
|
|
76
|
+
kind: kind
|
|
72
77
|
profile_name: profile_name
|
|
73
78
|
at: at
|
|
79
|
+
lines: lines
|
|
80
|
+
notes: notes
|
|
81
|
+
order_signal: order_signal
|
|
74
82
|
# A customer asked to stop (they replied BERHENTI or STOP, or Meta reported a block). The host already refuses
|
|
75
83
|
# sends to them; the flow marks the customer so staff see it.
|
|
76
84
|
- name: opted_out
|
|
@@ -102,7 +110,7 @@ actions:
|
|
|
102
110
|
input:
|
|
103
111
|
- {name: to, type: phone, required: true}
|
|
104
112
|
- {name: template, type: data, required: true}
|
|
105
|
-
# receipt | reminder | order_ready | appointment: which of the business's message types this is
|
|
113
|
+
# receipt | reminder | order_ready | appointment | order_reply: which of the business's message types this is
|
|
106
114
|
- {name: type, type: data, required: true}
|
|
107
115
|
- {name: components, type: json}
|
|
108
116
|
# <document>:<type>:<step>, e.g. STRK-KPI-2611-00142:receipt:1. The same key is sent once, by the kernel
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"message_status.json": {"message_id": "wam_contoh0001", "idempotency_key": "STRK-KPI-2611-00142:receipt:1", "type": "receipt", "status": "read", "error": ""},
|
|
3
3
|
"message_status_refused.json": {"message_id": "", "idempotency_key": "INV-2026-00031:reminder:7", "status": "failed", "error": "recipient_opted_out"},
|
|
4
|
-
"message_received.json": {"from": "+6281200000001", "text": "Terima kasih", "profile_name": "Pelanggan Contoh"},
|
|
4
|
+
"message_received.json": {"from": "+6281200000001", "text": "Terima kasih", "profile_name": "Pelanggan Contoh", "kind": "text", "order_signal": false},
|
|
5
5
|
"opted_out.json": {"phone": "+6281200000001", "source": "keyword"},
|
|
6
6
|
"send_template.json": {"message_id": "wam_contoh0001", "status": "accepted"},
|
|
7
7
|
"send_template_duplicate.json": {"message_id": "wam_contoh0001", "status": "delivered"},
|
|
8
|
-
"set_opt_out.json": {"status": "recorded"}
|
|
8
|
+
"set_opt_out.json": {"status": "recorded"},
|
|
9
|
+
"message_received_order.json": {"from": "+6281200000001", "order_signal": true, "notes": ["ambil jam 3"]}
|
|
9
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"message_id": "wamid.CONTOH0002", "from": "+6281200000001", "text": "Terima kasih", "profile_name": "Pelanggan Contoh", "at": "2026-11-19T03:05:00Z"}
|
|
1
|
+
{"message_id": "wamid.CONTOH0002", "from": "+6281200000001", "text": "Terima kasih", "kind": "text", "profile_name": "Pelanggan Contoh", "at": "2026-11-19T03:05:00Z", "lines": [], "notes": [], "order_signal": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"message_id": "wamid.CONTOH0003", "from": "+6281200000001", "text": "pesan 2 kopi susu, 1 roti bakar coklat, ambil jam 3", "kind": "text", "profile_name": "Pelanggan Contoh", "at": "2026-11-19T03:06:00Z", "lines": [{"qty": 2, "qty_given": true, "unit": "", "name": "kopi susu", "note": "", "text": "pesan 2 kopi susu"}, {"qty": 1, "qty_given": true, "unit": "", "name": "roti bakar coklat", "note": "", "text": "1 roti bakar coklat"}], "notes": ["ambil jam 3"], "order_signal": true}
|
|
@@ -18,8 +18,10 @@ Stdlib only. The request, answer and event shapes follow connector.rk and README
|
|
|
18
18
|
- POST /svc/whatsapp/v1/opt-outs (Bearer token) {phone}: 200 {status: recorded | already}.
|
|
19
19
|
- POST /simulate/status {message_id | idempotency_key, status, error}: the message's status changes (sent, delivered,
|
|
20
20
|
read, failed) and the mock posts the message_status event to --hook-url/message_status, signed.
|
|
21
|
-
- POST /simulate/inbound {from, text}: a customer writes. BERHENTI or STOP opts them out
|
|
22
|
-
else posts message_received.
|
|
21
|
+
- POST /simulate/inbound {from, text[, lines, notes, order_signal]}: a customer writes. BERHENTI or STOP opts them out
|
|
22
|
+
and posts opted_out; anything else posts message_received. The host reads a text as an order with its own parser
|
|
23
|
+
(Rangka Cloud internal/whatsapp/orderparse); this mock has none, so a test passes the lines it wants the kernel to
|
|
24
|
+
hear (none by default).
|
|
23
25
|
- POST /simulate/redeliver[?key=<other>]: posts the last event again (the host retries an event that got no 2xx),
|
|
24
26
|
optionally signed with another key, to test the receiver's dedupe and its signature check.
|
|
25
27
|
- POST /simulate/service {state: active | stopped | paused}, POST /simulate/template {name, approved: true | false},
|
|
@@ -54,8 +56,9 @@ TEMPLATES = {
|
|
|
54
56
|
"terima_kasih_lunas": ("reminder", 2),
|
|
55
57
|
"pesanan_siap": ("order_ready", 3),
|
|
56
58
|
"pengingat_janji": ("appointment", 4),
|
|
59
|
+
"pesanan_diterima": ("order_reply", 5),
|
|
57
60
|
}
|
|
58
|
-
TYPES = {"receipt", "reminder", "order_ready", "appointment"}
|
|
61
|
+
TYPES = {"receipt", "reminder", "order_ready", "appointment", "order_reply"}
|
|
59
62
|
STOP_WORDS = {"BERHENTI", "STOP"}
|
|
60
63
|
KEY_RE = re.compile(r"^[A-Za-z0-9._:/-]{1,200}$")
|
|
61
64
|
SIGNATURE_HEADER = "X-Rangka-Signature"
|
|
@@ -299,7 +302,9 @@ def handler(state: State):
|
|
|
299
302
|
code = deliver(state, "opted_out", {"phone": phone, "at": now_iso(), "source": "keyword"})
|
|
300
303
|
else:
|
|
301
304
|
code = deliver(state, "message_received", {"message_id": "wamid.IN" + uuid.uuid4().hex[:12], "from": phone, "text": text,
|
|
302
|
-
"profile_name": str(b.get("profile_name") or "Pelanggan Contoh"),
|
|
305
|
+
"kind": "text", "profile_name": str(b.get("profile_name") or "Pelanggan Contoh"),
|
|
306
|
+
"at": now_iso(), "lines": b.get("lines") or [], "notes": b.get("notes") or [],
|
|
307
|
+
"order_signal": bool(b.get("order_signal"))})
|
|
303
308
|
return self._json(200, {"hook_status": code})
|
|
304
309
|
if what == "redeliver":
|
|
305
310
|
with state.lock:
|
|
@@ -20,7 +20,7 @@ steps:
|
|
|
20
20
|
set:
|
|
21
21
|
computed_at: now()
|
|
22
22
|
line_count: pl.size()
|
|
23
|
-
revenue: "0 - pl.map(r, r.account.startsWith('411') ? r.amount : 0).sum()"
|
|
23
|
+
revenue: "0 - pl.map(r, r.account.startsWith('411') || r.account.startsWith('413') ? r.amount : 0).sum()"
|
|
24
24
|
sales_returns: "pl.map(r, r.account.startsWith('412') ? r.amount : 0).sum()"
|
|
25
25
|
other_income: "0 - pl.map(r, r.account.startsWith('49') ? r.amount : 0).sum()"
|
|
26
26
|
cogs: "pl.map(r, r.account.startsWith('511') ? r.amount : 0).sum()"
|
|
@@ -20,7 +20,7 @@ steps:
|
|
|
20
20
|
set:
|
|
21
21
|
computed_at: now()
|
|
22
22
|
line_count: pl.size()
|
|
23
|
-
revenue: "0 - pl.map(r, r.account.startsWith('411') ? r.amount : 0).sum()"
|
|
23
|
+
revenue: "0 - pl.map(r, r.account.startsWith('411') || r.account.startsWith('413') ? r.amount : 0).sum()"
|
|
24
24
|
sales_returns: "pl.map(r, r.account.startsWith('412') ? r.amount : 0).sum()"
|
|
25
25
|
other_income: "0 - pl.map(r, r.account.startsWith('49') ? r.amount : 0).sum()"
|
|
26
26
|
cogs: "pl.map(r, r.account.startsWith('511') ? r.amount : 0).sum()"
|