@@ -29,6 +29,11 @@ import {
2929 RetryAutomaticPixPaymentRequest ,
3030 AutomaticPixPaymentListResponse ,
3131 PaymentPixAutomaticFilters ,
32+ SmartTransferPreauthorization ,
33+ CreateSmartTransferPreauthorization ,
34+ SmartTransferPayment ,
35+ CreateSmartTransferPayment ,
36+ SmartTransferPreauthorizationsFilters ,
3237} from './types'
3338
3439/**
@@ -410,4 +415,55 @@ export class PluggyPaymentsClient extends BaseApi {
410415 async cancelAutomaticPixAuthorization ( paymentRequestId : string ) : Promise < void > {
411416 await this . createPostRequest ( `payments/requests/${ paymentRequestId } /automatic-pix/cancel` )
412417 }
418+
419+ /**
420+ * Fetch all smart transfer preauthorizations
421+ * @param options SmartTransferPreauthorizationsFilters with page and pageSize
422+ * @returns {PageResponse<SmartTransferPreauthorization> } paged response of smart transfer preauthorizations
423+ */
424+ async fetchSmartTransferPreauthorizations (
425+ options : SmartTransferPreauthorizationsFilters = { }
426+ ) : Promise < PageResponse < SmartTransferPreauthorization > > {
427+ return await this . createGetRequest ( 'smart-transfers/preauthorizations' , { ...options } )
428+ }
429+
430+ /**
431+ * Creates a smart transfer preauthorization
432+ * @param payload CreateSmartTransferPreauthorization
433+ * @returns {SmartTransferPreauthorization } SmartTransferPreauthorization object
434+ */
435+ async createSmartTransferPreauthorization (
436+ payload : CreateSmartTransferPreauthorization
437+ ) : Promise < SmartTransferPreauthorization > {
438+ return await this . createPostRequest ( 'smart-transfers/preauthorizations' , null , payload )
439+ }
440+
441+ /**
442+ * Fetch a single smart transfer preauthorization
443+ * @param id ID of the smart transfer preauthorization
444+ * @returns {SmartTransferPreauthorization } SmartTransferPreauthorization object
445+ */
446+ async fetchSmartTransferPreauthorization ( id : string ) : Promise < SmartTransferPreauthorization > {
447+ return await this . createGetRequest ( `smart-transfers/preauthorizations/${ id } ` )
448+ }
449+
450+ /**
451+ * Creates a smart transfer payment
452+ * @param payload CreateSmartTransferPayment
453+ * @returns {SmartTransferPayment } SmartTransferPayment object
454+ */
455+ async createSmartTransferPayment (
456+ payload : CreateSmartTransferPayment
457+ ) : Promise < SmartTransferPayment > {
458+ return await this . createPostRequest ( 'smart-transfers/payments' , null , payload )
459+ }
460+
461+ /**
462+ * Fetch a single smart transfer payment
463+ * @param id ID of the smart transfer payment
464+ * @returns {SmartTransferPayment } SmartTransferPayment object
465+ */
466+ async fetchSmartTransferPayment ( id : string ) : Promise < SmartTransferPayment > {
467+ return await this . createGetRequest ( `smart-transfers/payments/${ id } ` )
468+ }
413469}
0 commit comments