diff --git a/README.md b/README.md index 77fc093..52af48b 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,55 @@ const ткасса = new TKassa((body) => { И типы опять же совсем не глупы и делают вам благое дело, указывая верный путь. +### Функции-хелперы + +##### [`generateSignature`](https://jsr.io/@kravets/t-kassa-api/doc/~/generateSignature) + +Генерирует подпись для запроса. + +```ts +const signature = generateSignature( + { body: "OK" }, + process.env.TERMINAL_KEY, + process.env.PASSWORD +); +``` + +##### [`encryptCardData`](https://jsr.io/@kravets/t-kassa-api/doc/~/encryptCardData) + +Шифрует данные карты. + +```ts +const cardData = encryptCardData(тк, { + PAN: "4000000000000101", + ExpDate: "1230", + CVV: "111", +}); + +const tds = await тк.check3dsVersion({ + PaymentId: response.PaymentId, + CardData: cardData, +}); +``` + +##### [`encryptThreeDSMethodData`](https://jsr.io/@kravets/t-kassa-api/doc/~/encryptThreeDSMethodData) + +Функция для получения строкового представления `ThreeDSMethodData` + +```ts +const tds = await тк.check3dsVersion({ + PaymentId: response.PaymentId, + CardData: CardData, +}); + +if (tds.ThreeDSMethodURL && tds.TdsServerTransID) { + const data = encryptThreeDSMethodData({ + threeDSMethodNotificationURL: tds.ThreeDSMethodURL, + threeDSServerTransID: tds.TdsServerTransID, + }); +} +``` + ### TODO: - поддержать `application/x-www-form-urlencoded` diff --git a/package.json b/package.json index bed012b..c67951b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "t-kassa-api", - "version": "0.1.1", + "version": "0.1.2", "module": "./dist/index.js", "main": "./dist/index.cjs", "types": "./dist/index.d.ts",