Request

@requestnetwork/request-client.jsGlobals"api/request"Request

Class representing a request. Instances of this class can be accepted, paid, refunded, etc. Use the member function getData to access the properties of the Request.

Requests should be created with RequestNetwork.createRequest().

Hierarchy

  • Request

Index

Constructors

Properties

Methods

Constructors

constructor

+ new Request(requestId: RequestLogicTypes.RequestId, requestLogic: IRequestLogic, options?: undefined | object): Request

Defined in request-client.js/src/api/request.ts:62

Creates an instance of Request

Parameters:

NameTypeDescription
requestIdRequestLogicTypes.RequestIdID of the Request
requestLogicIRequestLogicInstance of the request-logic layer
options?undefined | objectoptions

Returns: Request

Properties

Private balance

balance: IBalanceWithEvents | null = null

Defined in request-client.js/src/api/request.ts:57

Balance and payments/refund events


Private confirmationErrorOccurredAtCreation

confirmationErrorOccurredAtCreation: boolean = false

Defined in request-client.js/src/api/request.ts:32

true if the creation emitted an event 'error'


Private contentData

contentData: any | null = null

Defined in request-client.js/src/api/request.ts:47

Content data parsed from the extensions data


Private contentDataExtension

contentDataExtension: ContentDataExtension | null

Defined in request-client.js/src/api/request.ts:26


Private emitter

emitter: EventEmitter

Defined in request-client.js/src/api/request.ts:27


Private paymentNetwork

paymentNetwork: IPaymentNetwork | null = null

Defined in request-client.js/src/api/request.ts:25


Private pendingData

pendingData: RequestLogicTypes.IPendingRequest | null = null

Defined in request-client.js/src/api/request.ts:42

Pending data of the request (see request-logic)


Private requestData

requestData: IRequest | null = null

Defined in request-client.js/src/api/request.ts:37

Data of the request (see request-logic)


requestId

requestId: RequestLogicTypes.RequestId

Defined in request-client.js/src/api/request.ts:22

Unique ID of the request


Private requestLogic

requestLogic: IRequestLogic

Defined in request-client.js/src/api/request.ts:24


Private requestMeta

requestMeta: IReturnMeta | null = null

Defined in request-client.js/src/api/request.ts:52

Meta data of the request (e.g: where the data have been retrieved from)


Private skipPaymentDetection

skipPaymentDetection: boolean = false

Defined in request-client.js/src/api/request.ts:62

if true, skip the payment detection

Methods

accept

accept(signerIdentity: IIdentity, refundInformation?: any): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:137

Accepts a request

Parameters:

NameTypeDescription
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.
refundInformation?anyRefund information to add (any because it is specific to the payment network used by the request)

Returns: Promise‹IRequestDataWithEvents›

The updated request


addPaymentInformation

addPaymentInformation(paymentInformation: any, signerIdentity: IIdentity): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:317

Adds payment information

Parameters:

NameTypeDescription
paymentInformationanyPayment information to add (any because it is specific to the payment network used by the request)
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.

Returns: Promise‹IRequestDataWithEvents›

The updated request


addRefundInformation

addRefundInformation(refundInformation: any, signerIdentity: IIdentity): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:363

Adds refund information

Parameters:

NameTypeDescription
refundInformationanyRefund information to add (any because it is specific to the payment network used by the request)
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.

Returns: Promise‹IRequestDataWithEvents›

The updated request


cancel

cancel(signerIdentity: IIdentity, refundInformation?: any): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:178

Cancels a request

Parameters:

NameTypeDescription
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.
refundInformation?anyrefund information to add (any because it is specific to the payment network used by the request)

Returns: Promise‹IRequestDataWithEvents›

The updated request


declareReceivedPayment

declareReceivedPayment(amount: string, note: string, signerIdentity: IIdentity): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:525

Declare a payment is received for the declarative payment network

Parameters:

NameTypeDescription
amountstringAmount received
notestringNote from payee about the received payment
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.

