@rangka-os/create 0.5.0-alpha.27 → 0.5.0-alpha.29

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 (220) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/absen_karyawan/app.rk +37 -0
  3. package/template/base/apps/absen_karyawan/dashboards/absen_hari_ini.rk +20 -0
  4. package/template/base/apps/absen_karyawan/dashboards/absen_karyawan_saya.rk +14 -0
  5. package/template/base/apps/absen_karyawan/dashboards/rekap_absen_karyawan.rk +12 -0
  6. package/template/base/apps/jasa_proyek/app.rk +4 -1
  7. package/template/base/apps/kasir/app.rk +5 -1
  8. package/template/base/apps/kasir/dashboards/kasir_ringkas.rk +4 -0
  9. package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +20 -0
  10. package/template/base/apps/pembukuan/app.rk +3 -0
  11. package/template/base/connectors/midtrans/connector.rk +249 -0
  12. package/template/base/connectors/midtrans/fixtures/charge_gopay.json +34 -0
  13. package/template/base/connectors/midtrans/fixtures/charge_qris.json +23 -0
  14. package/template/base/connectors/midtrans/fixtures/charge_va.json +20 -0
  15. package/template/base/connectors/midtrans/fixtures/create_snap.json +4 -0
  16. package/template/base/connectors/midtrans/fixtures/expect.json +88 -0
  17. package/template/base/connectors/midtrans/fixtures/get_status.json +15 -0
  18. package/template/base/connectors/midtrans/fixtures/payment_notified.json +28 -0
  19. package/template/base/connectors/midtrans/fixtures/payment_notified_challenge.json +24 -0
  20. package/template/base/connectors/midtrans/fixtures/payment_notified_expire.json +24 -0
  21. package/template/base/connectors/midtrans/fixtures/payment_notified_other_amount.json +28 -0
  22. package/template/base/connectors/midtrans/fixtures/payment_notified_partial_refund.json +34 -0
  23. package/template/base/connectors/midtrans/fixtures/payment_notified_pending.json +31 -0
  24. package/template/base/connectors/midtrans/fixtures/payment_notified_refund.json +34 -0
  25. package/template/base/connectors/midtrans/fixtures/payment_notified_relabelled.json +28 -0
  26. package/template/base/connectors/midtrans/fixtures/payment_notified_va.json +32 -0
  27. package/template/base/connectors/midtrans/fixtures/signature_vector.txt +3 -0
  28. package/template/base/connectors/midtrans/mock/midtrans_mock.py +335 -0
  29. package/template/base/connectors/rangka_whatsapp/README.md +105 -0
  30. package/template/base/connectors/rangka_whatsapp/connector.rk +141 -0
  31. package/template/base/connectors/rangka_whatsapp/fixtures/expect.json +9 -0
  32. package/template/base/connectors/rangka_whatsapp/fixtures/message_received.json +1 -0
  33. package/template/base/connectors/rangka_whatsapp/fixtures/message_status.json +1 -0
  34. package/template/base/connectors/rangka_whatsapp/fixtures/message_status_refused.json +1 -0
  35. package/template/base/connectors/rangka_whatsapp/fixtures/opted_out.json +1 -0
  36. package/template/base/connectors/rangka_whatsapp/fixtures/send_template.json +1 -0
  37. package/template/base/connectors/rangka_whatsapp/fixtures/send_template_duplicate.json +1 -0
  38. package/template/base/connectors/rangka_whatsapp/fixtures/set_opt_out.json +1 -0
  39. package/template/base/connectors/rangka_whatsapp/mock/rangka_whatsapp_mock.py +354 -0
  40. package/template/base/connectors/shopee/connector.rk +360 -0
  41. package/template/base/connectors/shopee/fixtures/expect.json +119 -0
  42. package/template/base/connectors/shopee/fixtures/get_models.json +52 -0
  43. package/template/base/connectors/shopee/fixtures/get_order_detail.json +396 -0
  44. package/template/base/connectors/shopee/fixtures/get_settlement.json +90 -0
  45. package/template/base/connectors/shopee/fixtures/get_tracking.json +13 -0
  46. package/template/base/connectors/shopee/fixtures/list_items.json +29 -0
  47. package/template/base/connectors/shopee/fixtures/list_orders.json +31 -0
  48. package/template/base/connectors/shopee/fixtures/list_settlements.json +15 -0
  49. package/template/base/connectors/shopee/fixtures/order_changed.json +101 -0
  50. package/template/base/connectors/shopee/fixtures/order_changed_cancelled.json +72 -0
  51. package/template/base/connectors/shopee/fixtures/order_changed_completed.json +101 -0
  52. package/template/base/connectors/shopee/fixtures/order_changed_in_cancel.json +72 -0
  53. package/template/base/connectors/shopee/fixtures/order_changed_unpaid.json +71 -0
  54. package/template/base/connectors/shopee/fixtures/order_settled.json +92 -0
  55. package/template/base/connectors/shopee/fixtures/push_received.json +12 -0
  56. package/template/base/connectors/shopee/fixtures/push_received_tracking.json +11 -0
  57. package/template/base/connectors/shopee/fixtures/update_stock.json +15 -0
  58. package/template/base/connectors/shopee/mock/shopee_mock.py +894 -0
  59. package/template/base/connectors/tiktok_shop/connector.rk +300 -0
  60. package/template/base/connectors/tiktok_shop/fixtures/expect.json +105 -0
  61. package/template/base/connectors/tiktok_shop/fixtures/get_order_detail.json +136 -0
  62. package/template/base/connectors/tiktok_shop/fixtures/get_settlement.json +83 -0
  63. package/template/base/connectors/tiktok_shop/fixtures/get_tracking.json +28 -0
  64. package/template/base/connectors/tiktok_shop/fixtures/list_orders.json +242 -0
  65. package/template/base/connectors/tiktok_shop/fixtures/list_products.json +77 -0
  66. package/template/base/connectors/tiktok_shop/fixtures/list_settlements.json +22 -0
  67. package/template/base/connectors/tiktok_shop/fixtures/list_shops.json +17 -0
  68. package/template/base/connectors/tiktok_shop/fixtures/order_changed.json +129 -0
  69. package/template/base/connectors/tiktok_shop/fixtures/order_changed_cancelled.json +81 -0
  70. package/template/base/connectors/tiktok_shop/fixtures/order_changed_completed.json +106 -0
  71. package/template/base/connectors/tiktok_shop/fixtures/order_changed_on_hold.json +104 -0
  72. package/template/base/connectors/tiktok_shop/fixtures/order_changed_tokopedia.json +106 -0
  73. package/template/base/connectors/tiktok_shop/fixtures/order_changed_unpaid.json +79 -0
  74. package/template/base/connectors/tiktok_shop/fixtures/order_settled.json +73 -0
  75. package/template/base/connectors/tiktok_shop/fixtures/update_stock.json +6 -0
  76. package/template/base/connectors/tiktok_shop/fixtures/webhook_received.json +12 -0
  77. package/template/base/connectors/tiktok_shop/fixtures/webhook_received_cancellation.json +13 -0
  78. package/template/base/connectors/tiktok_shop/mock/tiktok_shop_mock.py +819 -0
  79. package/template/base/connectors/whatsapp_business/connector.rk +3 -1
  80. package/template/base/connectors/whatsapp_business/templates.md +13 -1
  81. package/template/base/modules/accounting/flows/gl_asset_disposal_post.rk +68 -0
  82. package/template/base/modules/accounting/flows/gl_asset_disposal_reverse.rk +194 -0
  83. package/template/base/modules/accounting/flows/gl_depreciation_run_post.rk +43 -0
  84. package/template/base/modules/accounting/flows/gl_depreciation_run_reverse.rk +36 -0
  85. package/template/base/modules/accounting/flows/gl_fixed_asset_post.rk +51 -0
  86. package/template/base/modules/accounting/flows/gl_fixed_asset_reverse.rk +194 -0
  87. package/template/base/modules/accounting/flows/gl_vendor_bill_post.rk +2 -2
  88. package/template/base/modules/accounting/models/gl_entry.rk +2 -0
  89. package/template/base/modules/accounting/module.rk +2 -2
  90. package/template/base/modules/attendance/flows/attendance_missing_digest.rk +30 -0
  91. package/template/base/modules/attendance/flows/attendance_period_on_cancel.rk +15 -0
  92. package/template/base/modules/attendance/flows/attendance_period_on_submit.rk +60 -0
  93. package/template/base/modules/attendance/flows/staff_attendance_cancel_guard.rk +14 -0
  94. package/template/base/modules/attendance/flows/staff_attendance_guard_created.rk +16 -0
  95. package/template/base/modules/attendance/flows/staff_attendance_guard_submitted.rk +37 -0
  96. package/template/base/modules/attendance/flows/staff_attendance_guard_updated.rk +14 -0
  97. package/template/base/modules/attendance/models/attendance_period.rk +62 -0
  98. package/template/base/modules/attendance/models/attendance_summary.rk +37 -0
  99. package/template/base/modules/attendance/models/staff_attendance.rk +281 -0
  100. package/template/base/modules/attendance/models/staff_attendance_guard.rk +50 -0
  101. package/template/base/modules/attendance/module.rk +18 -0
  102. package/template/base/modules/attendance/screens/absen_outlet.rk +22 -0
  103. package/template/base/modules/catalogue/models/item.rk +69 -0
  104. package/template/base/modules/catalogue/module.rk +1 -1
  105. package/template/base/modules/contacts/models/customer.rk +43 -19
  106. package/template/base/modules/contacts/module.rk +1 -1
  107. package/template/base/modules/coretax/module.rk +1 -1
  108. package/template/base/modules/coretax/print/coretax_faktur.rk +3 -2
  109. package/template/base/modules/coretax/print/coretax_faktur.xml +3 -1
  110. package/template/base/modules/coretax/print/rekap_ppn.html +9 -7
  111. package/template/base/modules/courses/flows/charge_invoice_on_submit.rk +15 -0
  112. package/template/base/modules/courses/module.rk +1 -1
  113. package/template/base/modules/courses/screens/absen_kelas.rk +1 -0
  114. package/template/base/modules/fixed_assets/flows/asset_disposal_on_cancel.rk +14 -0
  115. package/template/base/modules/fixed_assets/flows/asset_disposal_on_submit.rk +21 -0
  116. package/template/base/modules/fixed_assets/flows/asset_from_vendor_bill.rk +41 -0
  117. package/template/base/modules/fixed_assets/flows/depreciation_run_fill.rk +28 -0
  118. package/template/base/modules/fixed_assets/flows/depreciation_run_monthly.rk +36 -0
  119. package/template/base/modules/fixed_assets/flows/depreciation_run_on_cancel.rk +30 -0
  120. package/template/base/modules/fixed_assets/flows/depreciation_run_on_submit.rk +34 -0
  121. package/template/base/modules/fixed_assets/flows/fixed_asset_on_cancel.rk +24 -0
  122. package/template/base/modules/fixed_assets/flows/fixed_asset_on_submit.rk +69 -0
  123. package/template/base/modules/fixed_assets/flows/fixed_assets_setup.rk +29 -0
  124. package/template/base/modules/fixed_assets/flows/opening_balance_asset_guard.rk +15 -0
  125. package/template/base/modules/fixed_assets/flows/vendor_bill_asset_guard.rk +14 -0
  126. package/template/base/modules/fixed_assets/imports/asset_list.rk +22 -0
  127. package/template/base/modules/fixed_assets/models/asset_bill_line.rk +24 -0
  128. package/template/base/modules/fixed_assets/models/asset_book.rk +83 -0
  129. package/template/base/modules/fixed_assets/models/asset_category.rk +54 -0
  130. package/template/base/modules/fixed_assets/models/asset_disposal.rk +97 -0
  131. package/template/base/modules/fixed_assets/models/asset_guard.rk +90 -0
  132. package/template/base/modules/fixed_assets/models/depreciation_line.rk +13 -0
  133. package/template/base/modules/fixed_assets/models/depreciation_run.rk +65 -0
  134. package/template/base/modules/fixed_assets/models/fixed_asset.rk +165 -0
  135. package/template/base/modules/fixed_assets/models/fixed_asset_setting.rk +34 -0
  136. package/template/base/modules/fixed_assets/module.rk +30 -0
  137. package/template/base/modules/fixed_assets/print/fixed_asset_register.html +45 -0
  138. package/template/base/modules/fixed_assets/print/fixed_asset_register.rk +17 -0
  139. package/template/base/modules/invoicing/flows/invoice_due_digest.rk +45 -7
  140. package/template/base/modules/invoicing/models/sales_invoice_item.rk +4 -1
  141. package/template/base/modules/invoicing/module.rk +15 -2
  142. package/template/base/modules/kitchen/screens/dapur.rk +1 -0
  143. package/template/base/modules/outlets/models/outlet.rk +69 -0
  144. package/template/base/modules/outlets/module.rk +1 -1
  145. package/template/base/modules/payments/flows/payment_from_midtrans.rk +85 -0
  146. package/template/base/modules/payments/flows/payment_refund_from_midtrans.rk +22 -0
  147. package/template/base/modules/payments/models/payment.rk +2 -1
  148. package/template/base/modules/payments/module.rk +1 -1
  149. package/template/base/modules/payroll/flows/payroll_close_on_cancel.rk +8 -5
  150. package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +8 -5
  151. package/template/base/modules/payroll/flows/payroll_reminder.rk +106 -0
  152. package/template/base/modules/payroll/flows/payroll_run_overlap_guard_created.rk +5 -3
  153. package/template/base/modules/payroll/flows/payroll_run_overlap_guard_updated.rk +5 -3
  154. package/template/base/modules/payroll/flows/payslip_from_recap.rk +1 -1
  155. package/template/base/modules/payroll/imports/payroll_profile_list.rk +27 -0
  156. package/template/base/modules/payroll/models/payroll_close.rk +10 -6
  157. package/template/base/modules/payroll/models/payroll_run.rk +64 -15
  158. package/template/base/modules/payroll/models/payslip.rk +48 -9
  159. package/template/base/modules/payroll/module.rk +22 -5
  160. package/template/base/modules/payroll/print/payslip.html +4 -1
  161. package/template/base/modules/pos/models/pos_sale.rk +136 -9
  162. package/template/base/modules/pos/models/pos_sale_item.rk +33 -1
  163. package/template/base/modules/pos/module.rk +5 -3
  164. package/template/base/modules/pos/print/pos_receipt.html +7 -3
  165. package/template/base/modules/pos/screens/kasir.rk +7 -2
  166. package/template/base/modules/procurement/flows/reorder_draft_po.rk +57 -0
  167. package/template/base/modules/procurement/models/vendor_bill.rk +21 -2
  168. package/template/base/modules/procurement/module.rk +11 -2
  169. package/template/base/modules/projects/screens/absen.rk +1 -0
  170. package/template/base/modules/promotions/flows/promo_code_batch_on_submit.rk +26 -0
  171. package/template/base/modules/promotions/flows/promotion_apply.rk +110 -0
  172. package/template/base/modules/promotions/flows/promotion_apply_on_create.rk +110 -0
  173. package/template/base/modules/promotions/flows/promotion_apply_on_delete.rk +111 -0
  174. package/template/base/modules/promotions/flows/promotion_apply_on_update.rk +110 -0
  175. package/template/base/modules/promotions/flows/promotion_on_sale.rk +95 -0
  176. package/template/base/modules/promotions/flows/promotion_on_sale_cancel.rk +43 -0
  177. package/template/base/modules/promotions/models/promo_code.rk +27 -0
  178. package/template/base/modules/promotions/models/promo_code_batch.rk +36 -0
  179. package/template/base/modules/promotions/models/promo_guard.rk +44 -0
  180. package/template/base/modules/promotions/models/promotion.rk +197 -0
  181. package/template/base/modules/promotions/models/promotion_ledger.rk +35 -0
  182. package/template/base/modules/promotions/module.rk +20 -0
  183. package/template/base/modules/rental/models/rental_unit.rk +13 -3
  184. package/template/base/modules/rental/module.rk +2 -2
  185. package/template/base/modules/rental/screens/alat_keluar.rk +1 -0
  186. package/template/base/modules/rental/screens/alat_kembali.rk +1 -0
  187. package/template/base/modules/rental/screens/jadwal_alat.rk +1 -0
  188. package/template/base/modules/stock/flows/stock_low_alert.rk +65 -0
  189. package/template/base/modules/stock/flows/stock_negative_alert.rk +14 -5
  190. package/template/base/modules/stock/models/stock_reorder.rk +34 -0
  191. package/template/base/modules/stock/module.rk +17 -2
  192. package/template/base/modules/subscriptions/screens/catat_tagih.rk +1 -0
  193. package/template/base/modules/subscriptions/screens/rute_tagih.rk +1 -0
  194. package/template/base/modules/users/flows/summary_daily.rk +83 -0
  195. package/template/base/modules/users/flows/summary_monthly.rk +83 -0
  196. package/template/base/modules/users/flows/summary_weekly.rk +83 -0
  197. package/template/base/modules/users/models/business_summary.rk +67 -0
  198. package/template/base/modules/users/models/summary_setting.rk +35 -0
  199. package/template/base/modules/users/models/user.rk +11 -3
  200. package/template/base/modules/users/module.rk +21 -2
  201. package/template/base/modules/users/roles/employee.rk +8 -0
  202. package/template/base/modules/users/roles/outlet_supervisor.rk +7 -0
  203. package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out.rk +16 -0
  204. package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out_new.rk +17 -0
  205. package/template/base/modules/whatsapp/flows/whatsapp_message_status.rk +24 -0
  206. package/template/base/modules/whatsapp/flows/whatsapp_opted_out.rk +26 -0
  207. package/template/base/modules/whatsapp/models/whatsapp_message.rk +99 -0
  208. package/template/base/modules/whatsapp/models/whatsapp_opt_out.rk +44 -0
  209. package/template/base/modules/whatsapp/module.rk +23 -0
  210. package/template/base/modules/whatsapp_booking/flows/whatsapp_booking_tomorrow.rk +48 -0
  211. package/template/base/modules/whatsapp_booking/module.rk +13 -0
  212. package/template/base/modules/whatsapp_order_ready/flows/whatsapp_pickup_on_sale.rk +19 -0
  213. package/template/base/modules/whatsapp_order_ready/flows/whatsapp_ticket_ready.rk +40 -0
  214. package/template/base/modules/whatsapp_order_ready/models/whatsapp_pickup.rk +22 -0
  215. package/template/base/modules/whatsapp_order_ready/module.rk +14 -0
  216. package/template/base/modules/whatsapp_receipt/flows/whatsapp_receipt_on_sale.rk +43 -0
  217. package/template/base/modules/whatsapp_receipt/module.rk +13 -0
  218. package/template/base/modules/whatsapp_reminder/flows/whatsapp_invoice_overdue.rk +64 -0
  219. package/template/base/modules/whatsapp_reminder/module.rk +15 -0
  220. package/template/base/modules/workforce/imports/worker_list.rk +4 -1
