export type GatewayIdentification = {merchantId?: (string | null) | undefined, terminalIds?: Array | undefined, gatewayName?: string | undefined, bankMerchantId?: string | undefined, acquirerBank?: string | undefined, acquirerId?: string | undefined, cardBrands?: (Array<'MASTERCARD' | 'VISA' | 'AMEX' | 'DINERS_CLUB' | 'JCB' | 'DISCOVER' | 'UNION_PAY' | 'MAESTRO'>) | undefined, currencies?: Array | undefined, pennyTxnTokenRefId?: string | undefined, attributes?: Array | undefined}; export type PayToAddress = {addressLine: string, country: string, countrySubDivision: string, postCode: string, townName: string}; export type CreditorProfile = {isActive?: boolean | undefined, email?: string | undefined, gatewayIdentification?: GatewayIdentification | undefined, payToAddress?: PayToAddress | undefined, paymentMethods: Array, creditorProfileId: string, paymentProcessor?: string | undefined}; export type CreateApiCreditorAgentsIcaCreditorsCreditorIdPaymentProfilesArgs = {ica: string, creditor_id: string, body: CreditorProfile}; export type CreateApiCreditorAgentsIcaCreditorsCreditorIdPaymentProfilesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a Creditor Profile * * POST /creditor-agents/{ica}/creditors/{creditor_id}/payment-profiles */ export const createApiCreditorAgentsIcaCreditorsCreditorIdPaymentProfiles = async (args: CreateApiCreditorAgentsIcaCreditorsCreditorIdPaymentProfilesArgs, options?: CreateApiCreditorAgentsIcaCreditorsCreditorIdPaymentProfilesOptions) => { const {baseUrl = "https://api.mastercard.com/commercial/payments", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/creditor-agents/${encodeURIComponent(String(args.ica))}/creditors/${encodeURIComponent(String(args.creditor_id))}/payment-profiles${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };