mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
fixes for Stripe ACH description
This commit is contained in:
parent
ccda36a745
commit
b249077420
@ -231,12 +231,24 @@ class ACH
|
|||||||
$this->stripe->payment_hash->data = array_merge((array)$this->stripe->payment_hash->data, $state);
|
$this->stripe->payment_hash->data = array_merge((array)$this->stripe->payment_hash->data, $state);
|
||||||
$this->stripe->payment_hash->save();
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
$amount = array_sum(array_column($this->stripe->payment_hash->invoices(), 'amount')) + $this->stripe->payment_hash->fee_total;
|
||||||
|
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($this->stripe->payment_hash->invoices(), 'invoice_id')))
|
||||||
|
->withTrashed()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($invoice) {
|
||||||
|
$description = "Invoice {$invoice->number} for {$amount} for client {$this->stripe->client->present()->name()}";
|
||||||
|
} else {
|
||||||
|
$description = "Payment with no invoice for amount {$amount} for client {$this->stripe->client->present()->name()}";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$state['charge'] = \Stripe\Charge::create([
|
$state['charge'] = \Stripe\Charge::create([
|
||||||
'amount' => $state['amount'],
|
'amount' => $state['amount'],
|
||||||
'currency' => $state['currency'],
|
'currency' => $state['currency'],
|
||||||
'customer' => $state['customer'],
|
'customer' => $state['customer'],
|
||||||
'source' => $state['source'],
|
'source' => $state['source'],
|
||||||
|
'description' => $description,
|
||||||
], $this->stripe->stripe_connect_auth);
|
], $this->stripe->stripe_connect_auth);
|
||||||
|
|
||||||
$state = array_merge($state, $request->all());
|
$state = array_merge($state, $request->all());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user