Laravel\Cashier\Invoice::discount PHP Method

discount() public method

Get the discount amount.
public discount ( ) : string
return string
    public function discount()
    {
        return $this->formatAmount($this->discountAmount());
    }

Usage Example

 public function testDiscountCanBeRetrieved()
 {
     $invoice = new Invoice($billable = m::mock('Laravel\\Cashier\\Contracts\\Billable'), (object) ['total' => 10000, 'subtotal' => 20000, 'currency' => 'usd']);
     $billable->shouldReceive('addCurrencySymbol')->andReturn('$100');
     $billable->shouldReceive('getCurrencyLocale')->andReturn('en_US');
     $this->assertEquals(100.0, $invoice->discount());
     $this->assertEquals('$100', $invoice->discountCurrency());
 }