diff --git a/app/Http/Controllers/StripeController.php b/app/Http/Controllers/StripeController.php index ce23f7ae3f05..8f5e6a6902b2 100644 --- a/app/Http/Controllers/StripeController.php +++ b/app/Http/Controllers/StripeController.php @@ -35,7 +35,7 @@ class StripeController extends BaseController public function import() { - return response()->json(['message' => 'Processing'], 200); + // return response()->json(['message' => 'Processing'], 200); if(auth()->user()->isAdmin()) diff --git a/app/PaymentDrivers/PayPalExpressPaymentDriver.php b/app/PaymentDrivers/PayPalExpressPaymentDriver.php index 6273265069b1..ccf11ac5b4f0 100644 --- a/app/PaymentDrivers/PayPalExpressPaymentDriver.php +++ b/app/PaymentDrivers/PayPalExpressPaymentDriver.php @@ -197,36 +197,23 @@ class PayPalExpressPaymentDriver extends BaseDriver public function generatePaymentItems(array $data) { - $total = 0; - $items = collect($this->payment_hash->data->invoices)->map(function ($i) use (&$total) { - $invoice = Invoice::findOrFail($this->decodePrimaryKey($i->invoice_id)); + $_invoice = collect($this->payment_hash->data->invoices)->first(); + $invoice = Invoice::findOrFail($this->decodePrimaryKey($_invoice->invoice_id)); - return collect($invoice->line_items)->map(function ($lineItem) use (&$total) { - if (floatval($lineItem->quantity) != intval($lineItem->quantity)) { - return null; - } + $line_item = collect($invoice->line_items)->first(); - $total += $lineItem->cost * $lineItem->quantity; + $items = []; - return new Item([ - 'name' => $lineItem->product_key, - 'description' => substr(strip_tags($lineItem->notes), 0, 100), - 'price' => $lineItem->cost, - 'quantity' => $lineItem->quantity, - ]); - }); - }); - - if ($total != $data['total']['amount_with_fee']) { - $items[0][] = new Item([ - 'name' => trans('texts.taxes_and_fees'), - 'description' => '', - 'price' => $data['total']['amount_with_fee'] - $total, + $items[] = new Item([ + 'name' => " ", + 'description' => ctrans('texts.invoice_number') . "# " . $invoice->number, + 'price' => $data['total']['amount_with_fee'], 'quantity' => 1, ]); - } - return $items[0]->toArray(); + return $items; + } + }