cabloy 5.1.122 → 5.1.124

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 (244) hide show
  1. package/.cabloy-version +1 -1
  2. package/.claude/skills/cabloy-frontend-scaffold/SKILL.md +13 -3
  3. package/.claude/skills/cabloy-workflow/SKILL.md +6 -0
  4. package/.claude/skills/cabloy-workflow/evals/evals.json +6 -0
  5. package/CHANGELOG.md +24 -0
  6. package/CLAUDE.md +1 -1
  7. package/cabloy-docs/.vitepress/config.mjs +4 -0
  8. package/cabloy-docs/frontend/form-layout-guide.md +29 -7
  9. package/cabloy-docs/fullstack/parallel-worktree-environment.md +87 -0
  10. package/e2e/scripts/e2e.ts +13 -1
  11. package/e2e/scripts/startE2eVona.ts +4 -1
  12. package/e2e/specs/a-commerce/commerce.spec.ts +129 -32
  13. package/package.json +2 -1
  14. package/playwright-report/data/24ac790ec112339c76cfb0c8e2c2539c2f953a0b.zip +0 -0
  15. package/playwright-report/data/2fddcabcdbd0b695061a565acfff243cb3a4f5e3.zip +0 -0
  16. package/playwright-report/data/4738038d9e861d63fd25937c9a3570934786a62f.zip +0 -0
  17. package/playwright-report/data/72f99c7da67c7f6ea53cab7d8681798b70d79a10.md +222 -0
  18. package/playwright-report/data/7b9684a7c793e9798b898f8ff50177b660a7a733.md +222 -0
  19. package/playwright-report/data/8b31595f5f1cc9d23863af51a592e6b90dcbc4ce.zip +0 -0
  20. package/playwright-report/data/95b578407a68806202dda917a61c50c750bd285b.md +222 -0
  21. package/playwright-report/data/ad960b3a58f224f5b4cad04a24067600064ffb7b.md +222 -0
  22. package/playwright-report/index.html +90 -0
  23. package/playwright-report/trace/assets/codeMirrorModule-LEHpjmcn.js +32 -0
  24. package/playwright-report/trace/assets/defaultSettingsView-BNmKHKpQ.js +264 -0
  25. package/playwright-report/trace/assets/urlMatch-BYQrIQwR.js +1 -0
  26. package/playwright-report/trace/codeMirrorModule.DYBRYzYX.css +1 -0
  27. package/playwright-report/trace/codicon.DCmgc-ay.ttf +0 -0
  28. package/playwright-report/trace/defaultSettingsView.CjdS-WJx.css +1 -0
  29. package/playwright-report/trace/index.CzXZzn5A.css +1 -0
  30. package/playwright-report/trace/index.DMMX1gXU.js +2 -0
  31. package/playwright-report/trace/index.html +44 -0
  32. package/playwright-report/trace/manifest.webmanifest +16 -0
  33. package/playwright-report/trace/playwright-logo.svg +9 -0
  34. package/playwright-report/trace/snapshot.html +10 -0
  35. package/playwright-report/trace/snapshot.v8KI4P3m.js +2 -0
  36. package/playwright-report/trace/sw.bundle.js +5 -0
  37. package/playwright-report/trace/uiMode.BZQ54Kgt.css +1 -0
  38. package/playwright-report/trace/uiMode.Ut8wwJNp.js +6 -0
  39. package/playwright-report/trace/uiMode.html +18 -0
  40. package/playwright-report/trace/xtermModule.DYP7pi_n.css +32 -0
  41. package/vona/env/.env +12 -0
  42. package/vona/env/.env.test +7 -0
  43. package/vona/packages-cli/cli/package.json +1 -1
  44. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}Create.tsx_ +19 -1
  45. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}Update.tsx_ +19 -1
  46. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}View.tsx_ +19 -1
  47. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/3-en-us.ts +6 -1
  48. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/4-zh-cn.ts +6 -1
  49. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}Create.tsx_ +19 -1
  50. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}Update.tsx_ +19 -1
  51. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}View.tsx_ +19 -1
  52. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/3-en-us.ts +6 -1
  53. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/4-zh-cn.ts +6 -1
  54. package/vona/packages-cli/cli-set-api/package.json +1 -1
  55. package/vona/pnpm-lock.yaml +255 -12
  56. package/vona/pnpm-workspace.yaml +1 -1
  57. package/vona/src/suite/a-commerce/modules/commerce-payment/package.json +4 -1
  58. package/vona/src/suite/a-commerce/modules/commerce-payment/src/.metadata/index.ts +45 -3
  59. package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.index.ts +1 -0
  60. package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.version.ts +25 -1
  61. package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/payScene.commerceOrder.ts +20 -0
  62. package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/paymentAttempt.tsx +9 -0
  63. package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/paymentAudit.tsx +5 -2
  64. package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/refundAttempt.tsx +6 -0
  65. package/vona/src/suite/a-commerce/modules/commerce-payment/src/index.ts +2 -0
  66. package/vona/src/suite/a-commerce/modules/commerce-payment/src/lib/index.ts +1 -0
  67. package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/commercePayScene.ts +54 -0
  68. package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/paymentAttempt.ts +7 -1
  69. package/vona/src/suite/a-commerce/modules/commerce-payment/src/types/index.ts +1 -0
  70. package/vona/src/suite/a-commerce/modules/commerce-payment/test/paymentAttempt.test.ts +21 -0
  71. package/vona/src/suite/a-commerce/modules/commerce-promotion/src/.metadata/index.ts +30 -0
  72. package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/en-us.ts +4 -0
  73. package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/zh-cn.ts +4 -0
  74. package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateCreate.tsx +88 -1
  75. package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateUpdate.tsx +44 -1
  76. package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateView.tsx +72 -1
  77. package/vona/src/suite/a-commerce/modules/commerce-promotion/test/couponTemplateFormLayout.test.ts +121 -0
  78. package/vona/src/suite/a-commerce/modules/commerce-siteweb/src/bean/ssrMenu.home.ts +4 -1
  79. package/vona/src/suite/a-commerce/modules/commerce-trade/package.json +4 -1
  80. package/vona/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +0 -21
  81. package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutResult.tsx +3 -0
  82. package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/order.ts +79 -0
  83. package/vona/src/suite/a-commerce/modules/commerce-trade/test/orderSnapshot.test.ts +227 -0
  84. package/vona/src/suite/a-commerce/modules/commerce-trade/test/paymentOutcome.test.ts +121 -13
  85. package/vona/src/suite/a-commerce/modules/commerce-trade/test/refundLifecycle.test.ts +312 -0
  86. package/vona/src/suite-vendor/a-pay/modules/a-pay/package.json +76 -0
  87. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/index.ts +842 -0
  88. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/this.ts +2 -0
  89. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/bean.payProvider.ts +92 -0
  90. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/bean.payScene.ts +105 -0
  91. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.index.ts +28 -0
  92. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.redlock.ts +11 -0
  93. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.version.ts +113 -0
  94. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/queue.outboxDispatch.ts +31 -0
  95. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/schedule.outboxDispatch.ts +11 -0
  96. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/paymentSession.ts +55 -0
  97. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/webhook.ts +47 -0
  98. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/dto/paymentSessionStart.tsx +8 -0
  99. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/dto/paymentSessionView.tsx +69 -0
  100. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/dto/webhookReceipt.tsx +12 -0
  101. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/outboxEvent.tsx +46 -0
  102. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/paymentAudit.tsx +36 -0
  103. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/paymentSession.tsx +72 -0
  104. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/providerOperation.tsx +54 -0
  105. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/refundOperation.tsx +37 -0
  106. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/webhookInbox.tsx +59 -0
  107. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/index.ts +3 -0
  108. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/lib/index.ts +2 -0
  109. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/lib/payProvider.ts +7 -0
  110. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/lib/payScene.ts +7 -0
  111. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/outboxEvent.ts +10 -0
  112. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentAudit.ts +10 -0
  113. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentSession.ts +10 -0
  114. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/providerOperation.ts +10 -0
  115. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/refundOperation.ts +10 -0
  116. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/webhookInbox.ts +10 -0
  117. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/outbox.ts +156 -0
  118. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentSession.ts +278 -0
  119. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/providerOperation.ts +5 -0
  120. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/webhook.ts +127 -0
  121. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/index.ts +3 -0
  122. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payProvider.ts +74 -0
  123. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payScene.ts +63 -0
  124. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payment.ts +151 -0
  125. package/vona/src/suite-vendor/a-pay/modules/a-pay/test/outbox.test.ts +209 -0
  126. package/vona/src/suite-vendor/a-pay/modules/a-pay/test/paymentSession.test.ts +153 -0
  127. package/vona/src/suite-vendor/a-pay/modules/a-pay/test/webhook.test.ts +278 -0
  128. package/vona/src/suite-vendor/a-pay/modules/a-pay/tsconfig.build.json +11 -0
  129. package/vona/src/suite-vendor/a-pay/modules/a-pay/tsconfig.json +7 -0
  130. package/vona/src/suite-vendor/a-pay/modules/pay-mock/package.json +55 -0
  131. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/index.ts +182 -0
  132. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/this.ts +2 -0
  133. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/bean/payProvider.mock.ts +149 -0
  134. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/controller/mockPayment.ts +25 -0
  135. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/dto/mockPaymentComplete.tsx +13 -0
  136. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/dto/mockPaymentReceipt.tsx +16 -0
  137. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/index.ts +3 -0
  138. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/lib/index.ts +1 -0
  139. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/service/payMock.ts +78 -0
  140. package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/types/index.ts +10 -0
  141. package/vona/src/suite-vendor/a-pay/modules/pay-mock/test/payMock.test.ts +141 -0
  142. package/vona/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.build.json +11 -0
  143. package/vona/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.json +7 -0
  144. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/package.json +55 -0
  145. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/index.ts +62 -0
  146. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/this.ts +2 -0
  147. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/bean/payProvider.paypal.ts +91 -0
  148. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/index.ts +3 -0
  149. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/lib/index.ts +1 -0
  150. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/types/index.ts +9 -0
  151. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.build.json +11 -0
  152. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.json +7 -0
  153. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/package.json +55 -0
  154. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/index.ts +62 -0
  155. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/this.ts +2 -0
  156. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/bean/payProvider.stripe.ts +88 -0
  157. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/index.ts +2 -0
  158. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/types/index.ts +8 -0
  159. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.build.json +11 -0
  160. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.json +7 -0
  161. package/vona/src/suite-vendor/a-pay/package.json +15 -0
  162. package/vona/src/suite-vendor/a-pay/tsconfig.base.json +4 -0
  163. package/vona/src/suite-vendor/a-pay/tsconfig.json +19 -0
  164. package/zova/env/.env +1 -0
  165. package/zova/openapi.config.ts +5 -1
  166. package/zova/package.original.json +1 -1
  167. package/zova/packages-cli/cli/package.json +2 -2
  168. package/zova/packages-cli/cli-set-front/cli/templates/openapi/config/boilerplate/project/openapi.config.ts +5 -1
  169. package/zova/packages-cli/cli-set-front/package.json +1 -1
  170. package/zova/packages-cli/cli-set-front/src/lib/bean/cli.openapi.generate.ts +8 -0
  171. package/zova/packages-cli/cli-set-front/src/lib/common/cliCreatePage.ts +7 -24
  172. package/zova/packages-cli/cli-set-front/src/lib/common/utils.ts +10 -1
  173. package/zova/packages-utils/zova-jsx/package.json +2 -2
  174. package/zova/packages-zova/zova/package.json +3 -3
  175. package/zova/packages-zova/zova-core/package.json +1 -1
  176. package/zova/packages-zova/zova-core/src/types/interface/component.ts +5 -0
  177. package/zova/pnpm-lock.yaml +96 -26
  178. package/zova/src/front/config/config/config.cabloyCommerce.ts +1 -1
  179. package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/schemas.ts +110 -12
  180. package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/types.ts +1292 -160
  181. package/zova/src/suite/a-commerce/modules/commerce-trade/cli/openapi.config.ts +0 -1
  182. package/zova/src/suite/a-commerce/modules/commerce-trade/package.json +4 -1
  183. package/zova/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +1 -47
  184. package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +23 -8
  185. package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +249 -62
  186. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/checkout/controller.tsx +5 -1
  187. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/payment/controller.tsx +152 -39
  188. package/zova/src/suite/a-commerce/modules/commerce-trade/src/routes.ts +1 -1
  189. package/zova/src/suite-vendor/a-pay/modules/a-pay/cli/openapi.config.ts +9 -0
  190. package/zova/src/suite-vendor/a-pay/modules/a-pay/package.json +53 -0
  191. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/component/paymentNextAction.ts +31 -0
  192. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/index.ts +217 -0
  193. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/this.ts +2 -0
  194. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/baseURL.ts +5 -0
  195. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/index.ts +3 -0
  196. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/schemas.ts +584 -0
  197. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/types.ts +9324 -0
  198. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/paymentSession.ts +52 -0
  199. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/apiSchema/paymentSession.ts +20 -0
  200. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/component/paymentNextAction/controller.tsx +76 -0
  201. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/index.ts +3 -0
  202. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/lib/index.ts +1 -0
  203. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentSession.ts +32 -0
  204. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentCoordinator.ts +13 -0
  205. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/types/index.ts +1 -0
  206. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/types/payment.ts +25 -0
  207. package/zova/src/suite-vendor/a-pay/modules/a-pay/tsconfig.build.json +13 -0
  208. package/zova/src/suite-vendor/a-pay/modules/a-pay/tsconfig.json +5 -0
  209. package/zova/src/suite-vendor/a-pay/modules/pay-mock/cli/openapi.config.ts +9 -0
  210. package/zova/src/suite-vendor/a-pay/modules/pay-mock/package.json +53 -0
  211. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/index.ts +140 -0
  212. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/this.ts +2 -0
  213. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/baseURL.ts +5 -0
  214. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/index.ts +3 -0
  215. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/schemas.ts +584 -0
  216. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/types.ts +9324 -0
  217. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/payMockPayment.ts +34 -0
  218. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/apiSchema/payMockPayment.ts +13 -0
  219. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/index.ts +1 -0
  220. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/model/payMockPayment.ts +20 -0
  221. package/zova/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.build.json +13 -0
  222. package/zova/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.json +5 -0
  223. package/zova/src/suite-vendor/a-pay/modules/pay-paypal/package.json +52 -0
  224. package/zova/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/index.ts +26 -0
  225. package/zova/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/this.ts +2 -0
  226. package/zova/src/suite-vendor/a-pay/modules/pay-paypal/src/index.ts +1 -0
  227. package/zova/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.build.json +13 -0
  228. package/zova/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.json +5 -0
  229. package/zova/src/suite-vendor/a-pay/modules/pay-stripe/package.json +52 -0
  230. package/zova/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/index.ts +26 -0
  231. package/zova/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/this.ts +2 -0
  232. package/zova/src/suite-vendor/a-pay/modules/pay-stripe/src/index.ts +1 -0
  233. package/zova/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.build.json +13 -0
  234. package/zova/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.json +5 -0
  235. package/zova/src/suite-vendor/a-pay/package.json +15 -0
  236. package/zova/src/suite-vendor/a-pay/tsconfig.base.json +4 -0
  237. package/zova/src/suite-vendor/a-pay/tsconfig.json +4 -0
  238. package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
  239. package/zova/src/suite-vendor/a-zova/package.json +2 -2
  240. package/vona/src/suite/a-commerce/modules/commerce-trade/src/controller/payment.ts +0 -23
  241. package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/commerceTradePayment.ts +0 -36
  242. package/zova/src/suite/a-commerce/modules/commerce-trade/src/apiSchema/commerceTradePayment.ts +0 -13
  243. package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/payment.ts +0 -25
  244. /package/vona/patches/{zova-core@5.1.79.patch → zova-core@5.1.81.patch} +0 -0
