/** * Create a local invoice for the given billable entity. * * @param mixed $billable * @param \Laravel\Cashier\Invoice $invoice * @return \Laravel\Spark\LocalInvoice */ protected function createForBillable($billable, $invoice) { if ($existing = $billable->localInvoices()->where('provider_id', $invoice->id)->first()) { return $existing; } return $billable->localInvoices()->create(['provider_id' => $invoice->id, 'total' => $invoice->rawTotal() - $invoice->rawTotal() * $billable->taxPercentage(), 'tax' => $invoice->rawTotal() * $billable->taxPercentage(), 'card_country' => null, 'billing_state' => null, 'billing_zip' => null, 'billing_country' => null]); }
/** * Create a local invoice for the given billable entity. * * @param mixed $billable * @param \Laravel\Cashier\Invoice $invoice * @return \Laravel\Spark\LocalInvoice */ protected function createForBillable($billable, $invoice) { if ($existing = $billable->localInvoices()->where('provider_id', $invoice->id)->first()) { return $existing; } return $billable->localInvoices()->create(['provider_id' => $invoice->id, 'total' => $invoice->rawTotal() / 100, 'tax' => $invoice->asStripeInvoice()->tax / 100, 'card_country' => $billable->card_country, 'billing_state' => $billable->billing_state, 'billing_zip' => $billable->billing_zip, 'billing_country' => $billable->billing_country, 'vat_id' => $billable->vat_id]); }