| 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 TranslatePinDataRequest extends Omit< |
| 7 | paymentcryptographydata.TranslatePinDataInput, |
| 8 | "IncomingKeyIdentifier" | "OutgoingKeyIdentifier" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `payment-cryptography:TranslatePinData` — translates |
| 13 | * an encrypted PIN block from one PIN encryption {@link Key} (and ISO 9564 |
| 14 | * format) to another without the PIN ever leaving the service. This is the |
| 15 | * core acquirer operation for forwarding PIN blocks between networks. |
| 16 | * Provide `TranslatePinDataHttp` on the Function to satisfy this service. |
| 17 | * ### PIN Data |
| 18 | * **Example:** Translate a PIN block between two PEKs |
| 19 | * ```typescript |
| 20 | * // init |
| 21 | * const translatePin = yield* PaymentCryptography.TranslatePinData(pek, partnerPek); |
| 22 | * |
| 23 | * // runtime |
| 24 | * const translated = yield* translatePin({ |
| 25 | * IncomingTranslationAttributes: { |
| 26 | * IsoFormat0: { PrimaryAccountNumber: pan }, |
| 27 | * }, |
| 28 | * OutgoingTranslationAttributes: { |
| 29 | * IsoFormat0: { PrimaryAccountNumber: pan }, |
| 30 | * }, |
| 31 | * EncryptedPinBlock: encryptedPinBlock, |
| 32 | * }); |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | */ |
| 37 | export interface TranslatePinData extends Binding.Service< |
| 38 | TranslatePinData, |
| 39 | "AWS.PaymentCryptography.TranslatePinData", |
| 40 | <In extends Key, Out extends Key>( |
| 41 | incomingKey: In, |
| 42 | outgoingKey: Out, |
| 43 | ) => Effect.Effect< |
| 44 | ( |
| 45 | request: TranslatePinDataRequest, |
| 46 | ) => Effect.Effect< |
| 47 | paymentcryptographydata.TranslatePinDataOutput, |
| 48 | paymentcryptographydata.TranslatePinDataError |
| 49 | > |
| 50 | > |
| 51 | > {} |
| 52 | |
| 53 | export const TranslatePinData = Binding.Service<TranslatePinData>( |
| 54 | "AWS.PaymentCryptography.TranslatePinData", |
| 55 | ); |