@waffo/pancake-ts 0.8.0 → 0.9.0
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/CHANGELOG.md +16 -0
- package/README.md +27 -1
- package/dist/index.cjs +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/docs/api-reference.md +45 -41
- package/docs/graphql-guide.md +26 -0
- package/docs/webhook-guide.md +11 -9
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -720,6 +720,8 @@ interface CreateCheckoutSessionParams {
|
|
|
720
720
|
darkMode?: boolean;
|
|
721
721
|
/** Custom metadata */
|
|
722
722
|
metadata?: Record<string, string>;
|
|
723
|
+
/** Order-side business identifier (max 128 chars); inherited by orders, payments, refunds */
|
|
724
|
+
orderMerchantExternalId?: string;
|
|
723
725
|
}
|
|
724
726
|
/** Result of creating a checkout session. */
|
|
725
727
|
interface CheckoutSessionResult {
|
|
@@ -781,6 +783,8 @@ interface CreateRefundTicketParams {
|
|
|
781
783
|
requestedAmount: RequestedAmount;
|
|
782
784
|
/** Custom metadata */
|
|
783
785
|
metadata?: Record<string, unknown>;
|
|
786
|
+
/** Refund-ticket business-side identifier (max 128 chars); inherited by the executed refund on PSP success */
|
|
787
|
+
refundTicketMerchantExternalId?: string;
|
|
784
788
|
}
|
|
785
789
|
/** Parameters for resubmitting a rejected refund ticket (buyer-side). */
|
|
786
790
|
interface ResubmitRefundTicketParams {
|
|
@@ -821,6 +825,8 @@ interface RefundTicket {
|
|
|
821
825
|
executedAt: string | null;
|
|
822
826
|
/** Custom metadata */
|
|
823
827
|
metadata: Record<string, unknown>;
|
|
828
|
+
/** Refund-ticket business-side identifier (max 128 chars, immutable across resubmits) */
|
|
829
|
+
refundTicketMerchantExternalId: string | null;
|
|
824
830
|
/** Current version number */
|
|
825
831
|
versionNumber: number | null;
|
|
826
832
|
/** Current (latest) version data */
|
|
@@ -954,6 +960,10 @@ interface WebhookEventData {
|
|
|
954
960
|
buyerEmail: string;
|
|
955
961
|
/** Merchant-provided buyer identity from checkout session */
|
|
956
962
|
merchantProvidedBuyerIdentity?: string;
|
|
963
|
+
/** Order business identifier; present on order/payment + refund events (inherited from order) */
|
|
964
|
+
orderMerchantExternalId?: string;
|
|
965
|
+
/** Refund-ticket business identifier; only present on refund.* events */
|
|
966
|
+
refundTicketMerchantExternalId?: string;
|
|
957
967
|
currency: string;
|
|
958
968
|
/** Billing/shipping address (structured object) */
|
|
959
969
|
billingDetail?: Record<string, unknown>;
|
|
@@ -1244,6 +1254,7 @@ declare class BuyerSession {
|
|
|
1244
1254
|
* paymentId: "PAY_xxx",
|
|
1245
1255
|
* reason: "Product not as described",
|
|
1246
1256
|
* requestedAmount: { amount: "29.00", currency: "USD" },
|
|
1257
|
+
* refundTicketMerchantExternalId: "REF-2026-00891",
|
|
1247
1258
|
* });
|
|
1248
1259
|
*/
|
|
1249
1260
|
createRefundTicket(params: CreateRefundTicketParams): Promise<{
|
|
@@ -1313,12 +1324,13 @@ declare class CheckoutAnonymousResource {
|
|
|
1313
1324
|
* });
|
|
1314
1325
|
*
|
|
1315
1326
|
* @example
|
|
1316
|
-
* // Pre-fill email
|
|
1327
|
+
* // Pre-fill email + billing + attach business-side order reference
|
|
1317
1328
|
* const result = await client.checkout.anonymous.create({
|
|
1318
1329
|
* productId: "PROD_xxx",
|
|
1319
1330
|
* currency: "USD",
|
|
1320
1331
|
* buyerEmail: "customer@example.com",
|
|
1321
1332
|
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
1333
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
1322
1334
|
* });
|
|
1323
1335
|
*/
|
|
1324
1336
|
create(params: AnonymousCheckoutParams): Promise<CheckoutSessionResult & {
|
|
@@ -1356,6 +1368,7 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1356
1368
|
* currency: "USD",
|
|
1357
1369
|
* buyerIdentity: "user-123",
|
|
1358
1370
|
* buyerEmail: "customer@example.com",
|
|
1371
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
1359
1372
|
* });
|
|
1360
1373
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
1361
1374
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -720,6 +720,8 @@ interface CreateCheckoutSessionParams {
|
|
|
720
720
|
darkMode?: boolean;
|
|
721
721
|
/** Custom metadata */
|
|
722
722
|
metadata?: Record<string, string>;
|
|
723
|
+
/** Order-side business identifier (max 128 chars); inherited by orders, payments, refunds */
|
|
724
|
+
orderMerchantExternalId?: string;
|
|
723
725
|
}
|
|
724
726
|
/** Result of creating a checkout session. */
|
|
725
727
|
interface CheckoutSessionResult {
|
|
@@ -781,6 +783,8 @@ interface CreateRefundTicketParams {
|
|
|
781
783
|
requestedAmount: RequestedAmount;
|
|
782
784
|
/** Custom metadata */
|
|
783
785
|
metadata?: Record<string, unknown>;
|
|
786
|
+
/** Refund-ticket business-side identifier (max 128 chars); inherited by the executed refund on PSP success */
|
|
787
|
+
refundTicketMerchantExternalId?: string;
|
|
784
788
|
}
|
|
785
789
|
/** Parameters for resubmitting a rejected refund ticket (buyer-side). */
|
|
786
790
|
interface ResubmitRefundTicketParams {
|
|
@@ -821,6 +825,8 @@ interface RefundTicket {
|
|
|
821
825
|
executedAt: string | null;
|
|
822
826
|
/** Custom metadata */
|
|
823
827
|
metadata: Record<string, unknown>;
|
|
828
|
+
/** Refund-ticket business-side identifier (max 128 chars, immutable across resubmits) */
|
|
829
|
+
refundTicketMerchantExternalId: string | null;
|
|
824
830
|
/** Current version number */
|
|
825
831
|
versionNumber: number | null;
|
|
826
832
|
/** Current (latest) version data */
|
|
@@ -954,6 +960,10 @@ interface WebhookEventData {
|
|
|
954
960
|
buyerEmail: string;
|
|
955
961
|
/** Merchant-provided buyer identity from checkout session */
|
|
956
962
|
merchantProvidedBuyerIdentity?: string;
|
|
963
|
+
/** Order business identifier; present on order/payment + refund events (inherited from order) */
|
|
964
|
+
orderMerchantExternalId?: string;
|
|
965
|
+
/** Refund-ticket business identifier; only present on refund.* events */
|
|
966
|
+
refundTicketMerchantExternalId?: string;
|
|
957
967
|
currency: string;
|
|
958
968
|
/** Billing/shipping address (structured object) */
|
|
959
969
|
billingDetail?: Record<string, unknown>;
|
|
@@ -1244,6 +1254,7 @@ declare class BuyerSession {
|
|
|
1244
1254
|
* paymentId: "PAY_xxx",
|
|
1245
1255
|
* reason: "Product not as described",
|
|
1246
1256
|
* requestedAmount: { amount: "29.00", currency: "USD" },
|
|
1257
|
+
* refundTicketMerchantExternalId: "REF-2026-00891",
|
|
1247
1258
|
* });
|
|
1248
1259
|
*/
|
|
1249
1260
|
createRefundTicket(params: CreateRefundTicketParams): Promise<{
|
|
@@ -1313,12 +1324,13 @@ declare class CheckoutAnonymousResource {
|
|
|
1313
1324
|
* });
|
|
1314
1325
|
*
|
|
1315
1326
|
* @example
|
|
1316
|
-
* // Pre-fill email
|
|
1327
|
+
* // Pre-fill email + billing + attach business-side order reference
|
|
1317
1328
|
* const result = await client.checkout.anonymous.create({
|
|
1318
1329
|
* productId: "PROD_xxx",
|
|
1319
1330
|
* currency: "USD",
|
|
1320
1331
|
* buyerEmail: "customer@example.com",
|
|
1321
1332
|
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
1333
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
1322
1334
|
* });
|
|
1323
1335
|
*/
|
|
1324
1336
|
create(params: AnonymousCheckoutParams): Promise<CheckoutSessionResult & {
|
|
@@ -1356,6 +1368,7 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1356
1368
|
* currency: "USD",
|
|
1357
1369
|
* buyerIdentity: "user-123",
|
|
1358
1370
|
* buyerEmail: "customer@example.com",
|
|
1371
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
1359
1372
|
* });
|
|
1360
1373
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
1361
1374
|
*/
|
package/dist/index.js
CHANGED
|
@@ -271,6 +271,11 @@ function validateEnum(field, value, allowed) {
|
|
|
271
271
|
fail(`Invalid ${field}: expected one of [${allowed.join(", ")}], got "${value}"`);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
+
function validateMaxLength(field, value, max) {
|
|
275
|
+
if (value !== void 0 && value.length > max) {
|
|
276
|
+
fail(`${field} must be at most ${max} characters, got ${value.length}`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
274
279
|
function validatePositiveInteger(field, value) {
|
|
275
280
|
if (!Number.isInteger(value) || value <= 0) {
|
|
276
281
|
fail(`Invalid ${field}: expected positive integer, got ${value}`);
|
|
@@ -313,6 +318,7 @@ function validateCheckoutCommon(params) {
|
|
|
313
318
|
if (params.expiresInSeconds !== void 0) {
|
|
314
319
|
validatePositiveInteger("expiresInSeconds", params.expiresInSeconds);
|
|
315
320
|
}
|
|
321
|
+
validateMaxLength("orderMerchantExternalId", params.orderMerchantExternalId, 128);
|
|
316
322
|
}
|
|
317
323
|
|
|
318
324
|
// src/resources/auth.ts
|
|
@@ -415,6 +421,7 @@ var BuyerSession = class {
|
|
|
415
421
|
* paymentId: "PAY_xxx",
|
|
416
422
|
* reason: "Product not as described",
|
|
417
423
|
* requestedAmount: { amount: "29.00", currency: "USD" },
|
|
424
|
+
* refundTicketMerchantExternalId: "REF-2026-00891",
|
|
418
425
|
* });
|
|
419
426
|
*/
|
|
420
427
|
async createRefundTicket(params) {
|
|
@@ -422,6 +429,7 @@ var BuyerSession = class {
|
|
|
422
429
|
validateRequired("reason", params.reason);
|
|
423
430
|
validateAmountString("requestedAmount.amount", params.requestedAmount.amount);
|
|
424
431
|
validateCurrencyCode("requestedAmount.currency", params.requestedAmount.currency);
|
|
432
|
+
validateMaxLength("refundTicketMerchantExternalId", params.refundTicketMerchantExternalId, 128);
|
|
425
433
|
return unwrapAction(await this.http.post("/v1/actions/refund-ticket/create-ticket", params));
|
|
426
434
|
}
|
|
427
435
|
/**
|
|
@@ -488,12 +496,13 @@ var CheckoutAnonymousResource = class {
|
|
|
488
496
|
* });
|
|
489
497
|
*
|
|
490
498
|
* @example
|
|
491
|
-
* // Pre-fill email
|
|
499
|
+
* // Pre-fill email + billing + attach business-side order reference
|
|
492
500
|
* const result = await client.checkout.anonymous.create({
|
|
493
501
|
* productId: "PROD_xxx",
|
|
494
502
|
* currency: "USD",
|
|
495
503
|
* buyerEmail: "customer@example.com",
|
|
496
504
|
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
505
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
497
506
|
* });
|
|
498
507
|
*/
|
|
499
508
|
async create(params) {
|
|
@@ -529,6 +538,7 @@ var CheckoutAuthenticatedResource = class {
|
|
|
529
538
|
* currency: "USD",
|
|
530
539
|
* buyerIdentity: "user-123",
|
|
531
540
|
* buyerEmail: "customer@example.com",
|
|
541
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
532
542
|
* });
|
|
533
543
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
534
544
|
*/
|