export type AuthorisationCardOperationId = string; export type CardId = string; export type CurrencyCode = string; export type AuthorisationCardDetailsMerchant = {merchantId: string, merchantNameAddress: string, merchantName?: string | undefined, city?: string | undefined, countryCode?: string | undefined, merchantType?: string | undefined}; export type DigitalCardId = string; export type AuthorisationCardDetailsDigitalCard = {digitalCardId: DigitalCardId, digitalCardRequestorId: string}; export type AuthorisationCardDetails = {isoMessageType: string, transactionDate: string, transmissionDate: string, retrievalReferenceNumber: string, stan: string, internalStan: string, actionCode: string, declinedReason?: ('INVALID_CARD_STATE' | 'INVALID_CARD_DATA' | 'CONTROL_FAIL' | 'VELOCITY_CHECK_FAIL' | 'BALANCE_CHECK_FAIL' | 'FRAUD_DETECTED' | 'TECHNICAL_ERROR' | 'ISSUER_ERROR' | 'DOMAIN_CONTROL_FAIL') | undefined, declinedDetails?: ('INVALID_CVV2' | 'INVALID_DCVV2' | 'INVALID_EXPIRY_DATE' | 'INVALID_RETRYABLE_DCVV2' | 'NO_ACTIVE_DCVV2' | 'CARD_DELETED' | 'CARD_EXPIRED' | 'CARD_REPLACED' | 'CARD_SUSPENDED' | 'CONTACTLESS_DISABLED' | 'CVV2_LOCKED' | 'EXPIRY_DATE_LOCKED' | 'PIN_LOCKED' | 'COUNTRY_NOT_ALLOWED' | 'CURRENCY_NOT_ALLOWED' | 'MAGSTRIPE_DISABLED' | 'MERCHANT_TYPE_NOT_ALLOWED' | 'ONLINE_PAYMENT_DISABLED' | 'WITHDRAWAL_DISABLED' | 'EMV_AUTHORIZATION_VERIFICATION_FAIL' | 'INVALID_PIN' | 'ABOVE_MAX_AMOUNT' | 'BELOW_MIN_AMOUNT' | 'MAX_AMOUNT_LIMIT_REACHED' | 'MAX_TRANSACTION_LIMIT_REACHED' | 'NOT_ENOUGH_FUND' | 'INVALID_MERCHANT' | 'SUSPECTED_FRAUD' | 'ACCOUNT_NOT_FOUND' | 'FUND_CHECK_FAILED' | 'TECHNICAL_ERROR') | undefined, amount: number, currencyCode: CurrencyCode, billingAmount?: number | undefined, billingCurrencyCode?: CurrencyCode | undefined, conversionRate?: number | undefined, replacementAmount?: number | undefined, replacementCurrencyCode?: CurrencyCode | undefined, accountNumber?: string | undefined, standInProcessing?: boolean | undefined, functionCode: string, messageReasonCode?: string | undefined, cardPresent?: boolean | undefined, cardDataInputMode?: string | undefined, initiatingParty?: ('CARDHOLDER' | 'MERCHANT') | undefined, acquirerCountryCode?: string | undefined, merchant: AuthorisationCardDetailsMerchant, digitalCard?: AuthorisationCardDetailsDigitalCard | undefined}; export type AuthorisationNotificationMessage = {format?: ('TEXT' | 'HTML') | undefined, title?: string | undefined, content?: string | undefined}; export type AuthorisationCardOperationNotification = {operationId: AuthorisationCardOperationId, operation: 'PURCHASE' | 'WITHDRAWAL' | 'REFUND' | 'PAYMENT' | 'OTHER', status: 'APPROVED' | 'PARTIALLY_APPROVED' | 'REVERSED' | 'DECLINED', startTime: string, errorCode?: ('INVALID_CARD_STATE' | 'INVALID_CARD_DATA' | 'CONTROL_FAIL' | 'VELOCITY_CHECK_FAIL' | 'BALANCE_CHECK_FAIL' | 'FRAUD_DETECTED' | 'TECHNICAL_ERROR' | 'ISSUER_ERROR' | 'DOMAIN_CONTROL_FAIL') | undefined, cardId: CardId, details?: AuthorisationCardDetails | undefined, message?: AuthorisationNotificationMessage | undefined}; export type CreateApiNotificationsD1V2IssuersIssuerIdAuthorisationsArgs = {body: {operations?: Array | undefined}}; export type CreateApiNotificationsD1V2IssuersIssuerIdAuthorisationsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Notify Card Authorisation Operations * * POST /notifications/d1/v2/issuers/{issuerId}/authorisations */ export const createApiNotificationsD1V2IssuersIssuerIdAuthorisations = async (args: CreateApiNotificationsD1V2IssuersIssuerIdAuthorisationsArgs, options?: CreateApiNotificationsD1V2IssuersIssuerIdAuthorisationsOptions) => { const {baseUrl = "https://api.d1.thalescloud.io/authz/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/notifications/d1/v2/issuers/${encodeURIComponent(String(args.issuerId))}/authorisations${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 };