mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-09 18:33:24 +00:00
fix: use testmode boolean parameter for Mollie payments
Changed from mode: 'test' | 'live' to testmode: boolean as per Mollie API requirements. The testmode parameter is set to true when the API key starts with 'test_', false otherwise. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@xtr-dev/payload-billing",
|
||||
"version": "0.1.25",
|
||||
"version": "0.1.26",
|
||||
"description": "PayloadCMS plugin for billing and payment provider integrations with tracking and local testing",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
|
||||
@@ -18,10 +18,10 @@ const symbol = Symbol.for('@xtr-dev/payload-billing/mollie')
|
||||
export type MollieProviderConfig = Parameters<typeof createMollieClient>[0]
|
||||
|
||||
/**
|
||||
* Determine the Mollie mode based on API key prefix
|
||||
* Determine if testmode should be enabled based on API key prefix
|
||||
*/
|
||||
function getMollieMode(apiKey: string): 'test' | 'live' {
|
||||
return apiKey.startsWith('test_') ? 'test' : 'live'
|
||||
function isTestMode(apiKey: string): boolean {
|
||||
return apiKey.startsWith('test_')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,8 +168,8 @@ export const mollieProvider = (mollieConfig: MollieProviderConfig & {
|
||||
validateProductionUrl(redirectUrl, 'Redirect')
|
||||
validateProductionUrl(webhookUrl, 'Webhook')
|
||||
|
||||
// Determine mode from API key (test_ or live_)
|
||||
const mode = getMollieMode(mollieConfig.apiKey)
|
||||
// Determine testmode from API key (test_ prefix = true)
|
||||
const testmode = isTestMode(mollieConfig.apiKey)
|
||||
|
||||
const molliePayment = await singleton.get(payload).payments.create({
|
||||
amount: {
|
||||
@@ -179,7 +179,7 @@ export const mollieProvider = (mollieConfig: MollieProviderConfig & {
|
||||
description: payment.description || '',
|
||||
redirectUrl,
|
||||
webhookUrl,
|
||||
mode,
|
||||
testmode,
|
||||
} as any);
|
||||
payment.providerId = molliePayment.id
|
||||
// Use toPlainObject if available, otherwise spread the object (for compatibility with different Mollie client versions)
|
||||
|
||||
Reference in New Issue
Block a user