Class: Request

"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

Constructors

constructor

+ new Request(requestId: RequestLogicTypes.RequestId, requestLogic: IRequestLogic, options?: { contentDataExtension?: ContentDataExtension | null ; paymentNetwork?: IPaymentNetwork | null ; requestLogicCreateResult?: IReturnCreateRequest ; skipPaymentDetection?: boolean }): 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?{ contentDataExtension?: ContentDataExtension | null ; paymentNetwork?: IPaymentNetwork | null ; requestLogicCreateResult?: IReturnCreateRequest ; skipPaymentDetection?: boolean }options

Returns: Request

Properties

balance

Private balance: IBalanceWithEvents | null = null

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

Balance and payments/refund events


confirmationErrorOccurredAtCreation

Private confirmationErrorOccurredAtCreation: boolean = false

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

true if the creation emitted an event 'error'


contentData

Private contentData: any | null = null

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

Content data parsed from the extensions data


contentDataExtension

Private contentDataExtension: ContentDataExtension | null

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


emitter

Private emitter: EventEmitter

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


paymentNetwork

Private paymentNetwork: IPaymentNetwork | null = null

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


pendingData

Private pendingData: RequestLogicTypes.IPendingRequest | null = null

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

Pending data of the request (see request-logic)


requestData

Private requestData: IRequest | null = null

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

Data of the request (see request-logic)


requestId

Readonly requestId: RequestLogicTypes.RequestId

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

Unique ID of the request


requestLogic

Private requestLogic: IRequestLogic

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


requestMeta

Private 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)


skipPaymentDetection

Private 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: RequestLogicTypes.Amount, 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
amountRequestLogicTypes.AmountAmount 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: RequestLogicTypes.Amount, 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
amountRequestLogicTypes.AmountAmount 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: RequestLogicTypes.Amount, 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
amountRequestLogicTypes.AmountAmount 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: RequestLogicTypes.Amount, 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
amountRequestLogicTypes.AmountAmount 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:

NameType
Kkeyof 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?: 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?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