@@ -0,0 +1,360 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/connector.json
2
+ # Shopee Open Platform (Open API v2): orders, settlements (escrow) and stock of one Shopee shop, for the shared
3
+ # marketplace mapping of this repository (marketplace/README.md: events, flags, lines, rules).
4
+ # Status: spec, no account used. Paths and fields follow Shopee's public API reference and developer guides as read on
5
+ # 19 Nov 2026 (open.shopee.com, developer-guide/16, 18, 20, 31, 223, 229 and the v2.* API pages); to confirm in the
6
+ # sandbox (openplatform.sandbox.test-stable.shopee.sg) once a test partner exists. Research and sources: Juragan's
7
+ # research_notes/Marketplace connector APIs Indonesia/shopee.md and reports/keputusan-riset/marketplace-connectors.md.
8
+ # fixtures/ are synthetic: an invented demo shop (shop_id 880001) selling the SKUs of moka/fixtures (TH-ORI, TH-PDS).
9
+ #
10
+ # Signing: every call carries partner_id, timestamp (Unix seconds, valid 5 minutes) and sign in the query string. sign
11
+ # is lower-case hex HMAC-SHA256, key partner_key, over a plain concatenation with no separator:
12
+ # shop calls: partner_id + path + timestamp + access_token + shop_id
13
+ # token calls: partner_id + path + timestamp (public)
14
+ # The access token lives 4 hours and travels in the query (allow_secret_in: [query]); the refresh token lives 30 days
15
+ # and rotates on every refresh (the old one replays the same new pair for 4 hours, then expires). The kernel signs in a
16
+ # header over lines and refreshes with the OAuth form, so it cannot call Shopee yet: experimental.sign and
17
+ # experimental.refresh below say what it must do.
18
+ #
19
+ # Why polling is the main path: a Shopee push (code 3 order status, code 4 tracking number) only says that something
20
+ # changed ("make a call to the corresponding API"), it carries no lines or money, retries stop after about 3.6 hours,
21
+ # and a missed push is not sent again while the subscription is disabled. order_changed reads every order changed in
22
+ # the last two days (get_order_list by update_time, then get_order_detail per order) and order_settled every escrow
23
+ # released in the last two days. The same order or escrow is emitted again on later polls: the kernel drops an event
24
+ # only when every emitted value is unchanged, and the relay posts every event of the window on every poll, so every
25
+ # flow has the idempotency key of marketplace/README.md ("Flow keys"). After an outage longer than two days, run the
26
+ # relay once with poll --since-days N. push_received is a hint only; no flow books from it.
27
+ #
28
+ # experimental: is not read by the kernel (Juragan proposals/marketplace-connector-runtime.md, parts A to C). Until it
29
+ # lands, shopee/mock/shopee_mock.py poll signs, pages, refreshes and posts each event, in the emit shape below, to the
30
+ # tenant's flows shopee_order_staged and shopee_order_settled.
31
+ #
32
+ # One shop per company: the keys and tokens below are those of one shop (rule 8 of marketplace/README.md).
33
+ # No buyer data: get_order_detail never asks for recipient_address, buyer_username or buyer_user_id, the escrow's
34
+ # buyer_user_name is never read, and no event carries a buyer's name, phone or address (Shopee masks them and allows
35
+ # personal data to be kept 90 days at most).
36
+ name: shopee
37
+ label: {id: Shopee}
38
+ summary:
39
+ id: Ambil pesanan dan pencairan dana Shopee, kirim stok ke Shopee.
40
+ en: Pull Shopee orders and settlements, push stock to Shopee.
41
+ category: sales
42
+ icon: shopping-bag-3-line
43
+ version: 0.1.0
44
+ vendor: Shopee
45
+ docs: https://open.shopee.com/developer-guide/16
46
+ hosts: [partner.shopeemobile.com, openplatform.sandbox.test-stable.shopee.sg]
47
+ auth:
48
+ type: hmac
49
+ fields:
50
+ - name: partner_id
51
+ label: {id: Partner ID}
52
+ required: true
53
+ help: {id: 'Shopee Open Platform > App List. Partner ID uji untuk sandbox, Partner ID live untuk toko nyata'}
54
+ - name: partner_key
55
+ label: {id: Partner key}
56
+ secret: true
57
+ required: true
58
+ help: {id: 'Shopee Open Platform > App List, pasangan dari Partner ID'}
59
+ - name: api_host
60
+ label: {id: Server Shopee}
61
+ required: true
62
+ help: {id: 'openplatform.sandbox.test-stable.shopee.sg untuk uji, partner.shopeemobile.com untuk toko nyata'}
63
+ - name: shop_id
64
+ label: {id: Shop ID}
65
+ required: true
66
+ help: {id: 'Didapat setelah pemilik toko menyetujui akses (satu toko per perusahaan)'}
67
+ - name: access_token
68
+ label: {id: Access token}
69
+ secret: true
70
+ required: true
71
+ help: {id: Berlaku 4 jam dan diperbarui otomatis}
72
+ - name: refresh_token
73
+ label: {id: Refresh token}
74
+ secret: true
75
+ help: {id: 'Berlaku 30 hari, berganti setiap kali dipakai'}
76
+ experimental:
77
+ # Not read by the kernel yet (Juragan proposals/marketplace-connector-runtime.md): until then
78
+ # shopee/mock/shopee_mock.py poll signs and refreshes.
79
+ # Part A: the signature goes into the query (param sign), next to the timestamp it covers. Every action below is a
80
+ # shop call (base); only the refresh is public (base_public).
81
+ sign:
82
+ in: query
83
+ param: sign
84
+ alg: hmac-sha256
85
+ key: partner_key
86
+ encoding: hex
87
+ timestamp: {param: timestamp, unit: seconds}
88
+ base: '{auth.partner_id}{request.target}{request.epoch}{auth.access_token}{auth.shop_id}'
89
+ base_public: '{auth.partner_id}{request.target}{request.epoch}'
90
+ # Part C: Shopee's own refresh (a signed JSON POST). The rotated refresh_token is written before the new access token
91
+ # is used: losing it after the 4 hour replay window means the owner must approve access again. The previous access
92
+ # token stays valid 5 minutes after a refresh. The authorization itself ends after the period the seller chose (7 to
93
+ # 365 days): then needs_auth.
94
+ refresh:
95
+ request:
96
+ method: POST
97
+ url: https://{auth.api_host}/api/v2/auth/access_token/get
98
+ query: {partner_id: '{auth.partner_id}'}
99
+ body: {shop_id: '{auth.shop_id}', refresh_token: '{auth.refresh_token}', partner_id: '{auth.partner_id}'}
100
+ public: true
101
+ output: {access_token: access_token, refresh_token: refresh_token, expires_in: expire_in}
102
+ before: 10m
103
+ on_error: [error_auth, invalid_acceess_token]
104
+ triggers:
105
+ # A hint that an order changed or got a tracking number. Shopee posts one callback URL per app with
106
+ # Authorization = hex HMAC-SHA256(partner_key, <callback url> + '|' + <raw body>) and wants an empty 2xx within 3
107
+ # seconds. The kernel ignores verify.signature.payload today, computes the HMAC over the raw body only, and so refuses
108
+ # every push with 401: it fails closed (proposal part B). Orders still arrive through order_changed.
109
+ # Code 3: data{ordersn, status, completed_scenario, update_time}; code 4: data{ordersn, package_number, tracking_no}
110
+ # (no status or update_time: emitted as null). Other codes (1, 2, 12 authorization, 8 reserved stock, ...) emit
111
+ # order_id null.
112
+ - name: push_received
113
+ label: {id: Kabar dari Shopee}
114
+ via: webhook
115
+ verify:
116
+ signature:
117
+ header: Authorization
118
+ alg: hmac-sha256
119
+ key: partner_key
120
+ encoding: hex
121
+ payload: '{request.url}|{request.body}'
122
+ emit:
123
+ shop_id: shop_id
124
+ code: code
125
+ order_id: data.ordersn
126
+ status: data.status
127
+ updated_at: data.update_time
128
+ sent_at: timestamp
129
+ # Every 10 minutes: list_orders (orders changed since two days back, by update_time) runs first, then
130
+ # get_order_detail once per order (proposal part E would batch 50). The kernel reads the first page of list_orders
131
+ # (100 orders changed in two days); the relay follows next_cursor to the end. Fields per marketplace/README.md:
132
+ # the flags come from order_status, lines are Shopee's item_list unchanged (SKU model_sku, else item_sku; quantity
133
+ # model_quantity_purchased; ids item_id, model_id for a stock push). buyer_total is total_amount (shipping paid by the
134
+ # buyer included), null until paid, like pay_time (a COD order is READY_TO_SHIP, so sold, with pay_time null).
135
+ # TO_RETURN sets no flag: returns are not read in v0.1 and a person books them (marketplace/README.md rule 3).
136
+ - name: order_changed
137
+ label: {id: Pesanan Shopee baru atau berubah}
138
+ via: poll
139
+ every: 10m
140
+ action: get_order_detail
141
+ each: {action: list_orders, items: orders, as: order, key: order.order_sn}
142
+ input:
143
+ order_sn_list: order.order_sn
144
+ for_each: orders[]
145
+ emit:
146
+ channel: "'shopee'"
147
+ storefront: "'SHOPEE'"
148
+ order_id: item.order_sn
149
+ status: item.order_status
150
+ sold: "item.order_status == 'READY_TO_SHIP' || item.order_status == 'PROCESSED' || item.order_status == 'RETRY_SHIP' || item.order_status == 'SHIPPED' || item.order_status == 'TO_CONFIRM_RECEIVE' || item.order_status == 'COMPLETED'"
151
+ shipped: "item.order_status == 'SHIPPED' || item.order_status == 'TO_CONFIRM_RECEIVE' || item.order_status == 'COMPLETED'"
152
+ completed: "item.order_status == 'COMPLETED'"
153
+ cancelled: "item.order_status == 'CANCELLED'"
154
+ created_at: item.create_time
155
+ paid_at: item.pay_time
156
+ updated_at: item.update_time
157
+ currency: item.currency
158
+ buyer_total: item.total_amount
159
+ lines: item.item_list
160
+ # Every hour: list_settlements (escrows released since two days back) runs first, then get_settlement per order.
161
+ # net is escrow_amount (Shopee's formula: item price minus seller vouchers, plus the buyer's shipping, minus actual
162
+ # shipping, minus every fee and withheld tax); adjusted_net is escrow_amount_after_adjustment (net after
163
+ # order_adjustment[], null when absent), which clears the receivable when present. A fee is a cost when positive; a
164
+ # negative value refunds it (never the absolute value). withheld_tax is withholding_tax (PPh 22, PMK 37/2025, ID
165
+ # local shops). income is order_income unchanged: campaign_fee, seller_order_processing_fee, order_ams_commission_fee,
166
+ # protection premiums, shipping, seller_return_refund and order_adjustment stay in it; the flow books only the named
167
+ # fees and withheld tax and leaves the rest open on the receivable for a person (marketplace/README.md rule 4).
168
+ # get_escrow_detail has no currency field: a local Indonesian shop is paid in IDR.
169
+ - name: order_settled
170
+ label: {id: Dana pesanan Shopee cair}
171
+ via: poll
172
+ every: 1h
173
+ action: get_settlement
174
+ each: {action: list_settlements, items: escrows, as: escrow, key: escrow.order_sn}
175
+ input:
176
+ order_sn: escrow.order_sn
177
+ for_each: settlement
178
+ emit:
179
+ channel: "'shopee'"
180
+ order_id: item.order_sn
181
+ currency: "'IDR'"
182
+ settled_at: escrow.escrow_release_time
183
+ net: item.order_income.escrow_amount
184
+ adjusted_net: item.order_income.escrow_amount_after_adjustment
185
+ commission_fee: item.order_income.commission_fee
186
+ service_fee: item.order_income.service_fee
187
+ transaction_fee: item.order_income.seller_transaction_fee
188
+ withheld_tax: item.order_income.withholding_tax
189
+ income: item.order_income
190
+ actions:
191
+ # GET v2.order.get_order_list: a window of at most 15 days, page_size 1 to 100, next page by cursor (next_cursor is
192
+ # empty when more is false). The defaults cover two days back to tomorrow (UTC days), so the kernel can call it
193
+ # without input (each:).
194
+ - name: list_orders
195
+ label: {id: Daftar pesanan berubah}
196
+ request:
197
+ method: GET
198
+ url: https://{auth.api_host}/api/v2/order/get_order_list
199
+ query:
200
+ partner_id: '{auth.partner_id}'
201
+ shop_id: '{auth.shop_id}'
202
+ access_token: '{auth.access_token}'
203
+ time_range_field: update_time
204
+ time_from: '{input.time_from}'
205
+ time_to: '{input.time_to}'
206
+ page_size: '100'
207
+ cursor: '{input.cursor}'
208
+ response_optional_fields: order_status
209
+ input:
210
+ - {name: time_from, type: int, default: "(days_between('1970-01-01', today()) - 2) * 86400", help: {id: 'Detik epoch (UTC)'}}
211
+ - {name: time_to, type: int, default: "(days_between('1970-01-01', today()) + 1) * 86400", help: {id: 'Detik epoch (UTC), paling jauh 15 hari dari time_from'}}
212
+ - {name: cursor, type: data, help: {id: 'next_cursor dari halaman sebelumnya'}}
213
+ output: {orders: response.order_list, more: response.more, next: response.next_cursor}
214
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
215
+ allow_secret_in: [query]
216
+ # GET v2.order.get_order_detail: 1 to 50 order numbers (comma-separated). Only the optional fields named here come
217
+ # back; never recipient_address, buyer_username or buyer_user_id.
218
+ - name: get_order_detail
219
+ label: {id: Rincian pesanan}
220
+ request:
221
+ method: GET
222
+ url: https://{auth.api_host}/api/v2/order/get_order_detail
223
+ query:
224
+ partner_id: '{auth.partner_id}'
225
+ shop_id: '{auth.shop_id}'
226
+ access_token: '{auth.access_token}'
227
+ order_sn_list: '{input.order_sn_list}'
228
+ response_optional_fields: item_list,pay_time,total_amount,package_list,shipping_carrier,payment_method,cancel_by,cancel_reason,buyer_cancel_reason,pickup_done_time,fulfillment_flag
229
+ input:
230
+ - {name: order_sn_list, type: data, required: true, help: {id: 'Nomor pesanan Shopee, maksimal 50 dipisah koma'}}
231
+ output: {orders: response.order_list}
232
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
233
+ allow_secret_in: [query]
234
+ # GET v2.payment.get_escrow_list: escrows released in the window, page_size up to 100, page_no from 1.
235
+ - name: list_settlements
236
+ label: {id: Daftar dana cair}
237
+ request:
238
+ method: GET
239
+ url: https://{auth.api_host}/api/v2/payment/get_escrow_list
240
+ query:
241
+ partner_id: '{auth.partner_id}'
242
+ shop_id: '{auth.shop_id}'
243
+ access_token: '{auth.access_token}'
244
+ release_time_from: '{input.release_time_from}'
245
+ release_time_to: '{input.release_time_to}'
246
+ page_size: '100'
247
+ page_no: '{input.page_no}'
248
+ input:
249
+ - {name: release_time_from, type: int, default: "(days_between('1970-01-01', today()) - 2) * 86400", help: {id: 'Detik epoch (UTC)'}}
250
+ - {name: release_time_to, type: int, default: "(days_between('1970-01-01', today()) + 1) * 86400", help: {id: 'Detik epoch (UTC)'}}
251
+ - {name: page_no, type: int, default: '1'}
252
+ output: {escrows: response.escrow_list, more: response.more}
253
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
254
+ allow_secret_in: [query]
255
+ # GET v2.payment.get_escrow_detail: the money breakdown of one order (order_income).
256
+ - name: get_settlement
257
+ label: {id: Rincian dana cair}
258
+ request:
259
+ method: GET
260
+ url: https://{auth.api_host}/api/v2/payment/get_escrow_detail
261
+ query:
262
+ partner_id: '{auth.partner_id}'
263
+ shop_id: '{auth.shop_id}'
264
+ access_token: '{auth.access_token}'
265
+ order_sn: '{input.order_sn}'
266
+ input:
267
+ - {name: order_sn, type: data, required: true}
268
+ output: {settlement: response}
269
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
270
+ allow_secret_in: [query]
271
+ # POST v2.product.update_stock: sets the seller stock of one model of one item to an absolute number (Rangka is the
272
+ # master of stock; never a delta). model_id 0 for an item without variations; no location_id for a shop without
273
+ # warehouses. Shopee refuses a stock below the stock reserved for a promotion. The quantity is the available stock
274
+ # of marketplace/README.md rule 1, pushed only right after a successful order poll that staged every new order.
275
+ # revision (required, unique per push and increasing: the push time in milliseconds) is in the idempotency key, so
276
+ # every new push is sent (5, then 3, then 5 again) while a retry of the same job is sent once. Retries are short:
277
+ # a stale push must never overwrite a newer quantity; a failed push waits for the next poll. A partial
278
+ # failure answers success with failure_list: a flow treats a non-empty failures as a failed push and tells the owner.
279
+ - name: update_stock
280
+ label: {id: Kirim stok ke Shopee}
281
+ request:
282
+ method: POST
283
+ url: https://{auth.api_host}/api/v2/product/update_stock
284
+ query:
285
+ partner_id: '{auth.partner_id}'
286
+ shop_id: '{auth.shop_id}'
287
+ access_token: '{auth.access_token}'
288
+ body:
289
+ item_id: '{input.item_id}'
290
+ stock_list:
291
+ - model_id: '{input.model_id}'
292
+ seller_stock:
293
+ - stock: '{input.stock}'
294
+ input:
295
+ - {name: item_id, type: int, required: true, help: {id: item_id Shopee dari baris pesanan atau daftar produk}}
296
+ - {name: model_id, type: int, default: '0', help: {id: '0 untuk produk tanpa variasi'}}
297
+ - {name: stock, type: int, required: true, help: {id: 'Stok tersedia, angka mutlak'}}
298
+ - {name: revision, type: data, required: true, help: {id: 'Unik untuk setiap kiriman dan terus naik, misalnya waktu kirim dalam milidetik'}}
299
+ output: {success: response.success_list, failures: response.failure_list}
300
+ retry: {max: 2, backoff: fixed, on: [429, 500, 502, 503]}
301
+ idempotency: string(input.item_id) + ':' + string(input.model_id) + ':' + string(input.stock) + ':' + string(input.revision)
302
+ allow_secret_in: [query]
303
+ # GET v2.logistics.get_tracking_number: empty until the 3PL has given one.
304
+ - name: get_tracking
305
+ label: {id: Nomor resi}
306
+ request:
307
+ method: GET
308
+ url: https://{auth.api_host}/api/v2/logistics/get_tracking_number
309
+ query:
310
+ partner_id: '{auth.partner_id}'
311
+ shop_id: '{auth.shop_id}'
312
+ access_token: '{auth.access_token}'
313
+ order_sn: '{input.order_sn}'
314
+ package_number: '{input.package_number}'
315
+ input:
316
+ - {name: order_sn, type: data, required: true}
317
+ - {name: package_number, type: data}
318
+ output: {tracking_number: response.tracking_number}
319
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
320
+ allow_secret_in: [query]
321
+ # GET v2.product.get_item_list: items by offset, up to 100 per page (NORMAL items only).
322
+ - name: list_items
323
+ label: {id: Daftar produk Shopee}
324
+ request:
325
+ method: GET
326
+ url: https://{auth.api_host}/api/v2/product/get_item_list
327
+ query:
328
+ partner_id: '{auth.partner_id}'
329
+ shop_id: '{auth.shop_id}'
330
+ access_token: '{auth.access_token}'
331
+ offset: '{input.offset}'
332
+ page_size: '100'
333
+ item_status: NORMAL
334
+ input:
335
+ - {name: offset, type: int, default: '0'}
336
+ output: {items: response.item, more: response.has_next_page, next_offset: response.next_offset, total: response.total_count}
337
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
338
+ allow_secret_in: [query]
339
+ # GET v2.product.get_model_list: the variations of one item, each with model_sku and its stock
340
+ # (stock_info_v2.seller_stock, summary_info.total_reserved_stock).
341
+ - name: get_models
342
+ label: {id: Variasi produk Shopee}
343
+ request:
344
+ method: GET
345
+ url: https://{auth.api_host}/api/v2/product/get_model_list
346
+ query:
347
+ partner_id: '{auth.partner_id}'
348
+ shop_id: '{auth.shop_id}'
349
+ access_token: '{auth.access_token}'
350
+ item_id: '{input.item_id}'
351
+ input:
352
+ - {name: item_id, type: int, required: true}
353
+ output: {models: response.model, tiers: response.tier_variation}
354
+ retry: {max: 5, backoff: exponential, on: [429, 500, 502, 503]}
355
+ allow_secret_in: [query]
356
+ limits:
357
+ rate: 'not published by Shopee: HTTP 429 error_rate_limit, a daily quota (error_limit, reset 00:00 UTC+8), success rate above 90%'
358
+ # Seller In House System: Mall, Managed, or at least 30 orders in 30 days in ID; review about 7 working days, then
359
+ # 24 hours for go-live. The sandbox works with the test partner before go-live.
360
+ note: {id: 'Perlu akun developer Shopee (Seller In House System: toko Mall, Managed, atau 30 pesanan dalam 30 hari). Uji dulu di sandbox'}
@@ -0,0 +1,119 @@
1
+ {
2
+ "order_changed.json": {
3
+ "channel": "shopee",
4
+ "storefront": "SHOPEE",
5
+ "order_id": "261118TC00001A",
6
+ "status": "READY_TO_SHIP",
7
+ "sold": true,
8
+ "shipped": false,
9
+ "completed": false,
10
+ "cancelled": false,
11
+ "created_at": 1794960600,
12
+ "paid_at": 1794960720,
13
+ "updated_at": 1794960780,
14
+ "currency": "IDR",
15
+ "buyer_total": 56000
16
+ },
17
+ "order_changed_unpaid.json": {
18
+ "channel": "shopee",
19
+ "storefront": "SHOPEE",
20
+ "order_id": "261118TC00002B",
21
+ "status": "UNPAID",
22
+ "sold": false,
23
+ "shipped": false,
24
+ "completed": false,
25
+ "cancelled": false,
26
+ "created_at": 1794962400,
27
+ "paid_at": null,
28
+ "updated_at": 1794962400,
29
+ "currency": "IDR",
30
+ "buyer_total": null
31
+ },
32
+ "order_changed_in_cancel.json": {
33
+ "channel": "shopee",
34
+ "storefront": "SHOPEE",
35
+ "order_id": "261117TC00003C",
36
+ "status": "IN_CANCEL",
37
+ "sold": false,
38
+ "shipped": false,
39
+ "completed": false,
40
+ "cancelled": false,
41
+ "created_at": 1794917100,
42
+ "paid_at": 1794917160,
43
+ "updated_at": 1794959400,
44
+ "currency": "IDR",
45
+ "buyer_total": 45000
46
+ },
47
+ "order_changed_cancelled.json": {
48
+ "channel": "shopee",
49
+ "storefront": "SHOPEE",
50
+ "order_id": "261117TC00004D",
51
+ "status": "CANCELLED",
52
+ "sold": false,
53
+ "shipped": false,
54
+ "completed": false,
55
+ "cancelled": true,
56
+ "created_at": 1794920400,
57
+ "paid_at": 1794920460,
58
+ "updated_at": 1794961200,
59
+ "currency": "IDR",
60
+ "buyer_total": 69000
61
+ },
62
+ "order_changed_completed.json": {
63
+ "channel": "shopee",
64
+ "storefront": "SHOPEE",
65
+ "order_id": "261116TC00005E",
66
+ "status": "COMPLETED",
67
+ "sold": true,
68
+ "shipped": true,
69
+ "completed": true,
70
+ "cancelled": false,
71
+ "created_at": 1794790800,
72
+ "paid_at": 1794790920,
73
+ "updated_at": 1794964800,
74
+ "currency": "IDR",
75
+ "buyer_total": 89000
76
+ },
77
+ "order_settled.json": {
78
+ "channel": "shopee",
79
+ "order_id": "261116TC00005E",
80
+ "currency": "IDR",
81
+ "settled_at": 1794965400,
82
+ "net": 64295,
83
+ "adjusted_net": 64295,
84
+ "commission_fee": 6320,
85
+ "service_fee": 3160,
86
+ "transaction_fee": 1580,
87
+ "withheld_tax": 395
88
+ },
89
+ "push_received.json": {
90
+ "shop_id": 880001,
91
+ "code": 3,
92
+ "order_id": "261118TC00001A",
93
+ "status": "READY_TO_SHIP",
94
+ "updated_at": 1794960780,
95
+ "sent_at": 1794960780
96
+ },
97
+ "push_received_tracking.json": {
98
+ "shop_id": 880001,
99
+ "code": 4,
100
+ "order_id": "261116TC00005E",
101
+ "status": null,
102
+ "updated_at": null,
103
+ "sent_at": 1794809400
104
+ },
105
+ "list_orders.json": {
106
+ "more": false,
107
+ "next": ""
108
+ },
109
+ "list_settlements.json": {
110
+ "more": false
111
+ },
112
+ "get_tracking.json": {
113
+ "tracking_number": "SPXID0261116005E"
114
+ },
115
+ "list_items.json": {
116
+ "more": false,
117
+ "total": 2
118
+ }
119
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "error": "",
3
+ "message": "",
4
+ "request_id": "00000000000000000000000000000008",
5
+ "response": {
6
+ "tier_variation": [
7
+ {
8
+ "name": "Rasa",
9
+ "option_list": [
10
+ {
11
+ "option": "Pedas"
12
+ }
13
+ ]
14
+ }
15
+ ],
16
+ "model": [
17
+ {
18
+ "model_id": 4002001,
19
+ "tier_index": [
20
+ 0
21
+ ],
22
+ "model_sku": "TH-PDS",
23
+ "model_status": "MODEL_NORMAL",
24
+ "promotion_id": 0,
25
+ "has_promotion": false,
26
+ "price_info": [
27
+ {
28
+ "currency": "IDR",
29
+ "current_price": 16000,
30
+ "original_price": 18000
31
+ }
32
+ ],
33
+ "stock_info_v2": {
34
+ "summary_info": {
35
+ "total_reserved_stock": 2,
36
+ "total_available_stock": 25
37
+ },
38
+ "seller_stock": [
39
+ {
40
+ "location_id": "IDZ",
41
+ "stock": 25,
42
+ "if_saleable": true
43
+ }
44
+ ],
45
+ "shopee_stock": []
46
+ },
47
+ "weight": 0.25,
48
+ "is_fulfillment_by_shopee": false
49
+ }
50
+ ]
51
+ }
52
+ }