PhoenixIdentity Invoicing allows a business to invoice another business or consumer for a specific amount, on a specified date, and in a certain amount of Phoenix.
The resolver is located at contracts/resolvers/Invoicing.sol.
Creates a new draft invoice.
function createDraftInvoice(
string memory id,
uint256[] memory customers,
uint256 amount,
bool allowPartialPayment,
uint256 minimumAmountDue,
Terms paymentTerm,
uint256 term
)| Name | Type | Description |
|---|---|---|
| id | string | A custom id for the invoice |
| customers | uint256[] | The ein of the customers (in an array) |
| amount | uint256 | The amount of the invoice (in PHNX) |
| allowPartialPayment | bool | If partial payment is allowed |
| minimumAmountDue | string | The minimum amount for a payment |
| paymentTerm | Terms (uint8) | The type of term of payment (DueOnReceipt, DueOnDate, NoDueDate, NetD) |
| term | uint256 | The term of payment (in days or a timestamp) |
Updates the payment data of an invoice (only if the invoice is still a draft).
function updateInvoiceCustomers(
uint256 invoiceId,
uint256[] memory customers
)| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
| customers | uint256[] | The ein of the new customers (in an array) |
Updates the payment data of an invoice (only if the invoice is still a draft).
function updateInvoicePayment(
uint256 invoiceId,
uint256 amount,
bool allowPartialPayment,
uint256 minimumAmountDue,
Terms paymentTerm,
uint256 term,
string memory additionalTerms,
string memory note
)| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
| amount | uint256 | The amount of the invoice |
| allowPartialPayment | bool | If partial payment is allowed |
| minimumAmountDue | uint256 | The minimum amount for a payment |
| paymentTerm | Terms | The type of term of payment |
| term | uint256 | The term of payment, in days or a timestamp |
| additionalTerms | string | Additional terms (as a string) |
| note | string | Additional note (as a string) |
Validates an invoice (only if the invoice is still a draft).
function validateInvoice(uint256 invoiceId) public| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
Pays an invoice.
function payInvoice(uint256 invoiceId, uint256 amount) public| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
| amount | uint256 | The amount used to pay |
Refunds a customer.
function refundCustomer(
uint256 invoiceId,
uint256 customer,
uint256 amount)
public| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
| customer | uint256 | The ein of the customer |
| amount | uint256 | The amount to refund |
Cancels an invoice.
function cancelInvoice(uint256 invoiceId) public| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
Opens a dispute.
function openDispute(uint256 invoiceId, string memory details)| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
| details | string | The details of the dispute |
Closes a dispute.
function closeDispute(uint256 invoiceId) public| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
Returns the info of an invoice.
function getInvoiceInfo(uint256 invoiceId) public| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
| Name | Type | Description |
|---|---|---|
| id | string | The custom id of the invoice |
| status | Status | The status of the invoice |
| date | uint256 | The date of the creation of the invoice |
| merchant | uint256 | The ein of the merchant |
| customers | uint256[] | The ein of the customers (in an array) |
Returns the details of the invoice.
function getInvoiceDetails(uint256 invoiceId) public| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
| Name | Type | Description |
|---|---|---|
| amount | uint256 | The amount of the invoice |
| paidAmount | uint256 | The paid amount |
| refundedAmount | uint256 | The refunded amount |
| allowPartialPayment | bool | If partial payment is allowed |
| minimumAmountDue | uint256 | The minimum amount for a payment |
| paymentTerm | Terms | The type of term of payment |
| term | uint256 | The term of payment, in days or a timestamp |
Returns the additional details of the invoice.
function getInvoicesAdditionalDetails(uint256 invoiceId) public| Name | Type | Description |
|---|---|---|
| invoiceId | uint256 | The id of the invoice |
| Name | Type | Description |
|---|---|---|
| additionalTerms | string | The additional terms of the invoice |
| note | string | The note of the invoice |
Returns the id of all the invoices created by a merchant.
function getInvoicesFromMerchant(uint256 ein) public| Name | Type | Description |
|---|---|---|
| ein | uint256 | The ein of the merchant |
| Name | Type | Description |
|---|---|---|
| invoices | uint256[] | The id of all the invoices |
Returns the id of all the invoices linked to a customer.
function getInvoicesFromCustomer(uint256 ein) public| Name | Type | Description |
|---|---|---|
| ein | uint256 | The ein of the customer |
| Name | Type | Description |
|---|---|---|
| invoices | uint256[] | The id of all the invoices |
- This folder has a suite of tests created through Truffle.
- To run these tests:
- Clone this repo
- Run
npm install - Build dependencies with
npm run build - Spin up a development blockchain:
npm run chain - Run the tests with
npm run test-invoicing
Copyright 2020 The Phoenix Technology Corporation under the GNU General Public License v3.0.