Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f564bd9
Initial commit
May 10, 2023
badba69
WIP: Add almost all of used types, enums and annotations
May 12, 2023
fa2a643
Restore original logics with injected typings
May 14, 2023
15c61d3
Fix typings in main module, add publish script and changelog
May 21, 2023
4664c1e
Merge pull request #1 from zolotarev/develop
zolotarev May 21, 2023
1b5e912
Merge pull request #1 from zolotarev/develop
zolotarev May 21, 2023
71ca5f4
Fix publish script
May 21, 2023
2d50070
Merge remote-tracking branch 'origin/master'
May 21, 2023
75e5a4f
Upgrade app version
May 21, 2023
5e12f07
Fix publish script
May 21, 2023
6fd2da1
Fix version
May 21, 2023
6e1f927
Fix publish script
May 21, 2023
5d6b94d
Fix Amount types
May 21, 2023
1ea2c84
Add new build
May 21, 2023
c507159
Fix publish
May 21, 2023
d417c7a
Upgrade app version
May 21, 2023
ce23437
Fix bank_card structure
May 21, 2023
6c394be
Upgrade app version
May 21, 2023
86521a7
Upgrade app version
May 21, 2023
037cf65
Upgrade app version
May 21, 2023
8f61ce8
Fix publish script
May 21, 2023
35390c1
Upgrade app version
May 21, 2023
04e9705
Fix publish script
May 21, 2023
0a0e033
Fix publish script
May 21, 2023
be1fa6a
Upgrade app version to 0.1.8
May 21, 2023
4aafb7b
Fix publish script
May 21, 2023
fc53c3a
Upgrade app version to 0.1.9
May 21, 2023
5332331
Release version 0.1.9
May 21, 2023
b74b62f
Upgrade app version to 0.1.10
May 21, 2023
c5d09e8
Release version 0.1.10
May 21, 2023
ad277fc
Fix publish script
May 21, 2023
95870ce
Upgrade app version to 0.1.11
May 21, 2023
bb1350a
Release version 0.1.11
May 21, 2023
c908a2a
Upgrade app version to 0.1.12
May 21, 2023
9dbabd8
Release version 0.1.12
May 21, 2023
685f413
Fix non required idempotenceKey for createPayment method
May 21, 2023
f42f0b7
Upgrade app version to 0.1.13
May 21, 2023
ff99bda
Release version 0.1.13
May 21, 2023
0e26b1f
Fix usage tips in README
May 23, 2023
0ec150d
Upgrade app version to 0.1.14
May 23, 2023
d25960d
Release version 0.1.14
May 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .auto-changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"output": "README.md",
"template": "changelog-template.md",
"unreleased": false,
"release-summary": false,
"commitLimit": false,
"replaceText": {
"(^\\+)(.*)": "$2",
"(^feature/)(.*)": "$2",
"(^fix/)(.*)": "$2"
},
"includeBranch": [
"master"
]
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib
node_modules
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
root: true,
env: {
node: true,
jest: true
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'prettier/prettier': ['error', {'endOfLine': 'lf'}],
'@typescript-eslint/ban-ts-comment': 'off',
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=lf
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
node_modules
.npmignore
.npmignore
/.idea/codeStyles/codeStyleConfig.xml
/.idea/codeStyles/Project.xml
/.idea/inspectionProfiles/Project_Default.xml
/.idea/jsLibraryMappings.xml
/.idea/vcs.xml
/.idea/workspace.xml
6 changes: 6 additions & 0 deletions .onever.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "0.1.14",
"packages": [
"package.json"
]
}
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "always",
"bracketSpacing": true,
"semi": false,
"tabWidth": 2,
"useTabs": true
}
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2020 Oleg Polyakov
Copyright (c) 2023 Andrey Zolotarev (Typescript version)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
120 changes: 97 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# YooKassa API для Node.js
# Yookassa API для Node.js

Клиент для работы с платежами по API YooKassa. Подходит тем, у кого способ подключения называется API.
Клиент для работы с платежами по API Yookassa. Подходит тем, у кого способ подключения называется API.

## Требования

Expand All @@ -10,32 +10,32 @@
## Установка

```sh
npm i yookassa
npm i yookassa-ts
```

## Начало работы

```js
const YooKassa = require('yookassa');
import YooKassa from 'yookassa-ts/lib/yookassa'

const yooKassa = new YooKassa({
shopId: '<Идентификатор магазина>',
secretKey: '<Секретный ключ>'
const yooKassa = new Yookassa({
shopId: '<Идентификатор магазина>',
secretKey: '<Секретный ключ>'
});

const payment = await yooKassa.createPayment({
amount: {
value: "2.00",
currency: "RUB"
},
payment_method_data: {
type: "bank_card"
},
confirmation: {
type: "redirect",
return_url: "https://www.merchant-website.com/return_url"
},
description: "Заказ №72"
amount: {
value: "2.00",
currency: "RUB"
},
payment_method_data: {
type: "bank_card"
},
confirmation: {
type: "redirect",
return_url: "https://www.merchant-website.com/return_url"
},
description: "Заказ №72"
});
```

