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.
- package/.cabloy-version +1 -1
- package/.claude/skills/cabloy-frontend-scaffold/SKILL.md +13 -3
- package/.claude/skills/cabloy-workflow/SKILL.md +6 -0
- package/.claude/skills/cabloy-workflow/evals/evals.json +6 -0
- package/CHANGELOG.md +24 -0
- package/CLAUDE.md +1 -1
- package/cabloy-docs/.vitepress/config.mjs +4 -0
- package/cabloy-docs/frontend/form-layout-guide.md +29 -7
- package/cabloy-docs/fullstack/parallel-worktree-environment.md +87 -0
- package/e2e/scripts/e2e.ts +13 -1
- package/e2e/scripts/startE2eVona.ts +4 -1
- package/e2e/specs/a-commerce/commerce.spec.ts +129 -32
- package/package.json +2 -1
- package/playwright-report/data/24ac790ec112339c76cfb0c8e2c2539c2f953a0b.zip +0 -0
- package/playwright-report/data/2fddcabcdbd0b695061a565acfff243cb3a4f5e3.zip +0 -0
- package/playwright-report/data/4738038d9e861d63fd25937c9a3570934786a62f.zip +0 -0
- package/playwright-report/data/72f99c7da67c7f6ea53cab7d8681798b70d79a10.md +222 -0
- package/playwright-report/data/7b9684a7c793e9798b898f8ff50177b660a7a733.md +222 -0
- package/playwright-report/data/8b31595f5f1cc9d23863af51a592e6b90dcbc4ce.zip +0 -0
- package/playwright-report/data/95b578407a68806202dda917a61c50c750bd285b.md +222 -0
- package/playwright-report/data/ad960b3a58f224f5b4cad04a24067600064ffb7b.md +222 -0
- package/playwright-report/index.html +90 -0
- package/playwright-report/trace/assets/codeMirrorModule-LEHpjmcn.js +32 -0
- package/playwright-report/trace/assets/defaultSettingsView-BNmKHKpQ.js +264 -0
- package/playwright-report/trace/assets/urlMatch-BYQrIQwR.js +1 -0
- package/playwright-report/trace/codeMirrorModule.DYBRYzYX.css +1 -0
- package/playwright-report/trace/codicon.DCmgc-ay.ttf +0 -0
- package/playwright-report/trace/defaultSettingsView.CjdS-WJx.css +1 -0
- package/playwright-report/trace/index.CzXZzn5A.css +1 -0
- package/playwright-report/trace/index.DMMX1gXU.js +2 -0
- package/playwright-report/trace/index.html +44 -0
- package/playwright-report/trace/manifest.webmanifest +16 -0
- package/playwright-report/trace/playwright-logo.svg +9 -0
- package/playwright-report/trace/snapshot.html +10 -0
- package/playwright-report/trace/snapshot.v8KI4P3m.js +2 -0
- package/playwright-report/trace/sw.bundle.js +5 -0
- package/playwright-report/trace/uiMode.BZQ54Kgt.css +1 -0
- package/playwright-report/trace/uiMode.Ut8wwJNp.js +6 -0
- package/playwright-report/trace/uiMode.html +18 -0
- package/playwright-report/trace/xtermModule.DYP7pi_n.css +32 -0
- package/vona/env/.env +12 -0
- package/vona/env/.env.test +7 -0
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}Create.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}Update.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}View.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/3-en-us.ts +6 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/4-zh-cn.ts +6 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}Create.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}Update.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}View.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/3-en-us.ts +6 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/4-zh-cn.ts +6 -1
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/pnpm-lock.yaml +255 -12
- package/vona/pnpm-workspace.yaml +1 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/package.json +4 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/.metadata/index.ts +45 -3
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.index.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.version.ts +25 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/payScene.commerceOrder.ts +20 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/paymentAttempt.tsx +9 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/paymentAudit.tsx +5 -2
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/refundAttempt.tsx +6 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/index.ts +2 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/lib/index.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/commercePayScene.ts +54 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/paymentAttempt.ts +7 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/types/index.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/test/paymentAttempt.test.ts +21 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/.metadata/index.ts +30 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/en-us.ts +4 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/zh-cn.ts +4 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateCreate.tsx +88 -1
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateUpdate.tsx +44 -1
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateView.tsx +72 -1
- package/vona/src/suite/a-commerce/modules/commerce-promotion/test/couponTemplateFormLayout.test.ts +121 -0
- package/vona/src/suite/a-commerce/modules/commerce-siteweb/src/bean/ssrMenu.home.ts +4 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/package.json +4 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +0 -21
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutResult.tsx +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/order.ts +79 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/orderSnapshot.test.ts +227 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/paymentOutcome.test.ts +121 -13
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/refundLifecycle.test.ts +312 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/package.json +76 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/index.ts +842 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/bean.payProvider.ts +92 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/bean.payScene.ts +105 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.index.ts +28 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.redlock.ts +11 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.version.ts +113 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/queue.outboxDispatch.ts +31 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/schedule.outboxDispatch.ts +11 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/paymentSession.ts +55 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/webhook.ts +47 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/dto/paymentSessionStart.tsx +8 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/dto/paymentSessionView.tsx +69 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/dto/webhookReceipt.tsx +12 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/outboxEvent.tsx +46 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/paymentAudit.tsx +36 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/paymentSession.tsx +72 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/providerOperation.tsx +54 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/refundOperation.tsx +37 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/webhookInbox.tsx +59 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/index.ts +3 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/lib/index.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/lib/payProvider.ts +7 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/lib/payScene.ts +7 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/outboxEvent.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentAudit.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentSession.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/providerOperation.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/refundOperation.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/webhookInbox.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/outbox.ts +156 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentSession.ts +278 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/providerOperation.ts +5 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/webhook.ts +127 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/index.ts +3 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payProvider.ts +74 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payScene.ts +63 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payment.ts +151 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/test/outbox.test.ts +209 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/test/paymentSession.test.ts +153 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/test/webhook.test.ts +278 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/package.json +55 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/index.ts +182 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/bean/payProvider.mock.ts +149 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/controller/mockPayment.ts +25 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/dto/mockPaymentComplete.tsx +13 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/dto/mockPaymentReceipt.tsx +16 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/index.ts +3 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/lib/index.ts +1 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/service/payMock.ts +78 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/types/index.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/test/payMock.test.ts +141 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/package.json +55 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/index.ts +62 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/bean/payProvider.paypal.ts +91 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/index.ts +3 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/lib/index.ts +1 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/types/index.ts +9 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/package.json +55 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/index.ts +62 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/bean/payProvider.stripe.ts +88 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/index.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/types/index.ts +8 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-pay/package.json +15 -0
- package/vona/src/suite-vendor/a-pay/tsconfig.base.json +4 -0
- package/vona/src/suite-vendor/a-pay/tsconfig.json +19 -0
- package/zova/env/.env +1 -0
- package/zova/openapi.config.ts +5 -1
- package/zova/package.original.json +1 -1
- package/zova/packages-cli/cli/package.json +2 -2
- package/zova/packages-cli/cli-set-front/cli/templates/openapi/config/boilerplate/project/openapi.config.ts +5 -1
- package/zova/packages-cli/cli-set-front/package.json +1 -1
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.openapi.generate.ts +8 -0
- package/zova/packages-cli/cli-set-front/src/lib/common/cliCreatePage.ts +7 -24
- package/zova/packages-cli/cli-set-front/src/lib/common/utils.ts +10 -1
- package/zova/packages-utils/zova-jsx/package.json +2 -2
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +1 -1
- package/zova/packages-zova/zova-core/src/types/interface/component.ts +5 -0
- package/zova/pnpm-lock.yaml +96 -26
- package/zova/src/front/config/config/config.cabloyCommerce.ts +1 -1
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/schemas.ts +110 -12
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/types.ts +1292 -160
- package/zova/src/suite/a-commerce/modules/commerce-trade/cli/openapi.config.ts +0 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/package.json +4 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +1 -47
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +23 -8
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +249 -62
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/checkout/controller.tsx +5 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/payment/controller.tsx +152 -39
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/routes.ts +1 -1
- package/zova/src/suite-vendor/a-pay/modules/a-pay/cli/openapi.config.ts +9 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/package.json +53 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/component/paymentNextAction.ts +31 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/index.ts +217 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/this.ts +2 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/baseURL.ts +5 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/index.ts +3 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/schemas.ts +584 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/types.ts +9324 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/paymentSession.ts +52 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/apiSchema/paymentSession.ts +20 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/component/paymentNextAction/controller.tsx +76 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/index.ts +3 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/lib/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentSession.ts +32 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentCoordinator.ts +13 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/types/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/types/payment.ts +25 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/tsconfig.build.json +13 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/tsconfig.json +5 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/cli/openapi.config.ts +9 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/package.json +53 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/index.ts +140 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/this.ts +2 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/baseURL.ts +5 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/index.ts +3 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/schemas.ts +584 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/types.ts +9324 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/payMockPayment.ts +34 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/apiSchema/payMockPayment.ts +13 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/model/payMockPayment.ts +20 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.build.json +13 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.json +5 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/package.json +52 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/index.ts +26 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/this.ts +2 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/src/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.build.json +13 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.json +5 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/package.json +52 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/index.ts +26 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/this.ts +2 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/src/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.build.json +13 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.json +5 -0
- package/zova/src/suite-vendor/a-pay/package.json +15 -0
- package/zova/src/suite-vendor/a-pay/tsconfig.base.json +4 -0
- package/zova/src/suite-vendor/a-pay/tsconfig.json +4 -0
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/package.json +2 -2
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/controller/payment.ts +0 -23
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/commerceTradePayment.ts +0 -36
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/apiSchema/commerceTradePayment.ts +0 -13
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/payment.ts +0 -25
- /package/vona/patches/{zova-core@5.1.79.patch → zova-core@5.1.81.patch} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
3
|
+
|
|
4
|
+
import { BeanBase } from 'vona';
|
|
5
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
6
|
+
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
7
|
+
|
|
8
|
+
import { DtoMockPaymentComplete } from '../dto/mockPaymentComplete.tsx';
|
|
9
|
+
import { DtoMockPaymentReceipt } from '../dto/mockPaymentReceipt.tsx';
|
|
10
|
+
|
|
11
|
+
export interface IControllerOptionsMockPayment extends IDecoratorControllerOptions {}
|
|
12
|
+
|
|
13
|
+
@Controller<IControllerOptionsMockPayment>('mock/payment-session', {
|
|
14
|
+
meta: { mode: ['dev', 'test'] },
|
|
15
|
+
})
|
|
16
|
+
export class ControllerMockPayment extends BeanBase {
|
|
17
|
+
@Web.post(':id/complete')
|
|
18
|
+
@Api.body(DtoMockPaymentReceipt)
|
|
19
|
+
async complete(
|
|
20
|
+
@Arg.param('id', v.tableIdentity()) id: TableIdentity,
|
|
21
|
+
@Arg.body() command: DtoMockPaymentComplete,
|
|
22
|
+
): Promise<DtoMockPaymentReceipt> {
|
|
23
|
+
return await this.scope.service.payMock.completePaymentSession(id, command.outcome);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
|
|
3
|
+
import { Api } from 'vona-module-a-openapiutils';
|
|
4
|
+
import { Dto } from 'vona-module-a-web';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
export interface IDtoOptionsMockPaymentComplete extends IDecoratorDtoOptions {}
|
|
8
|
+
|
|
9
|
+
@Dto<IDtoOptionsMockPaymentComplete>()
|
|
10
|
+
export class DtoMockPaymentComplete {
|
|
11
|
+
@Api.field(z.enum(['succeeded', 'failed', 'cancelled']))
|
|
12
|
+
outcome: 'succeeded' | 'failed' | 'cancelled';
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
3
|
+
|
|
4
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
5
|
+
import { Dto } from 'vona-module-a-web';
|
|
6
|
+
|
|
7
|
+
export interface IDtoOptionsMockPaymentReceipt extends IDecoratorDtoOptions {}
|
|
8
|
+
|
|
9
|
+
@Dto<IDtoOptionsMockPaymentReceipt>()
|
|
10
|
+
export class DtoMockPaymentReceipt {
|
|
11
|
+
@Api.field(v.tableIdentity())
|
|
12
|
+
paymentSessionId: TableIdentity;
|
|
13
|
+
|
|
14
|
+
@Api.field(v.required())
|
|
15
|
+
accepted: true;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
|
|
3
|
+
import { createHmac, randomUUID } from 'node:crypto';
|
|
4
|
+
import { BeanBase } from 'vona';
|
|
5
|
+
import { Service } from 'vona-module-a-bean';
|
|
6
|
+
|
|
7
|
+
export type TypeMockPaymentOutcome = 'succeeded' | 'failed' | 'cancelled';
|
|
8
|
+
|
|
9
|
+
@Service()
|
|
10
|
+
export class ServicePayMock extends BeanBase {
|
|
11
|
+
async completePaymentSession(paymentSessionId: TableIdentity, outcome: TypeMockPaymentOutcome) {
|
|
12
|
+
this._assertSimulatorEnabled();
|
|
13
|
+
const session = await this.$scope.pay.model.paymentSession.getById(paymentSessionId);
|
|
14
|
+
if (!session || String(session.userId) !== String(this.bean.passport.currentUser!.id)) {
|
|
15
|
+
this.app.throw(404, 'payment session not found');
|
|
16
|
+
}
|
|
17
|
+
if (
|
|
18
|
+
session.providerName !== 'pay-mock:mock' ||
|
|
19
|
+
session.clientName !== 'default' ||
|
|
20
|
+
session.environment !== 'sandbox'
|
|
21
|
+
) {
|
|
22
|
+
this.app.throw(404, 'mock payment session not found');
|
|
23
|
+
}
|
|
24
|
+
if (session.state !== 'requires_action') {
|
|
25
|
+
this.app.throw(409, 'mock payment session is not actionable');
|
|
26
|
+
}
|
|
27
|
+
if (session.expiresAt <= new Date()) {
|
|
28
|
+
this.app.throw(409, 'payment session is expired');
|
|
29
|
+
}
|
|
30
|
+
const { clientOptions } = this.bean.payProvider.resolveByName(
|
|
31
|
+
session.providerName,
|
|
32
|
+
session.clientName,
|
|
33
|
+
);
|
|
34
|
+
if (clientOptions.environment !== session.environment) {
|
|
35
|
+
this.app.throw(500, 'mock payment provider environment is inconsistent');
|
|
36
|
+
}
|
|
37
|
+
const secret = clientOptions.secretWebhook;
|
|
38
|
+
if (typeof secret !== 'string' || !secret) {
|
|
39
|
+
this.app.throw(500, 'mock webhook secret is not configured');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const rawBody = JSON.stringify({
|
|
43
|
+
eventId: `mock-payment-${randomUUID()}`,
|
|
44
|
+
eventType: `payment.${outcome}`,
|
|
45
|
+
paymentSessionId: String(session.id),
|
|
46
|
+
state: outcome,
|
|
47
|
+
amountMinor: session.amountMinor,
|
|
48
|
+
currency: session.currency,
|
|
49
|
+
providerPaymentId: session.providerPaymentId ?? `mock-payment-${session.id}`,
|
|
50
|
+
...(outcome === 'succeeded' ? { providerCaptureId: `mock-capture-${session.id}` } : {}),
|
|
51
|
+
});
|
|
52
|
+
const signature = createHmac('sha256', secret).update(rawBody).digest('hex');
|
|
53
|
+
const instanceName = this.ctx.instanceName;
|
|
54
|
+
const instanceHeaderField = this.app.config.instance.headerField;
|
|
55
|
+
const response = await fetch(
|
|
56
|
+
this.app.util.getAbsoluteUrlByApiPath(
|
|
57
|
+
`/pay/webhook/${session.providerName}/${session.clientName}`,
|
|
58
|
+
),
|
|
59
|
+
{
|
|
60
|
+
method: 'POST',
|
|
61
|
+
headers: {
|
|
62
|
+
'content-type': 'application/json',
|
|
63
|
+
'x-pay-mock-signature': signature,
|
|
64
|
+
...(instanceName && instanceHeaderField ? { [instanceHeaderField]: instanceName } : {}),
|
|
65
|
+
},
|
|
66
|
+
body: rawBody,
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
if (!response.ok) this.app.throw(502, 'mock payment webhook was rejected');
|
|
70
|
+
return { paymentSessionId: session.id, accepted: true as const };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private _assertSimulatorEnabled() {
|
|
74
|
+
if (this.app.meta.env.META_MODE === 'prod') {
|
|
75
|
+
this.app.throw(404, 'mock payment simulator is unavailable');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module 'vona' {
|
|
2
|
+
export interface VonaConfigEnv {
|
|
3
|
+
PAY_MOCK_DEFAULT_CREDENTIAL: string | undefined;
|
|
4
|
+
PAY_MOCK_DEFAULT_WEBHOOK: string | undefined;
|
|
5
|
+
PAY_MOCK_SECONDARY_CREDENTIAL: string | undefined;
|
|
6
|
+
PAY_MOCK_SECONDARY_WEBHOOK: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { describe, it } from 'node:test';
|
|
4
|
+
import { app } from 'vona-mock';
|
|
5
|
+
|
|
6
|
+
interface IFixture {
|
|
7
|
+
userId?: number;
|
|
8
|
+
paymentSessionId?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function createFixture(suffix: string): Promise<IFixture> {
|
|
12
|
+
const user = await app.bean.user.register({ name: `pay-mock-${suffix}` }, true);
|
|
13
|
+
await app.bean.passport.signinMock(`pay-mock-${suffix}` as any);
|
|
14
|
+
const session = await app.scope('a-pay').service.paymentSession.create({
|
|
15
|
+
userId: user.id,
|
|
16
|
+
payScene: 'commerce-payment:commerceOrder',
|
|
17
|
+
businessReference: `business-${suffix}`,
|
|
18
|
+
amountMinor: 1299,
|
|
19
|
+
currency: 'USD',
|
|
20
|
+
correlationId: `payment-${suffix}`,
|
|
21
|
+
});
|
|
22
|
+
await app.scope('a-pay').service.paymentSession.start(session.id);
|
|
23
|
+
return { userId: user.id as number, paymentSessionId: session.id as number };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function cleanup(fixture: IFixture) {
|
|
27
|
+
const pay = app.scope('a-pay');
|
|
28
|
+
if (fixture.paymentSessionId !== undefined) {
|
|
29
|
+
await pay.model.outboxEvent.delete({ paymentSessionId: fixture.paymentSessionId });
|
|
30
|
+
await pay.model.paymentAudit.delete({ paymentSessionId: fixture.paymentSessionId });
|
|
31
|
+
await pay.model.webhookInbox.delete({ paymentSessionId: fixture.paymentSessionId });
|
|
32
|
+
await pay.model.paymentSession.delete({ id: fixture.paymentSessionId });
|
|
33
|
+
}
|
|
34
|
+
if (fixture.userId !== undefined) {
|
|
35
|
+
await app.scope('home-user').model.roleUser.delete({ userId: fixture.userId });
|
|
36
|
+
await app.bean.user.removeById(fixture.userId);
|
|
37
|
+
}
|
|
38
|
+
await app.bean.passport.signout();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
describe('payMock.test.ts', { concurrency: false }, () => {
|
|
42
|
+
it('captures Vona env secrets in the mock Provider options', () => {
|
|
43
|
+
const options = app.bean.payProvider.getOptions('pay-mock:mock', 'default');
|
|
44
|
+
assert.equal(options.secretCredential, app.meta.env.PAY_MOCK_DEFAULT_CREDENTIAL);
|
|
45
|
+
assert.equal(options.secretWebhook, app.meta.env.PAY_MOCK_DEFAULT_WEBHOOK);
|
|
46
|
+
assert.equal(String(options.secretCredential).startsWith('env:' + '//'), false);
|
|
47
|
+
assert.equal(String(options.secretWebhook).startsWith('env:' + '//'), false);
|
|
48
|
+
assert.deepEqual(options.capabilities, {
|
|
49
|
+
redirectCheckout: false,
|
|
50
|
+
embeddedCheckout: true,
|
|
51
|
+
automaticCapture: true,
|
|
52
|
+
manualCapture: false,
|
|
53
|
+
refunds: true,
|
|
54
|
+
partialRefunds: true,
|
|
55
|
+
webhooks: true,
|
|
56
|
+
});
|
|
57
|
+
assert.deepEqual(
|
|
58
|
+
app.bean.payProvider.resolveByName('pay-mock:mock', 'secondary').clientOptions.capabilities,
|
|
59
|
+
options.capabilities,
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('submits server-derived mock payment facts through the signed webhook', async () => {
|
|
64
|
+
await app.bean.executor.mockCtx(async () => {
|
|
65
|
+
const fixture: IFixture = {};
|
|
66
|
+
try {
|
|
67
|
+
Object.assign(fixture, await createFixture('success'));
|
|
68
|
+
const receipt = await app
|
|
69
|
+
.scope('pay-mock')
|
|
70
|
+
.service.payMock.completePaymentSession(fixture.paymentSessionId!, 'succeeded');
|
|
71
|
+
assert.deepEqual(receipt, { paymentSessionId: fixture.paymentSessionId, accepted: true });
|
|
72
|
+
const pay = app.scope('a-pay');
|
|
73
|
+
const [session, inboxes, audits, outbox] = await Promise.all([
|
|
74
|
+
pay.model.paymentSession.getById(fixture.paymentSessionId!),
|
|
75
|
+
pay.model.webhookInbox.select({ where: { paymentSessionId: fixture.paymentSessionId } }),
|
|
76
|
+
pay.model.paymentAudit.select({ where: { paymentSessionId: fixture.paymentSessionId } }),
|
|
77
|
+
pay.model.outboxEvent.select({ where: { paymentSessionId: fixture.paymentSessionId } }),
|
|
78
|
+
]);
|
|
79
|
+
assert.equal(session?.state, 'succeeded');
|
|
80
|
+
assert.equal(inboxes.length, 1);
|
|
81
|
+
assert.equal(audits.filter(item => item.source === 'webhook').length, 1);
|
|
82
|
+
assert.equal(outbox.length, 1);
|
|
83
|
+
} finally {
|
|
84
|
+
await cleanup(fixture);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('completes a payment session in the active named instance', async () => {
|
|
90
|
+
await app.bean.executor.mockCtx(
|
|
91
|
+
async () => {
|
|
92
|
+
const fixture: IFixture = {};
|
|
93
|
+
try {
|
|
94
|
+
Object.assign(fixture, await createFixture(`named-${randomUUID().slice(0, 12)}`));
|
|
95
|
+
const receipt = await app
|
|
96
|
+
.scope('pay-mock')
|
|
97
|
+
.service.payMock.completePaymentSession(fixture.paymentSessionId!, 'succeeded');
|
|
98
|
+
assert.deepEqual(receipt, { paymentSessionId: fixture.paymentSessionId, accepted: true });
|
|
99
|
+
const pay = app.scope('a-pay');
|
|
100
|
+
const [session, inboxes, audits, outbox] = await Promise.all([
|
|
101
|
+
pay.model.paymentSession.getById(fixture.paymentSessionId!),
|
|
102
|
+
pay.model.webhookInbox.select({
|
|
103
|
+
where: { paymentSessionId: fixture.paymentSessionId },
|
|
104
|
+
}),
|
|
105
|
+
pay.model.paymentAudit.select({
|
|
106
|
+
where: { paymentSessionId: fixture.paymentSessionId },
|
|
107
|
+
}),
|
|
108
|
+
pay.model.outboxEvent.select({ where: { paymentSessionId: fixture.paymentSessionId } }),
|
|
109
|
+
]);
|
|
110
|
+
assert.equal(session?.state, 'succeeded');
|
|
111
|
+
assert.equal(inboxes.length, 1);
|
|
112
|
+
assert.equal(audits.filter(item => item.source === 'webhook').length, 1);
|
|
113
|
+
assert.equal(outbox.length, 1);
|
|
114
|
+
} finally {
|
|
115
|
+
await cleanup(fixture);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{ instanceName: 'shareTest' as any },
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('does not simulate a session that is no longer actionable', async () => {
|
|
123
|
+
await app.bean.executor.mockCtx(async () => {
|
|
124
|
+
const fixture: IFixture = {};
|
|
125
|
+
try {
|
|
126
|
+
Object.assign(fixture, await createFixture('terminal'));
|
|
127
|
+
await app
|
|
128
|
+
.scope('pay-mock')
|
|
129
|
+
.service.payMock.completePaymentSession(fixture.paymentSessionId!, 'cancelled');
|
|
130
|
+
await assert.rejects(
|
|
131
|
+
app
|
|
132
|
+
.scope('pay-mock')
|
|
133
|
+
.service.payMock.completePaymentSession(fixture.paymentSessionId!, 'cancelled'),
|
|
134
|
+
{ status: 409 },
|
|
135
|
+
);
|
|
136
|
+
} finally {
|
|
137
|
+
await cleanup(fixture);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vona-module-pay-paypal",
|
|
3
|
+
"version": "5.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Vona Module"
|
|
7
|
+
],
|
|
8
|
+
"author": "",
|
|
9
|
+
"files": [
|
|
10
|
+
"assets",
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": [
|
|
18
|
+
"./src/index.ts",
|
|
19
|
+
"./dist/index.d.ts"
|
|
20
|
+
],
|
|
21
|
+
"import": "./src/index.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
|
|
28
|
+
"tsc:publish": "npm run clean && node ../../../../../packages-cli/cli/src/bin/vona.ts :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
|
|
29
|
+
"prepublishOnly": "npm run tsc:publish",
|
|
30
|
+
"prepack": "clean-package",
|
|
31
|
+
"postpack": "clean-package restore"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"vona-module-a-pay": "workspace:*"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"clean-package": "^2.2.0",
|
|
38
|
+
"rimraf": "^6.1.3"
|
|
39
|
+
},
|
|
40
|
+
"clean-package": {
|
|
41
|
+
"indent": 2,
|
|
42
|
+
"remove": [
|
|
43
|
+
"clean-package",
|
|
44
|
+
"devDependencies",
|
|
45
|
+
"exports.\\..import"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"title": "pay-paypal",
|
|
49
|
+
"vonaModule": {
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"a-pay": "5.0.0",
|
|
52
|
+
"a-vona": "5.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// eslint-disable
|
|
2
|
+
/** payProvider: begin */
|
|
3
|
+
export * from '../bean/payProvider.paypal.ts';
|
|
4
|
+
import type { IPayProviderOptionsPaypal } from '../bean/payProvider.paypal.ts';
|
|
5
|
+
import 'vona-module-a-pay';
|
|
6
|
+
declare module 'vona-module-a-pay' {
|
|
7
|
+
|
|
8
|
+
export interface IPayProviderRecord {
|
|
9
|
+
'pay-paypal:paypal': IPayProviderOptionsPaypal;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
declare module 'vona-module-pay-paypal' {
|
|
15
|
+
|
|
16
|
+
export interface PayProviderPaypal {
|
|
17
|
+
/** @internal */
|
|
18
|
+
get scope(): ScopeModulePayPaypal;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface PayProviderPaypal {
|
|
22
|
+
get $beanFullName(): 'pay-paypal.payProvider.paypal';
|
|
23
|
+
get $onionName(): 'pay-paypal:paypal';
|
|
24
|
+
get $onionOptions(): IPayProviderOptionsPaypal;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** payProvider: end */
|
|
28
|
+
/** payProvider: begin */
|
|
29
|
+
import type { PayProviderPaypal } from '../bean/payProvider.paypal.ts';
|
|
30
|
+
export interface IModulePayProvider {
|
|
31
|
+
'paypal': PayProviderPaypal;
|
|
32
|
+
}
|
|
33
|
+
/** payProvider: end */
|
|
34
|
+
/** scope: begin */
|
|
35
|
+
import { BeanScopeBase, type BeanScopeUtil } from 'vona';
|
|
36
|
+
import { Scope } from 'vona-module-a-bean';
|
|
37
|
+
|
|
38
|
+
@Scope()
|
|
39
|
+
export class ScopeModulePayPaypal extends BeanScopeBase {}
|
|
40
|
+
|
|
41
|
+
export interface ScopeModulePayPaypal {
|
|
42
|
+
util: BeanScopeUtil;
|
|
43
|
+
payProvider: IModulePayProvider;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
import 'vona';
|
|
47
|
+
declare module 'vona' {
|
|
48
|
+
export interface IBeanScopeRecord {
|
|
49
|
+
'pay-paypal': ScopeModulePayPaypal;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface IBeanScopeContainer {
|
|
53
|
+
payPaypal: ScopeModulePayPaypal;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
/** scope: end */
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IDecoratorPayProviderOptions,
|
|
3
|
+
IPayProviderClientOptions,
|
|
4
|
+
IPayProviderClientRecord,
|
|
5
|
+
IPayProviderExecute,
|
|
6
|
+
IPayProviderPaymentInput,
|
|
7
|
+
IPayProviderPaymentSnapshot,
|
|
8
|
+
IPayProviderRefundInput,
|
|
9
|
+
IPayProviderRefundSnapshot,
|
|
10
|
+
IPayProviderVerifiedWebhook,
|
|
11
|
+
IPayProviderWebhookInput,
|
|
12
|
+
} from 'vona-module-a-pay';
|
|
13
|
+
|
|
14
|
+
import { BeanBase, useApp } from 'vona';
|
|
15
|
+
import { PayProvider } from 'vona-module-a-pay';
|
|
16
|
+
|
|
17
|
+
export interface IPayProviderPaypalClientRecord extends IPayProviderClientRecord {}
|
|
18
|
+
|
|
19
|
+
export interface IPayProviderPaypalClientOptions extends IPayProviderClientOptions {
|
|
20
|
+
secretCredential: { clientId: string | undefined; clientSecret: string | undefined };
|
|
21
|
+
webhookId: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const app = useApp();
|
|
25
|
+
|
|
26
|
+
export interface IPayProviderOptionsPaypal extends IDecoratorPayProviderOptions<
|
|
27
|
+
IPayProviderPaypalClientRecord,
|
|
28
|
+
IPayProviderPaypalClientOptions
|
|
29
|
+
> {}
|
|
30
|
+
|
|
31
|
+
@PayProvider<IPayProviderOptionsPaypal>({
|
|
32
|
+
base: {
|
|
33
|
+
capabilities: {
|
|
34
|
+
redirectCheckout: true,
|
|
35
|
+
embeddedCheckout: false,
|
|
36
|
+
automaticCapture: true,
|
|
37
|
+
manualCapture: false,
|
|
38
|
+
refunds: true,
|
|
39
|
+
partialRefunds: true,
|
|
40
|
+
webhooks: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
clients: {
|
|
44
|
+
default: {
|
|
45
|
+
environment: 'sandbox',
|
|
46
|
+
secretCredential: {
|
|
47
|
+
clientId: app.meta.env.PAYPAL_CLIENT_ID,
|
|
48
|
+
clientSecret: app.meta.env.PAYPAL_CLIENT_SECRET,
|
|
49
|
+
},
|
|
50
|
+
webhookId: app.meta.env.PAYPAL_WEBHOOK_ID,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
export class PayProviderPaypal
|
|
55
|
+
extends BeanBase
|
|
56
|
+
implements IPayProviderExecute<IPayProviderPaypalClientOptions>
|
|
57
|
+
{
|
|
58
|
+
async startPayment(
|
|
59
|
+
_input: IPayProviderPaymentInput,
|
|
60
|
+
_clientOptions: IPayProviderPaypalClientOptions,
|
|
61
|
+
): Promise<IPayProviderPaymentSnapshot> {
|
|
62
|
+
this.app.throw(501, 'PayPal provider is not configured');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async queryPayment(
|
|
66
|
+
_input: IPayProviderPaymentInput,
|
|
67
|
+
_clientOptions: IPayProviderPaypalClientOptions,
|
|
68
|
+
): Promise<IPayProviderPaymentSnapshot> {
|
|
69
|
+
this.app.throw(501, 'PayPal provider is not configured');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async createRefund(
|
|
73
|
+
_input: IPayProviderRefundInput,
|
|
74
|
+
_clientOptions: IPayProviderPaypalClientOptions,
|
|
75
|
+
): Promise<IPayProviderRefundSnapshot> {
|
|
76
|
+
this.app.throw(501, 'PayPal provider is not configured');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async verifyWebhook(
|
|
80
|
+
_input: IPayProviderWebhookInput,
|
|
81
|
+
_clientOptions: IPayProviderPaypalClientOptions,
|
|
82
|
+
): Promise<IPayProviderVerifiedWebhook> {
|
|
83
|
+
this.app.throw(501, 'PayPal webhook verification is not configured');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare module 'vona-module-a-pay' {
|
|
88
|
+
export interface IPayProviderRecord {
|
|
89
|
+
'pay-paypal:paypal': IPayProviderOptionsPaypal;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vona-module-pay-stripe",
|
|
3
|
+
"version": "5.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Vona Module"
|
|
7
|
+
],
|
|
8
|
+
"author": "",
|
|
9
|
+
"files": [
|
|
10
|
+
"assets",
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": [
|
|
18
|
+
"./src/index.ts",
|
|
19
|
+
"./dist/index.d.ts"
|
|
20
|
+
],
|
|
21
|
+
"import": "./src/index.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
|
|
28
|
+
"tsc:publish": "npm run clean && node ../../../../../packages-cli/cli/src/bin/vona.ts :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
|
|
29
|
+
"prepublishOnly": "npm run tsc:publish",
|
|
30
|
+
"prepack": "clean-package",
|
|
31
|
+
"postpack": "clean-package restore"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"vona-module-a-pay": "workspace:*"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"clean-package": "^2.2.0",
|
|
38
|
+
"rimraf": "^6.1.3"
|
|
39
|
+
},
|
|
40
|
+
"clean-package": {
|
|
41
|
+
"indent": 2,
|
|
42
|
+
"remove": [
|
|
43
|
+
"clean-package",
|
|
44
|
+
"devDependencies",
|
|
45
|
+
"exports.\\..import"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"title": "pay-stripe",
|
|
49
|
+
"vonaModule": {
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"a-pay": "5.0.0",
|
|
52
|
+
"a-vona": "5.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|