feat: Improvements to payment module and Stripe provider (#10980)

* fix: Correctly parse Stripe error, remove unused method

* fix: Isolate the payment provider error check function

* fix: Allow passing few extra parameters to Stripe

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Stevche Radevski
2025-01-16 08:12:53 +01:00
committed by GitHub
co-authored by Oli Juhl
parent 44cd0224af
commit f5235862c0
4 changed files with 62 additions and 96 deletions
@@ -13,11 +13,7 @@ import {
UpdatePaymentProviderSession,
WebhookActionResult,
} from "@medusajs/framework/types"
import {
isPaymentProviderError,
MedusaError,
ModulesSdkUtils,
} from "@medusajs/framework/utils"
import { MedusaError, ModulesSdkUtils } from "@medusajs/framework/utils"
import { PaymentProvider } from "@models"
import { EOL } from "os"
@@ -171,3 +167,13 @@ Please make sure that the provider is registered in the container and it is conf
)
}
}
function isPaymentProviderError(obj: any): obj is PaymentProviderError {
return (
obj &&
typeof obj === "object" &&
"error" in obj &&
"code" in obj &&
"detail" in obj
)
}