import ApiKeyAuthenticatedService from "../apiKeyAuthenticatedService" ; import Client from "../client" ; import getJsonResponse from "../helpers/getJsonResponse" ; import PaymentMethods from "./resource/checkout/paymentMethods" ; import Payments from "./resource/checkout/payments" ; import PaymentsDetails from "./resource/checkout/paymentsDetails" ; import PaymentSession from "./resource/checkout/paymentSession" ; import PaymentsResult from "./resource/checkout/paymentsResult" ; import PaymentLinks from "./resource/checkout/paymentLinks" ; import OriginKeys from "./resource/checkout/originKeys" ; import setApplicationInfo from "../helpers/setApplicationInfo" ; import { IRequest } from "../typings/requestOptions" ; import { PaymentRequest , PaymentResponse , PaymentMethodsRequest , PaymentMethodsResponse , PaymentLinkResource , CreatePaymentLinkRequest , DetailsRequest , PaymentSetupRequest , PaymentSetupResponse , PaymentVerificationRequest , PaymentVerificationResponse , CheckoutUtilityRequest , CheckoutUtilityResponse , CheckoutBalanceCheckRequest , CheckoutBalanceCheckResponse , CheckoutCreateOrderRequest , CheckoutCreateOrderResponse , CheckoutCancelOrderRequest , CheckoutCancelOrderResponse , CreateCheckoutSessionRequest , CreateCheckoutSessionResponse , PaymentDonationRequest , DonationResponse } from "../typings/checkout/models" ; import PaymentLinksId from "./resource/checkout/paymentLinksId" ; import PaymentMethodsBalance from "./resource/checkout/paymentMethodsBalance" ; import Orders from "./resource/checkout/orders" ; import OrdersCancel from "./resource/checkout/ordersCancel" ; import Sessions from "./resource/checkout/sessions" ; import Donations from "./resource/checkout/donations" ; class Checkout extends ApiKeyAuthenticatedService { private readonly _payments : Payments ; private readonly _paymentMethods : PaymentMethods ; private readonly _paymentsDetails : PaymentsDetails ; private readonly _paymentSession : PaymentSession ; private readonly _paymentsResult : PaymentsResult ; private readonly _paymentLinks : PaymentLinks ; private readonly _paymentLinksId : PaymentLinksId ; private readonly _originKeys : OriginKeys ; private readonly _paymentMethodsBalance : PaymentMethodsBalance ; private readonly _orders : Orders ; private readonly _ordersCancel : OrdersCancel ; private readonly _sessions : Sessions ; private readonly _donations : Donations ; public constructor ( client ) { super ( client ) ; this . _payments = new Payments ( this ) ; this . _paymentMethods = new PaymentMethods ( this ) ; this . _paymentsDetails = new PaymentsDetails ( this ) ; this . _paymentSession = new PaymentSession ( this ) ; this . _paymentsResult = new PaymentsResult ( this ) ; this . _paymentLinks = new PaymentLinks ( this ) ; this . _paymentLinksId = new PaymentLinksId ( this ) ; this . _originKeys = new OriginKeys ( this ) ; this . _paymentMethodsBalance = new PaymentMethodsBalance ( this ) ; this . _orders = new Orders ( this ) ; this . _ordersCancel = new OrdersCancel ( this ) ; this . _sessions = new Sessions ( this ) ; this . _donations = new Donations ( this ) ; } public payments ( paymentsRequest , requestOptions ? ) { return getJsonResponse < PaymentRequest , PaymentResponse > ( this . _payments , setApplicationInfo ( paymentsRequest ) , requestOptions ) ; } public paymentMethods ( paymentMethodsRequest ) { return getJsonResponse < PaymentMethodsRequest , PaymentMethodsResponse > ( this . _paymentMethods , paymentMethodsRequest ) ; } public paymentLinks ( paymentLinkRequest ) { return getJsonResponse < CreatePaymentLinkRequest , PaymentLinkResource > ( this . _paymentLinks , paymentLinkRequest ) ; } public getPaymentLinks ( linkId ) { this . _paymentLinksId . id = linkId ; return getJsonResponse < Record < string , never > , PaymentLinkResource > ( this . _paymentLinksId , { } , { method : "GET" } ) ; } public updatePaymentLinks ( linkId , status ) { this . _paymentLinksId . id = linkId ; return getJsonResponse < Record < string , unknown > , PaymentLinkResource > ( this . _paymentLinksId , { status } , { method : "PATCH" } ) ; } public paymentsDetails ( paymentsDetailsRequest , requestOptions ? ) { return getJsonResponse < DetailsRequest , PaymentResponse > ( this . _paymentsDetails , paymentsDetailsRequest , requestOptions ) ; } public paymentSession ( paymentSessionRequest , requestOptions ? ) { return getJsonResponse < PaymentSetupRequest , PaymentSetupResponse > ( this . _paymentSession , paymentSessionRequest , requestOptions ) ; } public paymentResult ( paymentResultRequest ) { return getJsonResponse < PaymentVerificationRequest , PaymentVerificationResponse > ( this . _paymentsResult , paymentResultRequest ) ; } public originKeys ( originKeysRequest ) { return getJsonResponse < CheckoutUtilityRequest , CheckoutUtilityResponse > ( this . _originKeys , originKeysRequest ) ; } public paymentMethodsBalance ( paymentMethodsBalanceRequest ) { return getJsonResponse < CheckoutBalanceCheckRequest , CheckoutBalanceCheckResponse > ( this . _paymentMethodsBalance , paymentMethodsBalanceRequest ) ; } public orders ( ordersRequest ) { return getJsonResponse < CheckoutCreateOrderRequest , CheckoutCreateOrderResponse > ( this . _orders , ordersRequest ) ; } public ordersCancel ( ordersCancelRequest ) { return getJsonResponse < CheckoutCancelOrderRequest , CheckoutCancelOrderResponse > ( this . _ordersCancel , ordersCancelRequest ) ; } public sessions ( checkoutSessionRequest ) { return getJsonResponse < CreateCheckoutSessionRequest , CreateCheckoutSessionResponse > ( this . _sessions , checkoutSessionRequest ) ; } public donations ( donationRequest ) { return getJsonResponse < PaymentDonationRequest , DonationResponse > ( this . _donations , donationRequest ) ; } } export default Checkout ;