Skip to content

Latest commit

 

History

History
724 lines (407 loc) · 18.1 KB

index.QIWI._P2pCompat.md

File metadata and controls

724 lines (407 loc) · 18.1 KB

QIWI SDK / Modules / index / QIWI / _P2pCompat

Class: _P2pCompat

index.QIWI._P2pCompat

Deprecated

Используйте класс P2p и новые сигнатуры методов

Export

Hierarchy

  • P2p

    _P2pCompat

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new _P2pCompat(secretKey, publicKey?)

Creates an instance of _P2pCompat.

Memberof

_P2pCompat

Parameters

Name Type Default value
secretKey string undefined
publicKey string ""

Overrides

P2p.constructor

Defined in

apis/p2p/p2p.compat.ts:28

Properties

_options

Protected Readonly _options: P2pApiOptions

Memberof

OptionsWrapper

Inherited from

P2p._options

Defined in

apis/options-wrapper.ts:16


bills

Readonly bills: P2pBillsApi

Inherited from

P2p.bills

Defined in

apis/p2p/p2p.ts:109


publicKey

Readonly publicKey: string = ""

Defined in

apis/p2p/p2p.compat.ts:30


secretKey

Readonly secretKey: string

Defined in

apis/p2p/p2p.compat.ts:29


BillCurrency

Static Readonly BillCurrency: typeof BillCurrency = BillCurrency

Inherited from

P2p.BillCurrency

Defined in

apis/p2p/p2p.ts:27


BillPaySource

Static Readonly BillPaySource: typeof BillPaySource = BillPaySource

Inherited from

P2p.BillPaySource

Defined in

apis/p2p/p2p.ts:28


BillStatus

Static Readonly BillStatus: typeof BillStatus = BillStatus

Inherited from

P2p.BillStatus

Defined in

apis/p2p/p2p.ts:29


BillsApi

Static Readonly BillsApi: typeof P2pBillsApi = P2pBillsApi

Inherited from

P2p.BillsApi

Defined in

apis/p2p/p2p.ts:25


Currency

Static Readonly Currency: typeof BillCurrency = BillCurrency

Inherited from

P2p.Currency

Defined in

apis/p2p/p2p.ts:31


PaySource

Static Readonly PaySource: typeof BillPaySource = BillPaySource

Inherited from

P2p.PaySource

Defined in

apis/p2p/p2p.ts:32


Status

Static Readonly Status: typeof BillStatus = BillStatus

Inherited from

P2p.Status

Defined in

apis/p2p/p2p.ts:33

Accessors

agent

get agent(): any

Memberof

WalletCompat

Returns

any

Inherited from

P2p.agent

Defined in

apis/api.ts:23

set agent(agent): void

Memberof

WalletCompat

Parameters

Name Type
agent any

Returns

void

Inherited from

P2p.agent

Defined in

apis/api.ts:32


options

get options(): T

Memberof

OptionsWrapperWithGetter

Returns

T

Inherited from

P2p.options

Defined in

apis/options-wrapper.ts:44

Methods

billStatus

billStatus(billId): Promise<BillStatusData>

Проверка статуса перевода по счету

Метод позволяет проверить статус перевода по счету. Рекомендуется его использовать после получения уведомления о переводе.

Deprecated

Используйте метод getBillStatus

Parameters

Name Type Description
billId string Уникальный идентификатор счета в вашей системе.

Returns

Promise<BillStatusData>

Объект счёта

Defined in

apis/p2p/p2p.compat.ts:87


checkNotificationSignature

checkNotificationSignature(signature, body): boolean

Проверяет подпись уведомления о статусе счёта

Parameters

Name Type Description
signature string Подпись
body BillStatusData | BillStatusBody Объект уведомления

Returns

boolean

Признак валидности

Defined in

apis/p2p/p2p.compat.ts:163


createBill

createBill(data, billId?): Promise<BillStatusData>

Выставление счета

По оплаченным счетам возврат денежных средств не предусмотрен.

Доступно выставление счетов в рублях и тенге. Надежный способ для интеграции. Параметры передаются server2server с использованием авторизации. Метод позволяет выставить счет: при успешном выполнении запроса в ответе вернется параметр payUrl - ссылка для редиректа пользователя на форму.

Настройки формы и счета

Для тестирования и отладки сервиса рекомендуем выставлять и оплачивать счета суммой 1 рубль.

Parameters

Name Type Description
data BillCreationRequest Сформированный запрос на создание счёта
billId? string Свой ID счёта. По умолчанию генерируется UUID

Returns

Promise<BillStatusData>

Defined in

