Skip to content

Commit

Permalink
chore: improve README and bump
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Jul 26, 2024
1 parent 73f1fba commit de855b5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit de855b5

Please sign in to comment.