Invoice
Constants
STATUS_CANCELLED |
|
STATUS_COLLECTIONS |
|
STATUS_DRAFT |
|
STATUS_PAID |
|
STATUS_PAYMENT_PENDING |
|
STATUS_REFUNDED |
|
STATUS_UNPAID |
|
Properties summary
Type | Property | Description | |
---|---|---|---|
protected | $table | ||
protected | $dates | ||
protected | $columnMap | ||
protected | $appends |
Methods summary
Return Type | Method Name | Description | |
---|---|---|---|
static | boot() | - | |
string | getViewInvoiceUrl(array|null $additionalQueryStringParams = null) | Get view invoice url. | |
getInvoiceNumber() | - | ||
array | getCurrency() | Get currency object for the invoice. | |
string | getCurrencyCodeAttribute() | Get currency code. | |
BelongsTo | client() | Each invoice belongs to one client. | |
hasMany | transactions() | Each invoice can have many transactions. | |
HasMany | items() | Each invoice can have many line items. | |
hasOne | snapshot() | Each invoice can have one set of invoice snapshot data. | |
BelongsTo | order() | An invoice can belong to a single order. | |
Builder | scopeUnpaid(Builder $query) | Where status is unpaid. | |
Builder | scopeOverdue(Builder $query) | Where status is overdue. | |
Builder | scopePaid(Builder $query) | Where status is paid. | |
Builder | scopeCancelled(Builder $query) | Where status is cancelled. | |
Builder | scopeRefunded(Builder $query) | Where status is refunded. | |
Builder | scopeCollections(Builder $query) | Where status is collections. | |
Builder | scopePaymentPending(Builder $query) | Where status is payment-pending. | |
Builder | scopeUnpaidOrPaymentPending(Builder $query) | Where status is unpaid or payment-pending. | |
Builder | scopeMassPay(Builder $query, bool $isMassPay = true) | Where the invoice does not contain a line item that is of type "Invoice". | |
Builder | scopeWithLastCaptureAttempt(Builder $query, Carbon $date) | Where the last capture date is on a specific date | |
float | getBalanceAttribute() | Calculate balance remaining for the invoice. | |
string | getPaymentGatewayNameAttribute() | - | |
float | getAmountPaidAttribute() | - | |
bool | addPayment(float $amount, string $transactionId = '', float $fees = 0.0, string $gateway = '', bool $noEmail = false, Carbon $date = null) | - | |
bool | addPaymentIfNotExists(float $amount, string $transactionId = '', float $fees = 0.0, string $gateway = '', bool $noEmail = false, Carbon $date = null) | - | |
array | getBillingValues() | - | |
bool | shouldRenewRun(integer $relatedId, string $registrationDate, string $type = 'Hosting') | Checks if the module renewal should run for a provided related id, registration date and type of item. | |
Vat | vat() | - | |
static Invoice | newInvoice(integer $clientId, string $gateway = null, float $taxRate1 = null, float $taxRate2 = null) | Create a new invoice in Draft and return the instance to be updated and saved. | |
Invoice | setStatusUnpaid() | Set invoice status to unpaid. | |
Invoice | setStatusPending() | Set invoice status to payment pending. | |
Invoice | setStatusRefunded() | Set invoice status to refunded. | |
hasOne | data() | Each invoice can have one set of invoice data. | |
HasMany|History[] | transactionHistory() | - | |
BelongsTo|Model | payMethod() | - | |
string | getPayMethodRemoteToken() | - | |
setPayMethodRemoteToken($remoteToken) | - | ||
deletePayMethod() | - | ||
convertLocalCardToRemote($remoteToken) | - | ||
convertLocalBankAccountToRemote($remoteToken) | - | ||
saveRemoteCard($cardLastFour, $cardType, $expiryDate, $remoteToken) | - | ||
saveRemoteBankAccount($bankName, $remoteToken) | - | ||
Cart | cart() | Build a cart object based on the current invoice. | |
Invoice | runCreationHooks(string $source) | Run invoice creation hooks. | |
Collection | getSubscriptionIds(array|null $paymentMethods = null) | Get subscription IDs from items that belong to this invoice. | |
Invoice | saveSubscriptionId(string $subscriptionId) | Save subscription ID. | |
Builder | scopeSubscriptionId(Builder $query, string $subscriptionId) | Where the invoices contain items that have a given subscription ID. | |
getLink() | - | ||
$this | setPaymentMethod(string $gatewayName) | Set the invoice Payment Method. | |
$this | setPayMethodId(int $payMethodId) | Set the Pay Method ID for the invoice. | |
$this | clearPayMethodId() | Clear the associated Pay Method |
Details
static
boot ()
string
getViewInvoiceUrl (array|null $additionalQueryStringParams = null)
Get view invoice url.
getInvoiceNumber ()
array
getCurrency ()
Get currency object for the invoice.
string
getCurrencyCodeAttribute ()
Get currency code.
BelongsTo
client ()
Each invoice belongs to one client.
hasMany
transactions ()
Each invoice can have many transactions.
HasMany
items ()
Each invoice can have many line items.
hasOne
snapshot ()
Each invoice can have one set of invoice snapshot data.
BelongsTo
order ()
An invoice can belong to a single order.
Builder
scopeUnpaid (Builder $query)
Where status is unpaid.
Builder
scopeOverdue (Builder $query)
Where status is overdue.
Builder
scopePaid (Builder $query)
Where status is paid.
Builder
scopeCancelled (Builder $query)
Where status is cancelled.
Builder
scopeRefunded (Builder $query)
Where status is refunded.
Builder
scopeCollections (Builder $query)
Where status is collections.
Builder
scopePaymentPending (Builder $query)
Where status is payment-pending.
Builder
scopeUnpaidOrPaymentPending (Builder $query)
Where status is unpaid or payment-pending.
Builder
scopeMassPay (Builder $query, bool $isMassPay = true)
Where the invoice does not contain a line item that is of type "Invoice".
Builder
scopeWithLastCaptureAttempt (Builder $query, Carbon $date)
Where the last capture date is on a specific date
float
getBalanceAttribute ()
Calculate balance remaining for the invoice.
string
getPaymentGatewayNameAttribute ()
float
getAmountPaidAttribute ()
bool
addPayment (float $amount, string $transactionId = '', float $fees = 0.0, string $gateway = '', bool $noEmail = false, Carbon $date = null)
bool
addPaymentIfNotExists (float $amount, string $transactionId = '', float $fees = 0.0, string $gateway = '', bool $noEmail = false, Carbon $date = null)
array
getBillingValues ()
bool
shouldRenewRun (integer $relatedId, string $registrationDate, string $type = 'Hosting')
Checks if the module renewal should run for a provided related id, registration date and type of item.
Vat
vat ()
static Invoice
newInvoice (integer $clientId, string $gateway = null, float $taxRate1 = null, float $taxRate2 = null)
Create a new invoice in Draft and return the instance to be updated and saved.
Invoice
setStatusUnpaid ()
Set invoice status to unpaid.
Invoice
setStatusPending ()
Set invoice status to payment pending.
Invoice
setStatusRefunded ()
Set invoice status to refunded.
hasOne
data ()
Each invoice can have one set of invoice data.
HasMany|History[]
transactionHistory ()
BelongsTo|Model
payMethod ()
string
getPayMethodRemoteToken ()
setPayMethodRemoteToken ($remoteToken)
deletePayMethod ()
convertLocalCardToRemote ($remoteToken)
convertLocalBankAccountToRemote ($remoteToken)
saveRemoteCard ($cardLastFour, $cardType, $expiryDate, $remoteToken)
saveRemoteBankAccount ($bankName, $remoteToken)
Cart
cart ()
Build a cart object based on the current invoice.
Invoice
runCreationHooks (string $source)
Run invoice creation hooks.
Collection
getSubscriptionIds (array|null $paymentMethods = null)
Get subscription IDs from items that belong to this invoice.
Invoice
saveSubscriptionId (string $subscriptionId)
Save subscription ID.
Builder
scopeSubscriptionId (Builder $query, string $subscriptionId)
Where the invoices contain items that have a given subscription ID.
getLink ()
$this
setPaymentMethod (string $gatewayName)
Set the invoice Payment Method.
$this
setPayMethodId (int $payMethodId)
Set the Pay Method ID for the invoice.
$this
clearPayMethodId ()
Clear the associated Pay Method