apis/p2p/p2p.compat.ts:59


createBillFormUrl

createBillFormUrl(parameters): string

Создаёт ссылку оплаты счёта без запроса к API

Parameters

Name Type Description
parameters PayUrlPatchParameters & BillCustomFieldsExtension & { amount: string | number ; billId?: string ; comment?: string ; customFields?: CustomFields ; lifetime?: string ; themeCode?: string } & { account?: string ; email?: string ; phone?: string } GET-параметры ссылки

Returns

string

Ссылка на оплату счёта

Defined in

apis/p2p/p2p.compat.ts:73


getBillStatus

getBillStatus(billId): Promise<BillStatusData>

Проверка статуса перевода по счету

Метод позволяет проверить статус перевода по счету. Рекомендуется его использовать после получения уведомления о переводе.

Parameters

Name Type Description
billId string Уникальный идентификатор счета в вашей системе.

Returns

Promise<BillStatusData>

Объект счёта

Defined in

apis/p2p/p2p.compat.ts:100


notificationMiddleware

notificationMiddleware(options?, handler?): RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

[Экспериментально] Упрощает интеграцию с express

Это middleware кидает ошибки, позаботьтесь об их обработке

Parameters

Name Type Description
options? MiddlewareOptions Параметры обработки запроса
handler? BillRequestHandler

Returns

RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

Пример:

В начале файла

const p2p = new QIWI.P2P(process.env.QIWI_PRIVATE_KEY);

Вариант 1 - Классический

app.post('/webhook/qiwi', p2p.notificationMiddleware(), (req, res) => {
 req.body // Это `BillStatusNotificationBody`
})

Вариант 2 - Если нужны подсказки типов

app.post('/webhook/qiwi', p2p.notificationMiddleware({}, (req, res) => {
 req.body // Это `BillStatusNotificationBody`
}))

Обработка ошибок

app.use((error, request, response, next) => {
 console.log(error); // [Error: Notification signature mismatch]
})

Inherited from

P2p.notificationMiddleware

Defined in

apis/p2p/p2p.ts:151


rejectBill

rejectBill(billId): Promise<BillStatusData>

Отмена неоплаченного счета

Метод позволяет отменить счет, по которому не был выполнен перевод.

Parameters

Name Type Description
billId string Уникальный идентификатор счета в вашей системе.

Returns

Promise<BillStatusData>

Объект счёта

Defined in

apis/p2p/p2p.compat.ts:112


create

Static create(secretKey, publicKey?): P2p

Static

Memberof

P2p

Parameters

Name Type Default value
secretKey string undefined
publicKey? string ""

Returns

P2p

P2p

Inherited from

P2p.create

Defined in

apis/p2p/p2p.ts:72


env

Static env(secretKey?, publicKey?): P2p

Static

Memberof

P2p

Parameters

Name Type Default value
secretKey? string environment.QIWI_SECRET_KEY
publicKey? string environment.QIWI_PUBLIC_KEY

Returns

P2p

P2p

Inherited from

P2p.env

Defined in

apis/p2p/p2p.ts:89


formatLifetime

Static formatLifetime(days?): string

Deprecated

Используйте formatLifetimeDays или formatLifetimeMinutes

Parameters

Name Type Default value Description
days number 1 Кол-во дней жизни счёта (может быть не целым числом)

Returns

string

Дата понятная QIWI

Defined in

apis/p2p/p2p.compat.ts:123


formatLifetimeDays

Static formatLifetimeDays(days?): string

Parameters

Name Type Default value Description
days number 1 Кол-во дней жизни счёта (может быть не целым числом)

Returns

string

Дата понятная QIWI

Defined in

apis/p2p/p2p.compat.ts:143


formatLifetimeMinutes

Static formatLifetimeMinutes(minutes?): string

Parameters

Name Type Default value Description
minutes? number 15 Кол-во минут жизни счёта (может быть не целым числом)

Returns

string

Дата понятная QIWI

Defined in

apis/p2p/p2p.compat.ts:152


httpClientFactory

Static httpClientFactory(secretKey): SimpleJsonHttp

Static

Memberof

P2p

Parameters

Name Type
secretKey string

Returns

SimpleJsonHttp

SimpleJsonHttp

Inherited from

P2p.httpClientFactory

Defined in

apis/p2p/p2p.ts:43


patchPayUrl

Static patchPayUrl(payUrl, options?): string

Добавляет параметры

Parameters

Name Type
payUrl string
options? PayUrlPatchParameters

Returns

string

Новый URL для оплаты

Defined in

apis/p2p/p2p.compat.ts:134