@@ -0,0 +1,72 @@
1
+ import type { TableIdentity } from 'table-identity';
2
+ import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
3
+
4
+ import { Api, v } from 'vona-module-a-openapiutils';
5
+ import { Entity, EntityBase } from 'vona-module-a-orm';
6
+ import { z } from 'zod';
7
+
8
+ import type { TypePaymentNextAction, TypePaymentSessionState } from '../types/payment.ts';
9
+
10
+ export interface IEntityOptionsPaymentSession extends IDecoratorEntityOptions {}
11
+
12
+ @Entity<IEntityOptionsPaymentSession>('payPaymentSession')
13
+ export class EntityPaymentSession extends EntityBase {
14
+ @Api.field(v.tableIdentity())
15
+ userId: TableIdentity;
16
+
17
+ @Api.field(z.string())
18
+ payScene: string;
19
+
20
+ @Api.field(v.required(), v.min(1), v.max(100))
21
+ businessReference: string;
22
+
23
+ @Api.field(z.string())
24
+ providerName: string;
25
+
26
+ @Api.field(v.required(), v.min(1), v.max(100))
27
+ clientName: string;
28
+
29
+ @Api.field(z.enum(['sandbox', 'live']))
30
+ environment: 'sandbox' | 'live';
31
+
32
+ @Api.field(z.number().int().nonnegative())
33
+ amountMinor: number;
34
+
35
+ @Api.field(v.required(), v.min(3), v.max(3))
36
+ currency: string;
37
+
38
+ @Api.field(
39
+ z.enum([
40
+ 'created',
41
+ 'starting',
42
+ 'requires_action',
43
+ 'processing',
44
+ 'succeeded',
45
+ 'failed',
46
+ 'cancelled',
47
+ 'expired',
48
+ ]),
49
+ )
50
+ state: TypePaymentSessionState;
51
+
52
+ @Api.field(v.optional())
53
+ nextAction?: TypePaymentNextAction;
54
+
55
+ @Api.field(v.optional(), v.max(255))
56
+ providerPaymentId?: string;
57
+
58
+ @Api.field(v.optional(), v.max(255))
59
+ providerOrderId?: string;
60
+
61
+ @Api.field(v.optional(), v.max(255))
62
+ providerCaptureId?: string;
63
+
64
+ @Api.field(v.required(), v.min(1), v.max(100))
65
+ correlationId: string;
66
+
67
+ @Api.field(v.required())
68
+ expiresAt: Date;
69
+
70
+ @Api.field(v.optional())
71
+ finalizedAt?: Date;
72
+ }
@@ -0,0 +1,54 @@
1
+ import type { TableIdentity } from 'table-identity';
2
+ import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
3
+
4
+ import { Api, v } from 'vona-module-a-openapiutils';
5
+ import { Entity, EntityBase } from 'vona-module-a-orm';
6
+ import { z } from 'zod';
7
+
8
+ import type { TypeProviderOperationKind, TypeProviderOperationState } from '../types/payment.ts';
9
+
10
+ export interface IEntityOptionsProviderOperation extends IDecoratorEntityOptions {}
11
+
12
+ @Entity<IEntityOptionsProviderOperation>('payProviderOperation')
13
+ export class EntityProviderOperation extends EntityBase {
14
+ @Api.field(v.tableIdentity())
15
+ paymentSessionId: TableIdentity;
16
+
17
+ @Api.field(z.enum(['start', 'confirm', 'query', 'refund']))
18
+ kind: TypeProviderOperationKind;
19
+
20
+ @Api.field(
21
+ z.enum(['created', 'claimed', 'submitted', 'succeeded', 'failed', 'reconciliation_required']),
22
+ )
23
+ state: TypeProviderOperationState;
24
+
25
+ @Api.field(v.required(), v.min(1), v.max(100))
26
+ idempotencyKey: string;
27
+
28
+ @Api.field(v.required(), v.min(1), v.max(100))
29
+ correlationId: string;
30
+
31
+ @Api.field(v.optional(), v.max(255))
32
+ providerRequestId?: string;
33
+
34
+ @Api.field(v.optional(), v.max(255))
35
+ providerResourceId?: string;
36
+
37
+ @Api.field(z.number().int().nonnegative())
38
+ attemptCount: number;
39
+
40
+ @Api.field(v.optional())
41
+ claimedAt?: Date;
42
+
43
+ @Api.field(v.optional())
44
+ nextAttemptAt?: Date;
45
+
46
+ @Api.field(v.optional(), v.max(100))
47
+ errorCode?: string;
48
+
49
+ @Api.field(v.optional(), v.max(255))
50
+ errorSummary?: string;
51
+
52
+ @Api.field(v.optional())
53
+ finalizedAt?: Date;
54
+ }
@@ -0,0 +1,37 @@
1
+ import type { TableIdentity } from 'table-identity';
2
+ import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
3
+
4
+ import { Api, v } from 'vona-module-a-openapiutils';
5
+ import { Entity, EntityBase } from 'vona-module-a-orm';
6
+ import { z } from 'zod';
7
+
8
+ import type { TypeRefundOperationState } from '../types/payment.ts';
9
+
10
+ export interface IEntityOptionsRefundOperation extends IDecoratorEntityOptions {}
11
+
12
+ @Entity<IEntityOptionsRefundOperation>('payRefundOperation')
13
+ export class EntityRefundOperation extends EntityBase {
14
+ @Api.field(v.tableIdentity())
15
+ paymentSessionId: TableIdentity;
16
+
17
+ @Api.field(v.required(), v.min(1), v.max(100))
18
+ businessReference: string;
19
+
20
+ @Api.field(z.number().int().positive())
21
+ amountMinor: number;
22
+
23
+ @Api.field(v.required(), v.min(3), v.max(3))
24
+ currency: string;
25
+
26
+ @Api.field(z.enum(['created', 'submitting', 'pending', 'succeeded', 'failed', 'cancelled']))
27
+ state: TypeRefundOperationState;
28
+
29
+ @Api.field(v.required(), v.min(1), v.max(100))
30
+ idempotencyKey: string;
31
+
32
+ @Api.field(v.optional(), v.max(255))
33
+ providerRefundId?: string;
34
+
35
+ @Api.field(v.optional())
36
+ finalizedAt?: Date;
37
+ }
@@ -0,0 +1,59 @@
1
+ import type { TableIdentity } from 'table-identity';
2
+ import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
3
+
4
+ import { Api, v } from 'vona-module-a-openapiutils';
5
+ import { Entity, EntityBase } from 'vona-module-a-orm';
6
+ import { z } from 'zod';
7
+
8
+ export interface IEntityOptionsWebhookInbox extends IDecoratorEntityOptions {}
9
+
10
+ @Entity<IEntityOptionsWebhookInbox>('payWebhookInbox')
11
+ export class EntityWebhookInbox extends EntityBase {
12
+ @Api.field(v.required(), v.min(1), v.max(100))
13
+ providerName: string;
14
+
15
+ @Api.field(v.required(), v.min(1), v.max(100))
16
+ clientName: string;
17
+
18
+ @Api.field(z.enum(['sandbox', 'live']))
19
+ environment: 'sandbox' | 'live';
20
+
21
+ @Api.field(v.required(), v.min(1), v.max(255))
22
+ providerEventId: string;
23
+
24
+ @Api.field(v.required(), v.min(1), v.max(100))
25
+ eventType: string;
26
+
27
+ @Api.field(v.optional(), v.tableIdentity())
28
+ paymentSessionId?: TableIdentity;
29
+
30
+ @Api.field(v.optional(), v.tableIdentity())
31
+ refundOperationId?: TableIdentity;
32
+
33
+ @Api.field(v.optional(), z.enum(['succeeded', 'failed', 'cancelled']))
34
+ paymentState?: 'succeeded' | 'failed' | 'cancelled';
35
+
36
+ @Api.field(v.optional(), z.number().int().nonnegative())
37
+ amountMinor?: number;
38
+
39
+ @Api.field(v.optional(), v.min(3), v.max(3))
40
+ currency?: string;
41
+
42
+ @Api.field(v.optional(), v.max(255))
43
+ providerCaptureId?: string;
44
+
45
+ @Api.field(v.required(), v.min(64), v.max(64))
46
+ payloadHash: string;
47
+
48
+ @Api.field(z.enum(['received', 'processed', 'failed']))
49
+ state: 'received' | 'processed' | 'failed';
50
+
51
+ @Api.field(z.number().int().nonnegative())
52
+ retryCount: number;
53
+
54
+ @Api.field(v.optional())
55
+ processedAt?: Date;
56
+
57
+ @Api.field(v.optional(), v.max(255))
58
+ errorSummary?: string;
59
+ }
@@ -0,0 +1,3 @@
1
+ export * from './lib/index.ts';
2
+ export * from './types/index.ts';
3
+ export * from './.metadata/index.ts';
@@ -0,0 +1,2 @@
1
+ export * from './payProvider.ts';
2
+ export * from './payScene.ts';
@@ -0,0 +1,7 @@
1
+ import { createBeanDecorator } from 'vona';
2
+
3
+ import type { IDecoratorPayProviderOptions } from '../types/payProvider.ts';
4
+
5
+ export function PayProvider<T extends IDecoratorPayProviderOptions>(options?: T): ClassDecorator {
6
+ return createBeanDecorator('payProvider', options);
7
+ }
@@ -0,0 +1,7 @@
1
+ import { createBeanDecorator } from 'vona';
2
+
3
+ import type { IDecoratorPaySceneOptions } from '../types/payScene.ts';
4
+
5
+ export function PayScene(options?: IDecoratorPaySceneOptions): ClassDecorator {
6
+ return createBeanDecorator('payScene', options);
7
+ }
@@ -0,0 +1,10 @@
1
+ import type { IDecoratorModelOptions } from 'vona-module-a-orm';
2
+
3
+ import { BeanModelBase, Model } from 'vona-module-a-orm';
4
+
5
+ import { EntityOutboxEvent } from '../entity/outboxEvent.tsx';
6
+
7
+ export interface IModelOptionsOutboxEvent extends IDecoratorModelOptions<EntityOutboxEvent> {}
8
+
9
+ @Model<IModelOptionsOutboxEvent>({ entity: EntityOutboxEvent })
10
+ export class ModelOutboxEvent extends BeanModelBase<EntityOutboxEvent> {}
@@ -0,0 +1,10 @@
1
+ import type { IDecoratorModelOptions } from 'vona-module-a-orm';
2
+
3
+ import { BeanModelBase, Model } from 'vona-module-a-orm';
4
+
5
+ import { EntityPaymentAudit } from '../entity/paymentAudit.tsx';
6
+
7
+ export interface IModelOptionsPaymentAudit extends IDecoratorModelOptions<EntityPaymentAudit> {}
8
+
9
+ @Model<IModelOptionsPaymentAudit>({ entity: EntityPaymentAudit })
10
+ export class ModelPaymentAudit extends BeanModelBase<EntityPaymentAudit> {}
@@ -0,0 +1,10 @@
1
+ import type { IDecoratorModelOptions } from 'vona-module-a-orm';
2
+
3
+ import { BeanModelBase, Model } from 'vona-module-a-orm';
4
+
5
+ import { EntityPaymentSession } from '../entity/paymentSession.tsx';
6
+
7
+ export interface IModelOptionsPaymentSession extends IDecoratorModelOptions<EntityPaymentSession> {}
8
+
9
+ @Model<IModelOptionsPaymentSession>({ entity: EntityPaymentSession })
10
+ export class ModelPaymentSession extends BeanModelBase<EntityPaymentSession> {}
@@ -0,0 +1,10 @@
1
+ import type { IDecoratorModelOptions } from 'vona-module-a-orm';
2
+
3
+ import { BeanModelBase, Model } from 'vona-module-a-orm';
4
+
5
+ import { EntityProviderOperation } from '../entity/providerOperation.tsx';
6
+
7
+ export interface IModelOptionsProviderOperation extends IDecoratorModelOptions<EntityProviderOperation> {}
8
+
9
+ @Model<IModelOptionsProviderOperation>({ entity: EntityProviderOperation })
10
+ export class ModelProviderOperation extends BeanModelBase<EntityProviderOperation> {}
@@ -0,0 +1,10 @@
1
+ import type { IDecoratorModelOptions } from 'vona-module-a-orm';
2
+
3
+ import { BeanModelBase, Model } from 'vona-module-a-orm';
4
+
5
+ import { EntityRefundOperation } from '../entity/refundOperation.tsx';
6
+
7
+ export interface IModelOptionsRefundOperation extends IDecoratorModelOptions<EntityRefundOperation> {}
8
+
9
+ @Model<IModelOptionsRefundOperation>({ entity: EntityRefundOperation })
10
+ export class ModelRefundOperation extends BeanModelBase<EntityRefundOperation> {}
@@ -0,0 +1,10 @@
1
+ import type { IDecoratorModelOptions } from 'vona-module-a-orm';
2
+
3
+ import { BeanModelBase, Model } from 'vona-module-a-orm';
4
+
5
+ import { EntityWebhookInbox } from '../entity/webhookInbox.tsx';
6
+
7
+ export interface IModelOptionsWebhookInbox extends IDecoratorModelOptions<EntityWebhookInbox> {}
8
+
9
+ @Model<IModelOptionsWebhookInbox>({ entity: EntityWebhookInbox })
10
+ export class ModelWebhookInbox extends BeanModelBase<EntityWebhookInbox> {}
@@ -0,0 +1,156 @@
1
+ import type { TableIdentity } from 'table-identity';
2
+
3
+ import { randomUUID } from 'node:crypto';
4
+ import { BeanBase } from 'vona';
5
+ import { Service } from 'vona-module-a-bean';
6
+ import { Core } from 'vona-module-a-core';
7
+
8
+ import type { IPaymentOutcomeEvent } from '../types/payment.ts';
9
+
10
+ const ClaimLeaseMilliseconds = 60_000;
11
+ const MaxAttempts = 10;
12
+
13
+ @Service()
14
+ export class ServiceOutbox extends BeanBase {
15
+ async enqueue(
16
+ paymentSessionId: TableIdentity,
17
+ eventType: 'payment.outcome.v1',
18
+ payload: IPaymentOutcomeEvent,
19
+ ) {
20
+ const event = await this.scope.model.outboxEvent.insert({
21
+ eventType,
22
+ paymentSessionId,
23
+ payload,
24
+ state: 'pending',
25
+ attemptCount: 0,
26
+ nextAttemptAt: new Date(),
27
+ });
28
+ if (!this.app.meta.isTest) {
29
+ this.ctx.db.commit(() => {
30
+ this.scope.queue.outboxDispatch.push({ outboxEventId: event.id });
31
+ });
32
+ }
33
+ return event;
34
+ }
35
+
36
+ @Core.transaction()
37
+ async claim(id: TableIdentity) {
38
+ const event = await this.scope.model.outboxEvent.getByIdForUpdate(id);
39
+ if (!event || event.state === 'dispatched' || event.state === 'failed') return undefined;
40
+ const now = new Date();
41
+ const eligible =
42
+ (event.state === 'pending' && (!event.nextAttemptAt || event.nextAttemptAt <= now)) ||
43
+ (event.state === 'claimed' && !!event.claimExpiresAt && event.claimExpiresAt <= now);
44
+ if (!eligible) return undefined;
45
+ if (event.attemptCount >= MaxAttempts) {
46
+ await this.scope.model.outboxEvent.updateById(event.id, {
47
+ state: 'failed',
48
+ errorSummary: 'outbox delivery attempts exhausted',
49
+ });
50
+ return undefined;
51
+ }
52
+ const claimToken = randomUUID();
53
+ const claimedAt = now;
54
+ const claimExpiresAt = new Date(now.getTime() + ClaimLeaseMilliseconds);
55
+ await this.scope.model.outboxEvent.updateById(event.id, {
56
+ state: 'claimed',
57
+ claimedAt,
58
+ claimToken,
59
+ claimExpiresAt,
60
+ attemptCount: event.attemptCount + 1,
61
+ errorSummary: undefined,
62
+ });
63
+ return {
64
+ ...event,
65
+ state: 'claimed' as const,
66
+ claimedAt,
67
+ claimToken,
68
+ claimExpiresAt,
69
+ attemptCount: event.attemptCount + 1,
70
+ errorSummary: undefined,
71
+ };
72
+ }
73
+
74
+ @Core.transaction()
75
+ async markDispatched(id: TableIdentity, claimToken: string) {
76
+ const event = await this.scope.model.outboxEvent.getByIdForUpdate(id);
77
+ if (!event || event.state !== 'claimed' || event.claimToken !== claimToken) return undefined;
78
+ const dispatchedAt = new Date();
79
+ await this.scope.model.outboxEvent.updateById(event.id, {
80
+ state: 'dispatched',
81
+ dispatchedAt,
82
+ claimedAt: undefined,
83
+ claimToken: undefined,
84
+ claimExpiresAt: undefined,
85
+ errorSummary: undefined,
86
+ });
87
+ return { ...event, state: 'dispatched' as const, dispatchedAt };
88
+ }
89
+
90
+ @Core.transaction()
91
+ async release(id: TableIdentity, claimToken: string, error: unknown) {
92
+ const event = await this.scope.model.outboxEvent.getByIdForUpdate(id);
93
+ if (!event || event.state !== 'claimed' || event.claimToken !== claimToken) return undefined;
94
+ const errorSummary = summarizeError(error);
95
+ if (event.attemptCount >= MaxAttempts) {
96
+ await this.scope.model.outboxEvent.updateById(event.id, {
97
+ state: 'failed',
98
+ claimedAt: undefined,
99
+ claimToken: undefined,
100
+ claimExpiresAt: undefined,
101
+ errorSummary,
102
+ });
103
+ return { ...event, state: 'failed' as const, errorSummary };
104
+ }
105
+ const nextAttemptAt = new Date(Date.now() + retryDelayMilliseconds(event.attemptCount));
106
+ await this.scope.model.outboxEvent.updateById(event.id, {
107
+ state: 'pending',
108
+ claimedAt: undefined,
109
+ claimToken: undefined,
110
+ claimExpiresAt: undefined,
111
+ nextAttemptAt,
112
+ errorSummary,
113
+ });
114
+ return { ...event, state: 'pending' as const, nextAttemptAt, errorSummary };
115
+ }
116
+
117
+ async queueDue(limit = 100) {
118
+ const now = new Date();
119
+ const pending = await this.scope.model.outboxEvent.select({
120
+ where: {
121
+ state: 'pending',
122
+ nextAttemptAt: { _lte_: now },
123
+ },
124
+ orders: [
125
+ ['nextAttemptAt', 'asc'],
126
+ ['id', 'asc'],
127
+ ],
128
+ limit,
129
+ });
130
+ const claimed = await this.scope.model.outboxEvent.select({
131
+ where: {
132
+ state: 'claimed',
133
+ claimExpiresAt: { _lte_: now },
134
+ },
135
+ orders: [
136
+ ['claimExpiresAt', 'asc'],
137
+ ['id', 'asc'],
138
+ ],
139
+ limit: Math.max(0, limit - pending.length),
140
+ });
141
+ const events = [...pending, ...claimed];
142
+ for (const event of events) {
143
+ await this.scope.queue.outboxDispatch.pushAsync({ outboxEventId: event.id });
144
+ }
145
+ return events.length;
146
+ }
147
+ }
148
+
149
+ function retryDelayMilliseconds(attemptCount: number) {
150
+ return Math.min(60_000, 1_000 * 2 ** Math.max(0, attemptCount - 1));
151
+ }
152
+
153
+ function summarizeError(error: unknown) {
154
+ const message = error instanceof Error ? error.message : String(error);
155
+ return message.slice(0, 255);
156
+ }