fix(payment): expose provider type for named gateways

This commit is contained in:
Clintchiz committed 2026-08-28 10:02:42 +05:30
1 parent 2e770f7e3e
commit 1b470402c7
5 files changed
+8 -1

No files matched your search

+3 -1
View File
@@ -50,6 +50,8 @@ export function validatePaymentConfig(config: PaymentConfig) {
});
if (value.provider === "razorpay")
required(name, { keyId: value.keyId, keySecret: value.keySecret });
if (value.provider === "razorpay" && config.environment === "production")
required(name, { webhookSecret: value.webhookSecret });
if (value.provider === "paypal")
required(name, {
clientId: value.clientId,
@@ -64,7 +66,7 @@ export function validatePaymentConfig(config: PaymentConfig) {
}
function namedGateway(name: string, gateway: PaymentGateway): PaymentGateway {
return Object.freeze({ ...gateway, id: name });
return Object.freeze({ ...gateway, id: name, provider: gateway.provider ?? gateway.id });
}
export function paymentOptionsFromConfig(