@siglume/direct-request-payment 0.4.18 → 0.4.20

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/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ declare const DIRECT_REQUEST_PAYMENT_RECEIPT_KIND = "sdrp_direct_payment";
6
6
  declare const DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND = "sdrp_direct_payment_allowance";
7
7
  declare const DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE = "sdrp_direct_payment_requirement";
8
8
  declare const DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
9
- declare const DIRECT_REQUEST_PAYMENT_SDK_VERSION = "0.4.18";
9
+ declare const DIRECT_REQUEST_PAYMENT_SDK_VERSION = "0.4.20";
10
10
  declare const DIRECT_REQUEST_PAYMENT_STANDARD_SETTLED_STATUS = "settled";
11
11
  declare const DIRECT_REQUEST_PAYMENT_METERED_ACCEPTED_STATUS = "pending_settlement";
12
12
  declare const DIRECT_REQUEST_PAYMENT_STANDARD_FINALITY = "per_payment_onchain";
@@ -433,6 +433,27 @@ interface DirectRequestPaymentWebhookSubscription {
433
433
  event_types?: string[];
434
434
  [key: string]: unknown;
435
435
  }
436
+ interface DirectRequestPaymentWebhookTestDeliveryInput {
437
+ event_type: string;
438
+ data?: Record<string, unknown>;
439
+ subscription_ids?: string[];
440
+ }
441
+ interface DirectRequestPaymentWebhookDelivery {
442
+ id?: string;
443
+ subscription_id?: string;
444
+ event_id?: string;
445
+ event_type?: string;
446
+ delivery_status?: string;
447
+ response_status?: number | null;
448
+ delivered_at?: string | null;
449
+ [key: string]: unknown;
450
+ }
451
+ interface DirectRequestPaymentWebhookDeliveryListInput {
452
+ subscription_id?: string;
453
+ event_type?: string;
454
+ status?: string;
455
+ limit?: number;
456
+ }
436
457
  interface DirectRequestPaymentCheckoutSetupInput extends DirectRequestPaymentMerchantSetupInput {
437
458
  create_webhook_subscription?: boolean;
438
459
  prepare_billing_mandate?: boolean;
@@ -612,6 +633,9 @@ declare class DirectRequestPaymentMerchantClient {
612
633
  rotateChallengeSecret(merchant: string): Promise<DirectRequestPaymentMerchantResponse>;
613
634
  prepareBillingMandate(merchant: string, input?: DirectRequestPaymentMerchantBillingMandateInput): Promise<DirectRequestPaymentMerchantResponse>;
614
635
  createWebhookSubscription(input: DirectRequestPaymentWebhookSubscriptionInput): Promise<DirectRequestPaymentWebhookSubscription>;
636
+ listWebhookSubscriptions(): Promise<DirectRequestPaymentWebhookSubscription[]>;
637
+ queueWebhookTestDelivery(input: DirectRequestPaymentWebhookTestDeliveryInput): Promise<Record<string, unknown>>;
638
+ listWebhookDeliveries(input?: DirectRequestPaymentWebhookDeliveryListInput): Promise<DirectRequestPaymentWebhookDelivery[]>;
615
639
  setupCheckout(input: DirectRequestPaymentCheckoutSetupInput): Promise<DirectRequestPaymentCheckoutSetupResult>;
616
640
  request<T>(method: string, path: string, json_body?: unknown): Promise<T>;
617
641
  private requestHostedCheckout;
@@ -700,4 +724,4 @@ declare const verifyExternal402Challenge: typeof verifyDirectRequestPaymentChall
700
724
  declare const createExternal402RecurringChallenge: typeof createDirectRequestPaymentRecurringChallenge;
701
725
  declare const verifyExternal402RecurringChallenge: typeof verifyDirectRequestPaymentRecurringChallenge;
702
726
 
703
- export { DEFAULT_SIGLUME_API_BASE, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_METERED_ACCEPTED_STATUS, DIRECT_REQUEST_PAYMENT_METERED_FINALITY, DIRECT_REQUEST_PAYMENT_MODE, DIRECT_REQUEST_PAYMENT_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE, DIRECT_REQUEST_PAYMENT_SDK_VERSION, DIRECT_REQUEST_PAYMENT_STANDARD_FINALITY, DIRECT_REQUEST_PAYMENT_STANDARD_SETTLED_STATUS, type DirectPaymentConfirmationClassification, type DirectPaymentConfirmationKind, type DirectPaymentConfirmationUnknownReason, type DirectPaymentMeteredBatchSettledClassification, type DirectPaymentMeteredUsageAcceptedClassification, type DirectPaymentRequirement, type DirectPaymentRequirementCreateInput, type DirectPaymentStandardSettledClassification, type DirectPaymentUnknownClassification, type DirectPaymentVerifyInput, type DirectRequestPaymentBalanceSufficiency, type DirectRequestPaymentBillingPlan, type DirectRequestPaymentBuyerMeteredQuery, type DirectRequestPaymentBuyerMeteredSummary, type DirectRequestPaymentBuyerUsageEvent, type DirectRequestPaymentChallenge, type DirectRequestPaymentChallengeInput, type DirectRequestPaymentCheckoutSetupInput, type DirectRequestPaymentCheckoutSetupResult, DirectRequestPaymentClient, type DirectRequestPaymentClientOptions, type DirectRequestPaymentCurrency, type DirectRequestPaymentListResponse, type DirectRequestPaymentMerchantAccount, type DirectRequestPaymentMerchantBillingMandateInput, DirectRequestPaymentMerchantClient, type DirectRequestPaymentMerchantResponse, type DirectRequestPaymentMerchantSetupInput, type DirectRequestPaymentMeteredListQuery, type DirectRequestPaymentMeteredOpenPeriod, type DirectRequestPaymentMeteredPlanType, type DirectRequestPaymentMinorAmount, type DirectRequestPaymentPastDueBlock, type DirectRequestPaymentProviderMeteredListQuery, type DirectRequestPaymentProviderMeteredQuery, type DirectRequestPaymentProviderMeteredSummary, type DirectRequestPaymentProviderMeteredTotals, type DirectRequestPaymentProviderUsageEvent, type DirectRequestPaymentRawWebhookBody, type DirectRequestPaymentRecurringCadence, type DirectRequestPaymentRecurringChallenge, type DirectRequestPaymentRecurringChallengeInput, type DirectRequestPaymentSettlementBatch, type DirectRequestPaymentSettlementTrigger, type DirectRequestPaymentToken, type DirectRequestPaymentWebhookEvent, type DirectRequestPaymentWebhookSignatureBody, type DirectRequestPaymentWebhookSubscription, type DirectRequestPaymentWebhookSubscriptionInput, HostedCheckoutNotAvailableError, type HostedCheckoutSession, type HostedCheckoutSessionCreateInput, type HostedCheckoutSessionCreateResult, type ParsedDirectRequestPaymentChallenge, SiglumeApiError, SiglumeDirectRequestPaymentError, type SiglumeEnvelopeMeta, SiglumeWebhookPayloadError, SiglumeWebhookSignatureError, type Web3PreparedTransactionExecutePayload, type Web3PreparedTransactionExecuteResult, type Web3TransactionRequest, type WebhookSignatureVerification, buildAllowanceExecutionPayload, buildPaymentExecutionPayload, buildPreparedTransactionExecutionPayload, buildWebhookSignatureHeader, classifyDirectPaymentConfirmation, computeWebhookSignature, createDirectRequestPaymentChallenge, createDirectRequestPaymentChallengeSignature, createDirectRequestPaymentRecurringChallenge, createDirectRequestPaymentRecurringChallengeSignature, createExternal402Challenge, createExternal402RecurringChallenge, directRequestPaymentChallengeHash, directRequestPaymentRequestHash, directRequestPaymentRequestHashV2, parseDirectRequestPaymentChallenge, parseDirectRequestPaymentWebhookEvent, verifyDirectRequestPaymentChallenge, verifyDirectRequestPaymentRecurringChallenge, verifyDirectRequestPaymentWebhook, verifyExternal402Challenge, verifyExternal402RecurringChallenge, verifyWebhookSignature };
727
+ export { DEFAULT_SIGLUME_API_BASE, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_METERED_ACCEPTED_STATUS, DIRECT_REQUEST_PAYMENT_METERED_FINALITY, DIRECT_REQUEST_PAYMENT_MODE, DIRECT_REQUEST_PAYMENT_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE, DIRECT_REQUEST_PAYMENT_SDK_VERSION, DIRECT_REQUEST_PAYMENT_STANDARD_FINALITY, DIRECT_REQUEST_PAYMENT_STANDARD_SETTLED_STATUS, type DirectPaymentConfirmationClassification, type DirectPaymentConfirmationKind, type DirectPaymentConfirmationUnknownReason, type DirectPaymentMeteredBatchSettledClassification, type DirectPaymentMeteredUsageAcceptedClassification, type DirectPaymentRequirement, type DirectPaymentRequirementCreateInput, type DirectPaymentStandardSettledClassification, type DirectPaymentUnknownClassification, type DirectPaymentVerifyInput, type DirectRequestPaymentBalanceSufficiency, type DirectRequestPaymentBillingPlan, type DirectRequestPaymentBuyerMeteredQuery, type DirectRequestPaymentBuyerMeteredSummary, type DirectRequestPaymentBuyerUsageEvent, type DirectRequestPaymentChallenge, type DirectRequestPaymentChallengeInput, type DirectRequestPaymentCheckoutSetupInput, type DirectRequestPaymentCheckoutSetupResult, DirectRequestPaymentClient, type DirectRequestPaymentClientOptions, type DirectRequestPaymentCurrency, type DirectRequestPaymentListResponse, type DirectRequestPaymentMerchantAccount, type DirectRequestPaymentMerchantBillingMandateInput, DirectRequestPaymentMerchantClient, type DirectRequestPaymentMerchantResponse, type DirectRequestPaymentMerchantSetupInput, type DirectRequestPaymentMeteredListQuery, type DirectRequestPaymentMeteredOpenPeriod, type DirectRequestPaymentMeteredPlanType, type DirectRequestPaymentMinorAmount, type DirectRequestPaymentPastDueBlock, type DirectRequestPaymentProviderMeteredListQuery, type DirectRequestPaymentProviderMeteredQuery, type DirectRequestPaymentProviderMeteredSummary, type DirectRequestPaymentProviderMeteredTotals, type DirectRequestPaymentProviderUsageEvent, type DirectRequestPaymentRawWebhookBody, type DirectRequestPaymentRecurringCadence, type DirectRequestPaymentRecurringChallenge, type DirectRequestPaymentRecurringChallengeInput, type DirectRequestPaymentSettlementBatch, type DirectRequestPaymentSettlementTrigger, type DirectRequestPaymentToken, type DirectRequestPaymentWebhookDelivery, type DirectRequestPaymentWebhookDeliveryListInput, type DirectRequestPaymentWebhookEvent, type DirectRequestPaymentWebhookSignatureBody, type DirectRequestPaymentWebhookSubscription, type DirectRequestPaymentWebhookSubscriptionInput, type DirectRequestPaymentWebhookTestDeliveryInput, HostedCheckoutNotAvailableError, type HostedCheckoutSession, type HostedCheckoutSessionCreateInput, type HostedCheckoutSessionCreateResult, type ParsedDirectRequestPaymentChallenge, SiglumeApiError, SiglumeDirectRequestPaymentError, type SiglumeEnvelopeMeta, SiglumeWebhookPayloadError, SiglumeWebhookSignatureError, type Web3PreparedTransactionExecutePayload, type Web3PreparedTransactionExecuteResult, type Web3TransactionRequest, type WebhookSignatureVerification, buildAllowanceExecutionPayload, buildPaymentExecutionPayload, buildPreparedTransactionExecutionPayload, buildWebhookSignatureHeader, classifyDirectPaymentConfirmation, computeWebhookSignature, createDirectRequestPaymentChallenge, createDirectRequestPaymentChallengeSignature, createDirectRequestPaymentRecurringChallenge, createDirectRequestPaymentRecurringChallengeSignature, createExternal402Challenge, createExternal402RecurringChallenge, directRequestPaymentChallengeHash, directRequestPaymentRequestHash, directRequestPaymentRequestHashV2, parseDirectRequestPaymentChallenge, parseDirectRequestPaymentWebhookEvent, verifyDirectRequestPaymentChallenge, verifyDirectRequestPaymentRecurringChallenge, verifyDirectRequestPaymentWebhook, verifyExternal402Challenge, verifyExternal402RecurringChallenge, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var DIRECT_REQUEST_PAYMENT_RECEIPT_KIND = "sdrp_direct_payment";
7
7
  var DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND = "sdrp_direct_payment_allowance";
8
8
  var DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE = "sdrp_direct_payment_requirement";
9
9
  var DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
10
- var DIRECT_REQUEST_PAYMENT_SDK_VERSION = "0.4.18";
10
+ var DIRECT_REQUEST_PAYMENT_SDK_VERSION = "0.4.20";
11
11
  var DIRECT_REQUEST_PAYMENT_STANDARD_SETTLED_STATUS = "settled";
12
12
  var DIRECT_REQUEST_PAYMENT_METERED_ACCEPTED_STATUS = "pending_settlement";
13
13
  var DIRECT_REQUEST_PAYMENT_STANDARD_FINALITY = "per_payment_onchain";
@@ -328,6 +328,30 @@ var DirectRequestPaymentMerchantClient = class {
328
328
  }
329
329
  return this.request("POST", "/market/webhooks/subscriptions", payload);
330
330
  }
331
+ async listWebhookSubscriptions() {
332
+ return this.request("GET", "/market/webhooks/subscriptions");
333
+ }
334
+ async queueWebhookTestDelivery(input) {
335
+ const payload = {
336
+ event_type: requireNonEmpty(input.event_type, "event_type")
337
+ };
338
+ if (input.data !== void 0) {
339
+ payload.data = cloneJsonObject(input.data, "data");
340
+ }
341
+ if (input.subscription_ids !== void 0) {
342
+ payload.subscription_ids = input.subscription_ids.map((subscriptionId) => requireNonEmpty(subscriptionId, "subscription_id"));
343
+ }
344
+ return this.request("POST", "/market/webhooks/test-deliveries", payload);
345
+ }
346
+ async listWebhookDeliveries(input = {}) {
347
+ const params = new URLSearchParams();
348
+ if (input.subscription_id !== void 0) params.set("subscription_id", requireNonEmpty(input.subscription_id, "subscription_id"));
349
+ if (input.event_type !== void 0) params.set("event_type", requireNonEmpty(input.event_type, "event_type"));
350
+ if (input.status !== void 0) params.set("status", requireNonEmpty(input.status, "status"));
351
+ if (input.limit !== void 0) params.set("limit", String(positiveInteger(input.limit, "limit")));
352
+ const query = params.toString();
353
+ return this.request("GET", `/market/webhooks/deliveries${query ? `?${query}` : ""}`);
354
+ }
331
355
  async setupCheckout(input) {
332
356
  const merchant = await this.setupMerchant(input);
333
357
  const merchantKey = merchant.merchant_account.merchant;