Returns: Promise‹IRequestDataWithEvents›

The updated request


declareReceivedRefund

declareReceivedRefund(amount: string, note: string, signerIdentity: IIdentity): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:584

Declare a refund is received for the declarative payment network

Parameters:

NameTypeDescription
amountstringAmount received
notestringNote from payer about the received refund
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.

Returns: Promise‹IRequestDataWithEvents›

The updated request


declareSentPayment

declareSentPayment(amount: string, note: string, signerIdentity: IIdentity): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:410

Declare a payment is sent for the declarative payment network

Parameters:

NameTypeDescription
amountstringAmount sent
notestringNote from payer about the sent payment
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.

Returns: Promise‹IRequestDataWithEvents›

The updated request


declareSentRefund

declareSentRefund(amount: string, note: string, signerIdentity: IIdentity): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:466

Declare a refund is sent for the declarative payment network

Parameters:

NameTypeDescription
amountstringAmount sent
notestringNote from payee about the sent refund
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.

Returns: Promise‹IRequestDataWithEvents›

The updated request


disablePaymentDetection

disablePaymentDetection(): void

Defined in request-client.js/src/api/request.ts:733

Disables the payment detection

Returns: void


enablePaymentDetection

enablePaymentDetection(): void

Defined in request-client.js/src/api/request.ts:726

Enables the payment detection

Returns: void


getData

getData(): IRequestDataWithEvents

Defined in request-client.js/src/api/request.ts:640

Gets the request data

Returns: IRequestDataWithEvents

The updated request data


increaseExpectedAmountRequest

increaseExpectedAmountRequest(deltaAmount: RequestLogicTypes.Amount, signerIdentity: IIdentity, refundInformation?: any): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:221

Increases the expected amount of the request.

Parameters:

NameTypeDescription
deltaAmountRequestLogicTypes.AmountAmount by which to increase the expected amount
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.
refundInformation?anyRefund information to add (any because it is specific to the payment network used by the request)

Returns: Promise‹IRequestDataWithEvents›

The updated request


on

on<K>(event: K, listener: IRequestEvents[K]): this

Defined in request-client.js/src/api/request.ts:110

Listen the confirmation of the creation

Type parameters:

K: keyof IRequestEvents

Parameters:

NameType
eventK
listenerIRequestEvents[K]

Returns: this

this


reduceExpectedAmountRequest

reduceExpectedAmountRequest(deltaAmount: RequestLogicTypes.Amount, signerIdentity: IIdentity, paymentInformation?: any): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:269

Reduces the expected amount of the request. This can be called by the payee e.g. to apply discounts or special offers.

Parameters:

NameTypeDescription
deltaAmountRequestLogicTypes.AmountAmount by which to reduce the expected amount
signerIdentityIIdentityIdentity of the signer. The identity type must be supported by the signature provider.
paymentInformation?anyPayment information to add (any because it is specific to the payment network used by the request)

Returns: Promise‹IRequestDataWithEvents›

The updated request


refresh

refresh(requestAndMeta?: RequestLogicTypes.IReturnGetRequestFromId): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:671

Refresh the request data and balance from the network (check if new events happened - e.g: accept, payments etc..) and return these data

Parameters:

NameTypeDescription
requestAndMeta?RequestLogicTypes.IReturnGetRequestFromIdreturn from getRequestFromId to avoid asking twice

Returns: Promise‹IRequestDataWithEvents›

Refreshed request data


refreshBalance

refreshBalance(): Promise‹IBalanceWithEvents‹any› | null›

Defined in request-client.js/src/api/request.ts:713

Refresh only the balance of the request and return it

Returns: Promise‹IBalanceWithEvents‹any› | null›

return the balance


waitForConfirmation

waitForConfirmation(): Promise‹IRequestDataWithEvents›

Defined in request-client.js/src/api/request.ts:123

Wait for the confirmation

Returns: Promise‹IRequestDataWithEvents›

the request data