Skip to content

Commit 3861433

Browse files
committed
Updates order prefix format for consistency
Replaces dots and colons in the order prefix with underscores and shortens the order key identifier. Improves readability and ensures the order ID is safe for various environments.
1 parent 43a7b25 commit 3861433

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/api/payment-cart-key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const getPaymentKeyByCart: ({
7575

7676
const order_id = whenNotErrorAll(
7777
[shortEoa],
78-
([_shortEoa]) => `ORDER-${orderPrefix}-${_shortEoa}-${randomHash(3)}`,
78+
([_shortEoa]) => `ORD-${orderPrefix}-${_shortEoa}-${randomHash(3)}`,
7979
)
8080
const gross_amount = whenNotError(offeringItems, (_items) =>
8181
_items.reduce(

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const getApiPaths = (async (options, config, utils) => {
8484
fulfillment?: { encrypted: string }
8585
}>) ?? {}
8686
const scope = generateScopeBy(config.url)
87-
const orderPrefix = new URL(config.url).host
87+
const orderPrefix = new URL(config.url).host.replace(/[.:]/g, '_')
8888

8989
return [
9090
{

0 commit comments

Comments
 (0)