@@ -10,7 +10,6 @@ import { Sha256 } from '@aws-crypto/sha256-js';
1010import { defaultProvider } from '@aws-sdk/credential-provider-node' ;
1111import { HttpRequest } from '@smithy/protocol-http' ;
1212import { SignatureV4 } from '@smithy/signature-v4' ;
13- import { randomUUID } from 'node:crypto' ;
1413
1514// ============================================================================
1615// Types
@@ -63,31 +62,6 @@ export interface PaymentCredentialProviderDetail {
6362 status : string ;
6463}
6564
66- // ── Create Payment Manager ────────────────────────────────────────────────
67-
68- export interface CreatePaymentManagerOptions {
69- region : string ;
70- name : string ;
71- description ?: string ;
72- authorizerType ?: 'AWS_IAM' | 'CUSTOM_JWT' ;
73- authorizerConfiguration ?: {
74- customJWTAuthorizer ?: {
75- discoveryUrl : string ;
76- allowedClients ?: string [ ] ;
77- allowedAudience ?: string [ ] ;
78- allowedScopes ?: string [ ] ;
79- } ;
80- } ;
81- roleArn : string ;
82- clientToken : string ;
83- }
84-
85- export interface CreatePaymentManagerResult {
86- paymentManagerId : string ;
87- paymentManagerArn : string ;
88- status : string ;
89- }
90-
9165// ── Get Payment Manager ───────────────────────────────────────────────────
9266
9367export interface GetPaymentManagerOptions {
@@ -104,79 +78,6 @@ export interface PaymentManagerDetail {
10478 roleArn ?: string ;
10579}
10680
107- // ── List Payment Managers ──────────────────────────────────────────────────
108-
109- export interface ListPaymentManagersOptions {
110- region : string ;
111- maxResults ?: number ;
112- nextToken ?: string ;
113- }
114-
115- export interface PaymentManagerSummary {
116- paymentManagerId : string ;
117- paymentManagerArn : string ;
118- name : string ;
119- status : string ;
120- }
121-
122- export interface ListPaymentManagersResult {
123- paymentManagers : PaymentManagerSummary [ ] ;
124- nextToken ?: string ;
125- }
126-
127- // ── Delete Payment Manager ────────────────────────────────────────────────
128-
129- export interface DeletePaymentManagerOptions {
130- region : string ;
131- paymentManagerId : string ;
132- clientToken ?: string ;
133- }
134-
135- // ── Create Payment Connector ───────────────────────────────────────────────
136-
137- export interface CreatePaymentConnectorOptions {
138- region : string ;
139- paymentManagerId : string ;
140- name : string ;
141- description ?: string ;
142- credentialProviderArn : string ;
143- clientToken : string ;
144- vendor ?: 'CoinbaseCDP' | 'StripePrivy' ;
145- }
146-
147- export interface CreatePaymentConnectorResult {
148- paymentConnectorId : string ;
149- status : string ;
150- }
151-
152- // ── Delete Payment Connector ───────────────────────────────────────────────
153-
154- export interface DeletePaymentConnectorOptions {
155- region : string ;
156- paymentManagerId : string ;
157- paymentConnectorId : string ;
158- }
159-
160- // ── List Payment Connectors ────────────────────────────────────────────────
161-
162- export interface ListPaymentConnectorsOptions {
163- region : string ;
164- paymentManagerId : string ;
165- maxResults ?: number ;
166- nextToken ?: string ;
167- }
168-
169- export interface PaymentConnectorSummary {
170- paymentConnectorId : string ;
171- name : string ;
172- status : string ;
173- }
174-
175- export interface ListPaymentConnectorsResult {
176- paymentConnectors : PaymentConnectorSummary [ ] ;
177- nextToken ?: string ;
178- }
179-
18081// ============================================================================
18182// HTTP signing helper
18283// ============================================================================
@@ -269,13 +170,6 @@ async function signedRequest(options: {
269170 return response . json ( ) ;
270171}
271172
272- /**
273- * Generate a client token that meets the >= 33 char minimum for idempotency.
274- */
275- export function generateClientToken ( ) : string {
276- return `${ randomUUID ( ) } -${ randomUUID ( ) } ` ;
277- }
278-
279173// ============================================================================
280174// Payment Credential Provider Operations
281175// ============================================================================
@@ -405,31 +299,6 @@ export async function deletePaymentCredentialProvider(options: { region: string;
405299// Payment Manager Operations
406300// ============================================================================
407301
408- export async function createPaymentManager ( options : CreatePaymentManagerOptions ) : Promise < CreatePaymentManagerResult > {
409- const clientToken = options . clientToken || generateClientToken ( ) ;
410- const body = JSON . stringify ( {
411- name : options . name ,
412- ...( options . description && { description : options . description } ) ,
413- authorizerType : options . authorizerType ?? 'AWS_IAM' ,
414- ...( options . authorizerConfiguration && { authorizerConfiguration : options . authorizerConfiguration } ) ,
415- roleArn : options . roleArn ,
416- clientToken,
417- } ) ;
418-
419- try {
420- return ( await signedRequest ( {
421- region : options . region ,
422- method : 'POST' ,
423- path : '/payments/managers' ,
424- body,
425- } ) ) as CreatePaymentManagerResult ;
426- } catch ( err ) {
427- throw new Error (
428- `Failed to create payment manager "${ options . name } ": ${ err instanceof Error ? err . message : String ( err ) } `
429- ) ;
430- }
431- }
432-
433302export async function getPaymentManager ( options : GetPaymentManagerOptions ) : Promise < PaymentManagerDetail | null > {
434303 try {
435304 return ( await signedRequest ( {
@@ -444,114 +313,6 @@ export async function getPaymentManager(options: GetPaymentManagerOptions): Prom
444313 }
445314}
446315
447- export async function listPaymentManagers ( options : ListPaymentManagersOptions ) : Promise < ListPaymentManagersResult > {
448- const body : Record < string , unknown > = { } ;
449- if ( options . maxResults ) body . maxResults = options . maxResults ;
450- if ( options . nextToken ) body . nextToken = options . nextToken ;
451-
452- const data = await signedRequest ( {
453- region : options . region ,
454- method : 'POST' ,
455- path : '/payments/managers-list' ,
456- body : JSON . stringify ( body ) ,
457- } ) ;
458-
459- const result = data as ListPaymentManagersResult ;
460- return {
461- paymentManagers : result . paymentManagers ?? [ ] ,
462- nextToken : result . nextToken ,
463- } ;
464- }
465-
466- export async function deletePaymentManager ( options : DeletePaymentManagerOptions ) : Promise < void > {
467- const clientToken = options . clientToken ?? generateClientToken ( ) ;
468-
469- try {
470- await signedRequest ( {
471- region : options . region ,
472- method : 'DELETE' ,
473- path : `/payments/managers/${ encodeURIComponent ( options . paymentManagerId ) } ?clientToken=${ encodeURIComponent ( clientToken ) } ` ,
474- } ) ;
475- } catch ( err ) {
476- throw new Error (
477- `Failed to delete payment manager "${ options . paymentManagerId } ": ${ err instanceof Error ? err . message : String ( err ) } `
478- ) ;
479- }
480- }
481-
482- // ============================================================================
483- // Payment Connector Operations
484- // ============================================================================
485-
486- export async function createPaymentConnector (
487- options : CreatePaymentConnectorOptions
488- ) : Promise < CreatePaymentConnectorResult > {
489- const clientToken = options . clientToken || generateClientToken ( ) ;
490- const vendor = options . vendor ?? 'CoinbaseCDP' ;
491- const credConfigKey = vendor === 'StripePrivy' ? 'stripePrivy' : 'coinbaseCDP' ;
492- const body = JSON . stringify ( {
493- name : options . name ,
494- ...( options . description && { description : options . description } ) ,
495- type : vendor ,
496- credentialProviderConfigurations : [
497- {
498- [ credConfigKey ] : {
499- credentialProviderArn : options . credentialProviderArn ,
500- } ,
501- } ,
502- ] ,
503- clientToken,
504- } ) ;
505-
506- try {
507- return ( await signedRequest ( {
508- region : options . region ,
509- method : 'POST' ,
510- path : `/payments/managers/${ encodeURIComponent ( options . paymentManagerId ) } /connectors` ,
511- body,
512- } ) ) as CreatePaymentConnectorResult ;
513- } catch ( err ) {
514- throw new Error (
515- `Failed to create payment connector "${ options . name } " for manager ${ options . paymentManagerId } : ${ err instanceof Error ? err . message : String ( err ) } `
516- ) ;
517- }
518- }
519-
520- export async function deletePaymentConnector ( options : DeletePaymentConnectorOptions ) : Promise < void > {
521- try {
522- await signedRequest ( {
523- region : options . region ,
524- method : 'DELETE' ,
525- path : `/payments/managers/${ encodeURIComponent ( options . paymentManagerId ) } /connectors/${ encodeURIComponent ( options . paymentConnectorId ) } ` ,
526- } ) ;
527- } catch ( err ) {
528- throw new Error (
529- `Failed to delete payment connector "${ options . paymentConnectorId } ": ${ err instanceof Error ? err . message : String ( err ) } `
530- ) ;
531- }
532- }
533-
534- export async function listPaymentConnectors (
535- options : ListPaymentConnectorsOptions
536- ) : Promise < ListPaymentConnectorsResult > {
537- const body : Record < string , unknown > = { } ;
538- if ( options . maxResults ) body . maxResults = options . maxResults ;
539- if ( options . nextToken ) body . nextToken = options . nextToken ;
540-
541- const data = await signedRequest ( {
542- region : options . region ,
543- method : 'POST' ,
544- path : `/payments/managers/${ encodeURIComponent ( options . paymentManagerId ) } /connectors-list` ,
545- body : JSON . stringify ( body ) ,
546- } ) ;
547-
548- const result = data as ListPaymentConnectorsResult ;
549- return {
550- paymentConnectors : result . paymentConnectors ?? [ ] ,
551- nextToken : result . nextToken ,
552- } ;
553- }
554-
555316// ============================================================================
556317// Data Plane Operations (Payment Sessions)
557318// ============================================================================
0 commit comments