2.0 KiB
payment
This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.
payment.create
Source: src/store/payment/create.js
Adds a payment to a manifest (order) using an account of the selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
input |
object |
Payment input. |
input.accountId |
number |
The account id. |
input.manifestId |
number |
The manifest (order) id. |
input.type |
string |
Payment type. |
input.amount |
number |
Payment amount. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<{id: number, accountId: number, manifestId: number, type: string, amount: number}>
Throws
Error — If account or manifest is not found, or input is invalid.
Example
await store.payment.create(googleAuthId, { accountId: 1, manifestId: 42, type: 'cash', amount: 19.9 });
payment.delete
Source: src/store/payment/delete.js
Deletes a payment belonging to a manifest of the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
id |
number |
The payment id. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<void>
Example
await store.payment.delete(googleAuthId, 7);
payment.listByManifestId
Source: src/store/payment/listByManifestId.js
Lists payments of a manifest (order) in the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
manifestId |
number |
The manifest id. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<Array<{id: number, accountId: number, manifestId: number, type: string, amount: number}>>
Example
const payments = await store.payment.listByManifestId(googleAuthId, 42);