Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Latest commit

 

History

History
381 lines (214 loc) · 8.04 KB

index.QIWI.P2p.md

File metadata and controls

381 lines (214 loc) · 8.04 KB

QIWI SDK / Modules / index / QIWI / P2p

Class: P2p

index.QIWI.P2p

P2P-счета

Документация QIWI

Export

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new P2p(options?)

Creates an instance of P2p.

Memberof

P2p

Parameters

Name Type
options? Partial<P2pApiOptions>

Overrides

ApiClass.constructor

Defined in

apis/p2p/p2p.ts:101

Properties

_options

Protected Readonly _options: P2pApiOptions

Memberof

OptionsWrapper

Inherited from

ApiClass._options

Defined in

apis/options-wrapper.ts:16


bills

Readonly bills: P2pBillsApi

Defined in

apis/p2p/p2p.ts:109


BillCurrency

Static Readonly BillCurrency: typeof BillCurrency = BillCurrency

Defined in

apis/p2p/p2p.ts:27


BillPaySource

Static Readonly BillPaySource: typeof BillPaySource = BillPaySource

Defined in

apis/p2p/p2p.ts:28


BillStatus

Static Readonly BillStatus: typeof BillStatus = BillStatus

Defined in

apis/p2p/p2p.ts:29


BillsApi

Static Readonly BillsApi: typeof P2pBillsApi = P2pBillsApi

Defined in

apis/p2p/p2p.ts:25


Currency

Static Readonly Currency: typeof BillCurrency = BillCurrency

Defined in

apis/p2p/p2p.ts:31


PaySource

Static Readonly PaySource: typeof BillPaySource = BillPaySource

Defined in

apis/p2p/p2p.ts:32


Status

Static Readonly Status: typeof BillStatus = BillStatus

Defined in

apis/p2p/p2p.ts:33

Accessors

agent

get agent(): any

Memberof

WalletCompat

Returns

any

Inherited from

ApiClass.agent

Defined in

apis/api.ts:23

set agent(agent): void

Memberof

WalletCompat

Parameters

Name Type
agent any

Returns

void

Inherited from

ApiClass.agent

Defined in

apis/api.ts:32


options

get options(): T

Memberof

OptionsWrapperWithGetter

Returns

T

Inherited from

ApiClass.options

Defined in

apis/options-wrapper.ts:44

Methods

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]
})

Defined in

apis/p2p/p2p.ts:151


create

Static create(secretKey, publicKey?): P2p

Static

Memberof

P2p

Parameters

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

Returns

P2p

P2p

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

Defined in

apis/p2p/p2p.ts:89


httpClientFactory

Static httpClientFactory(secretKey): SimpleJsonHttp

Static

Memberof

P2p

Parameters

Name Type
secretKey string

Returns

SimpleJsonHttp

SimpleJsonHttp

Defined in

apis/p2p/p2p.ts:43