Skip to content

Commit 7fb3249

Browse files
authored
Merge pull request #85 from teacoder-team/dev
Dev
2 parents 0ab5d17 + 5125a79 commit 7fb3249

48 files changed

Lines changed: 419 additions & 85 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
1-
# NestJS YooKassa Monorepo
1+
# NestJS YooKassa
2+
3+
![npm](https://img.shields.io/npm/v/nestjs-yookassa)
4+
![npm downloads](https://img.shields.io/npm/dm/nestjs-yookassa)
5+
![license](https://img.shields.io/github/license/teacoder-team/nestjs-yookassa)
6+
![stars](https://img.shields.io/github/stars/teacoder-team/nestjs-yookassa?style=social)
27

38
Этот репозиторий представляет собой монорепозиторий, в котором объединены как библиотека для интеграции с YooKassa API для NestJS, так и различные приложения, связанные с этим проектом.
49

510
## Документация
611

712
Основная документация по использованию библиотеки находится в (https://nestjs-yookassa.ru).
813

14+
## Контрибьюторы
15+
16+
<a href="https://github.com/TeaCoder52">
17+
<img src="https://avatars.githubusercontent.com/TeaCoder52" width="100" alt="TeaCoder" />
18+
</a>
19+
<a href="https://github.com/rtatarinov">
20+
<img src="https://avatars.githubusercontent.com/rtatarinov" width="100" alt="Roman Tatarinov" />
21+
</a>
22+
<a href="https://github.com/Color-Kat">
23+
<img src="https://avatars.githubusercontent.com/Color-Kat" width="100" alt="Rogov Vladislav" />
24+
</a>
25+
926
## Поддержка
1027

1128
Если у вас возникли вопросы или проблемы, не стесняйтесь обращаться к автору или создавать issues в репозитории.
1229

13-
- Автор: [TeaCoder](https://github.com/TeaCoder52)
14-
1530
## Лицензия
1631

1732
Этот проект лицензирован под [MIT License](LICENSE).

apps/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6-
"build": "next build",
6+
"build": "pnpm prepare:docs && next build",
77
"dev": "next dev",
88
"start": "next start -p 5000",
99
"types:check": "fumadocs-mdx && next typegen && tsc --noEmit",
10-
"postinstall": "fumadocs-mdx"
10+
"prepare:docs": "fumadocs-mdx"
1111
},
1212
"dependencies": {
1313
"fumadocs-core": "16.2.4",

packages/nestjs-yookassa/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,15 @@
33
С помощью этого модуля вы сможете легко создавать и управлять платежами, получать подробную информацию о транзакциях и многое другое.
44

55
Документация со всеми подробностями и примерами доступна на [nestjs-yookassa.ru](https://nestjs-yookassa.ru)
6+
7+
## Участники
8+
9+
<a href="https://github.com/TeaCoder52">
10+
<img src="https://avatars.githubusercontent.com/TeaCoder52" width="60" />
11+
</a>
12+
<a href="https://github.com/rtatarinov">
13+
<img src="https://avatars.githubusercontent.com/rtatarinov" width="60" />
14+
</a>
15+
<a href="https://github.com/Color-Kat">
16+
<img src="https://avatars.githubusercontent.com/Color-Kat" width="60" />
17+
</a>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Тип для метаданных ЮКасса.
3+
*
4+
* Ограничения ЮКасса:
5+
* - Максимум 16 ключей
6+
* - Имя ключа не больше 32 символов
7+
* - Значение ключа не больше 512 символов
8+
* - Тип данных — строка в формате UTF-8
9+
*/
10+
export type YookassaMetadata<T extends Record<string, string> = Record<string, string>> = T;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });

packages/nestjs-yookassa/dist/index.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export * from './yookassa.module';
22
export * from './yookassa.service';
33
export * from './common/enums';
44
export * from './common/interfaces';
5+
export * from './common/types/metadata.type';
56
export * from './modules/invoice/interfaces';
67
export * from './modules/invoice/enums';
78
export * from './modules/payment/interfaces';
@@ -12,4 +13,7 @@ export * from './modules/receipt/interfaces';
1213
export * from './modules/receipt/enums';
1314
export * from './modules/refund/interfaces';
1415
export * from './modules/refund/enums';
15-
export * from './webhook';
16+
export * from './webhook/enums';
17+
export * from './webhook/interfaces';
18+
export * from './webhook/decorators';
19+
export * from './webhook/guards/yookassa-webhook.guard';

packages/nestjs-yookassa/dist/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ __exportStar(require("./yookassa.service"), exports);
2020
// Common
2121
__exportStar(require("./common/enums"), exports);
2222
__exportStar(require("./common/interfaces"), exports);
23+
__exportStar(require("./common/types/metadata.type"), exports);
2324
// Invoice domain
2425
__exportStar(require("./modules/invoice/interfaces"), exports);
2526
__exportStar(require("./modules/invoice/enums"), exports);
@@ -35,5 +36,8 @@ __exportStar(require("./modules/receipt/enums"), exports);
3536
// Refund domain
3637
__exportStar(require("./modules/refund/interfaces"), exports);
3738
__exportStar(require("./modules/refund/enums"), exports);
38-
// Webhook
39-
__exportStar(require("./webhook"), exports);
39+
// Webhook domain
40+
__exportStar(require("./webhook/enums"), exports);
41+
__exportStar(require("./webhook/interfaces"), exports);
42+
__exportStar(require("./webhook/decorators"), exports);
43+
__exportStar(require("./webhook/guards/yookassa-webhook.guard"), exports);

packages/nestjs-yookassa/dist/modules/invoice/interfaces/requests/create-invoice.request.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { LocaleEnum } from '../../../../common/enums';
22
import type { Amount } from '../../../../common/interfaces';
33
import type { Receipt, Recipient } from '../../../payment/interfaces';
44
import type { DeliveryMethodEnum } from '../../enums';
5+
import type { YookassaMetadata } from '../../../../common/types/metadata.type';
56
/**
67
* Элемент корзины
78
*/
@@ -25,7 +26,7 @@ export interface DeliveryMethodData {
2526
/**
2627
* Основной объект для создания счета
2728
*/
28-
export interface CreateInvoiceRequest {
29+
export interface CreateInvoiceRequest<T extends YookassaMetadata = YookassaMetadata> {
2930
/**
3031
* Данные для проведения платежа по выставленному счету.
3132
*/
@@ -45,7 +46,7 @@ export interface CreateInvoiceRequest {
4546
/** Описание счета */
4647
description?: string;
4748
/** Дополнительные метаданные */
48-
metadata?: Record<string, string>;
49+
metadata?: T;
4950
};
5051
/** Корзина заказа */
5152
cart: CartItem[];
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import type { Invoice } from './invoice.response';
2-
export interface CreateInvoiceResponse extends Invoice {
2+
import type { YookassaMetadata } from '../../../../common/types/metadata.type';
3+
export interface CreateInvoiceResponse<T extends YookassaMetadata = YookassaMetadata> extends Invoice<T> {
34
}

packages/nestjs-yookassa/dist/modules/invoice/interfaces/responses/invoice.response.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Payment } from '../../../payment/interfaces';
22
import type { InvoiceCancellationPartyEnum, InvoiceCancellationReasonEnum, InvoiceStatusEnum } from '../../enums';
33
import type { CartItem } from '../requests';
4+
import type { YookassaMetadata } from '../../../../common/types/metadata.type';
45
/**
56
* Способ доставки счета
67
*/
@@ -22,7 +23,7 @@ export interface InvoiceCancellationDetails {
2223
/**
2324
* Детали счета
2425
*/
25-
export interface Invoice {
26+
export interface Invoice<T extends YookassaMetadata = YookassaMetadata> {
2627
/** Идентификатор счета в ЮKassa */
2728
id: string;
2829
/** Статус счета */
@@ -32,7 +33,7 @@ export interface Invoice {
3233
/** Данные о выбранном способе доставки счета */
3334
delivery_method?: DeliveryMethod;
3435
/** Данные о платеже по счету (если успешно оплачен) */
35-
payment_details?: Payment;
36+
payment_details?: Payment<T>;
3637
/** Дата и время создания счета (ISO 8601) */
3738
created_at: string;
3839
/** Срок действия счета (ISO 8601), для счетов pending */
@@ -42,5 +43,5 @@ export interface Invoice {
4243
/** Детали отмены счета */
4344
cancellation_details?: InvoiceCancellationDetails;
4445
/** Дополнительные метаданные (ключ-значение) */
45-
metadata?: Record<string, string>;
46+
metadata?: T;
4647
}

0 commit comments

Comments
 (0)