Expand All @@ -50,7 +50,6 @@ const payment = await yooKassa.createPayment({
| `createRefund` | [Создание возврата](https://yookassa.ru/developers/api#create_refund) |
| `getRefund` | [Информация о возврате](https://yookassa.ru/developers/api#get_refund) |


## API платежа

### Свойства
Expand All @@ -64,7 +63,6 @@ const payment = await yooKassa.createPayment({
| `isResolved` | Равен ли статус платежа `succeeded` или `canceled` |
| `confirmationUrl` | URL для подтверждения |


### Методы

| Название | Аргументы | Описание |
Expand All @@ -74,11 +72,87 @@ const payment = await yooKassa.createPayment({
| `cancel` | | Отменить платеж |
| `refund` | amount | Вернуть платеж |


## API возврата

### Методы

| Название | Аргументы | Описание |
| --- | --- | --- |
| `reload` | | Получить информацию о возврате |
| `reload` | | Получить информацию о возврате |

## История версий
```
0.1.14 @ 24 May 2023
- Fix usage tips in README
- Upgrade app version to 0.1.14

0.1.13 @ 22 May 2023
- Upgrade app version to 0.1.13
- Release version 0.1.13
- Fix non required idempotenceKey for createPayment method

0.1.12 @ 22 May 2023
- Release version 0.1.12
- Upgrade app version to 0.1.12

0.1.11 @ 22 May 2023
- Upgrade app version to 0.1.11
- Release version 0.1.11
- Fix publish script

0.1.10 @ 22 May 2023
- Upgrade app version to 0.1.8
- Release version 0.1.9
- Fix publish script
- Release version 0.1.10
- Upgrade app version to 0.1.10
- Upgrade app version to 0.1.9
- Fix publish script
- Fix publish script

0.1.7 @ 22 May 2023
- Fix publish script
- Upgrade app version

0.1.6 @ 22 May 2023
- Upgrade app version

0.1.5 @ 22 May 2023
- Upgrade app version

0.1.4 @ 22 May 2023
- Fix bank_card structure
- Upgrade app version

0.1.3 @ 21 May 2023
- Fix publish
- Fix Amount types
- Add new build
- Upgrade app version

0.1.2 @ 21 May 2023
- Initial commit
- Restore original logics with injected typings
- WIP: Add almost all of used types, enums and annotations
- Initial commit
- Fix typings in main module, add publish script and changelog
- Fix publish script
- Update Readme
- Refactor YooKassa class
- Fix version
- Upgrade app version
- Fix publish script
- Fix publish script
- Update version
- Update README.md

```

## Контакты

Почта: [dev@its.bz](mailto:dev@its.bz)\
Сайт: [its.bz](https://its.bz)

## Лицензия

MIT
101 changes: 101 additions & 0 deletions changelog-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Yookassa API для Node.js

Клиент для работы с платежами по API Yookassa. Подходит тем, у кого способ подключения называется API.

## Требования

1. Node.js
2. npm

## Установка

```sh
npm i yookassa-ts
```

## Начало работы

```js
import YooKassa from 'yookassa-ts/lib/yookassa'

const yooKassa = new Yookassa({
shopId: '<Идентификатор магазина>',
secretKey: '<Секретный ключ>'
});

const payment = await yooKassa.createPayment({
amount: {
value: "2.00",
currency: "RUB"
},
payment_method_data: {
type: "bank_card"
},
confirmation: {
type: "redirect",
return_url: "https://www.merchant-website.com/return_url"
},
description: "Заказ №72"
});
```

## API кассы

| Метод | Описание |
| --- | --- |
| `createPayment` | [Создание платежа](https://yookassa.ru/developers/api#create_payment) |
| `getPayment` | [Информация о платеже](https://yookassa.ru/developers/api#get_payment) |
| `capturePayment` | [Подтверждение платежа](https://yookassa.ru/developers/api#capture_payment) |
| `cancelPayment` | [Отмена платежа](https://yookassa.ru/developers/api#cancel_payment) |
| `createRefund` | [Создание возврата](https://yookassa.ru/developers/api#create_refund) |
| `getRefund` | [Информация о возврате](https://yookassa.ru/developers/api#get_refund) |


## API платежа

### Свойства

| Название | Описание |
| --- | --- |
| `isPending` | Равен ли статус платежа `pending` |
| `isWaitingForCapture` | Равен ли статус платежа `waiting_for_capture` |
| `isSucceeded` | Равен ли статус платежа `succeeded` |
| `isCanceled` | Равен ли статус платежа `canceled` |
| `isResolved` | Равен ли статус платежа `succeeded` или `canceled` |
| `confirmationUrl` | URL для подтверждения |


### Методы

| Название | Аргументы | Описание |
| --- | --- | --- |
| `reload` | | Получить информацию о платеже |
| `capture` | amount | Подтвердить платеж |
| `cancel` | | Отменить платеж |
| `refund` | amount | Вернуть платеж |


## API возврата

### Методы

| Название | Аргументы | Описание |
| --- | --- | --- |
| `reload` | | Получить информацию о возврате |

## История версий
```
{{#each releases}}{{title}} @ {{niceDate}}{{#commits}}
- {{subject}}{{/commits}}

{{/each}}
```

## Контакты

Почта: [dev@its.bz](mailto:dev@its.bz)\
Сайт: [its.bz](https://its.bz)

## Лицензия

MIT
1 change: 0 additions & 1 deletion index.js

This file was deleted.

1 change: 1 addition & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './yookassa';
19 changes: 18 additions & 1 deletion lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/payment-error.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default class PaymentError extends Error {
private parameter;
constructor(error: Error);
}
Loading