PHP Class Laravel\Cashier\Invoice

Show file Open project: laravel/cashier-braintree Class Usage Examples

Protected Properties

Property Type Description
$transaction Braintree\Transaction The Braintree transaction instance.
$user Illuminate\Database\Eloquent\Model The user instance.

Public Methods

Method Description
__construct ( Model $user, Transaction $transaction ) : void Create a new invoice instance.
__get ( string $key ) : mixed Dynamically get values from the Braintree transaction.
addOn ( ) : string Get the discount amount.
addOnAmount ( ) : float Get the raw add-on amount.
addOns ( ) : array Get the add-on codes applied to the invoice.
amountOff ( ) : string Get the discount amount for the invoice.
asBraintreeTransaction ( ) : Transaction Get the Braintree transaction instance.
coupons ( ) : array Get the coupon codes applied to the invoice.
date ( DateTimeZone | string $timezone = null ) : Carbon\Carbon Get a Carbon date for the invoice.
discount ( ) : string Get the discount amount.
discountAmount ( ) : float Get the raw discount amount.
download ( array $data ) : Response Create an invoice download response.
hasAddon ( ) : boolean Determine if the invoice has any add-ons.
hasDiscount ( ) : boolean Determine if the invoice has a discount.
pdf ( array $data ) : string Capture the invoice as a PDF and return the raw bytes.
rawTotal ( ) : float Get the raw total amount that was paid (or will be paid).
subtotal ( ) : string Get the total of the invoice (before discounts).
total ( ) : string Get the total amount that was paid (or will be paid).
view ( array $data ) : Illuminate\View\View Get the View instance for the invoice.

Protected Methods

Method Description
formatAmount ( integer $amount ) : string Format the given amount into a string based on the user's preferences.

Method Details

__construct() public method

Create a new invoice instance.
public __construct ( Model $user, Transaction $transaction ) : void
$user Illuminate\Database\Eloquent\Model
$transaction Braintree\Transaction
return void

__get() public method

Dynamically get values from the Braintree transaction.
public __get ( string $key ) : mixed
$key string
return mixed

addOn() public method

Get the discount amount.
public addOn ( ) : string
return string

addOnAmount() public method

Get the raw add-on amount.
public addOnAmount ( ) : float
return float

addOns() public method

Get the add-on codes applied to the invoice.
public addOns ( ) : array
return array

amountOff() public method

Get the discount amount for the invoice.
public amountOff ( ) : string
return string

asBraintreeTransaction() public method

Get the Braintree transaction instance.
public asBraintreeTransaction ( ) : Transaction
return Braintree\Transaction

coupons() public method

Get the coupon codes applied to the invoice.
public coupons ( ) : array
return array

date() public method

Get a Carbon date for the invoice.
public date ( DateTimeZone | string $timezone = null ) : Carbon\Carbon
$timezone DateTimeZone | string
return Carbon\Carbon

discount() public method

Get the discount amount.
public discount ( ) : string
return string

discountAmount() public method

Get the raw discount amount.
public discountAmount ( ) : float
return float

download() public method

Create an invoice download response.
public download ( array $data ) : Response
$data array
return Symfony\Component\HttpFoundation\Response

formatAmount() protected method

Format the given amount into a string based on the user's preferences.
protected formatAmount ( integer $amount ) : string
$amount integer
return string

hasAddon() public method

Determine if the invoice has any add-ons.
public hasAddon ( ) : boolean
return boolean

hasDiscount() public method

Determine if the invoice has a discount.
public hasDiscount ( ) : boolean
return boolean

pdf() public method

Capture the invoice as a PDF and return the raw bytes.
public pdf ( array $data ) : string
$data array
return string

rawTotal() public method

Get the raw total amount that was paid (or will be paid).
public rawTotal ( ) : float
return float

subtotal() public method

Get the total of the invoice (before discounts).
public subtotal ( ) : string
return string

total() public method

Get the total amount that was paid (or will be paid).
public total ( ) : string
return string

view() public method

Get the View instance for the invoice.
public view ( array $data ) : Illuminate\View\View
$data array
return Illuminate\View\View

Property Details

$transaction protected property

The Braintree transaction instance.
protected Transaction,Braintree $transaction
return Braintree\Transaction

$user protected property

The user instance.
protected Model,Illuminate\Database\Eloquent $user
return Illuminate\Database\Eloquent\Model