| 1 | import type * as paymentcryptographydata from "@distilled.cloud/aws/payment-cryptography-data"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Key } from "./Key.ts"; |
| 5 | |
| 6 | export interface GenerateAuthRequestCryptogramRequest extends Omit< |
| 7 | paymentcryptographydata.GenerateAuthRequestCryptogramInput, |
| 8 | "KeyIdentifier" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `payment-cryptography:GenerateAuthRequestCryptogram` — |
| 13 | * generates an Authorization Request Cryptogram (ARQC) for AS2805 terminal |
| 14 | * transactions under an EMV issuer master {@link Key}. Provide |
| 15 | * `GenerateAuthRequestCryptogramHttp` on the Function to satisfy this |
| 16 | * service. |
| 17 | * ### EMV Cryptograms |
| 18 | * **Example:** Generate an ARQC for transaction data |
| 19 | * ```typescript |
| 20 | * // init |
| 21 | * const generateArqc = |
| 22 | * yield* PaymentCryptography.GenerateAuthRequestCryptogram(issuerMasterKey); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const generated = yield* generateArqc({ |
| 26 | * TransactionData: transactionDataHex, |
| 27 | * MajorKeyDerivationMode: "EMV_OPTION_A", |
| 28 | * SessionKeyDerivationAttributes: { |
| 29 | * EmvCommon: { PrimaryAccountNumber: pan, PanSequenceNumber: "00", ApplicationTransactionCounter: "0001" }, |
| 30 | * }, |
| 31 | * }); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GenerateAuthRequestCryptogram extends Binding.Service< |
| 37 | GenerateAuthRequestCryptogram, |
| 38 | "AWS.PaymentCryptography.GenerateAuthRequestCryptogram", |
| 39 | <K extends Key>( |
| 40 | key: K, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: GenerateAuthRequestCryptogramRequest, |
| 44 | ) => Effect.Effect< |
| 45 | paymentcryptographydata.GenerateAuthRequestCryptogramOutput, |
| 46 | paymentcryptographydata.GenerateAuthRequestCryptogramError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | |
| 51 | export const GenerateAuthRequestCryptogram = |
| 52 | Binding.Service<GenerateAuthRequestCryptogram>( |
| 53 | "AWS.PaymentCryptography.GenerateAuthRequestCryptogram", |
| 54 | ); |