mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on payment flows
This commit is contained in:
parent
c74fac68f4
commit
076f168707
@ -86,6 +86,9 @@ class InvoiceController extends Controller
|
||||
return render('invoices.show-fullscreen', $data);
|
||||
}
|
||||
|
||||
if(!$invoice->isPayable())
|
||||
return $this->render('invoices.show',$data);
|
||||
|
||||
return auth()->guard('contact')->user()->client->getSetting('payment_flow') == 'default' ? $this->render('invoices.show', $data) : $this->render('invoices.show_smooth', $data);
|
||||
|
||||
// return $this->render('invoices.show_smooth', $data);
|
||||
|
@ -12,15 +12,17 @@
|
||||
|
||||
namespace App\PaymentDrivers\Stripe;
|
||||
|
||||
use App\Exceptions\PaymentFailed;
|
||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\PaymentType;
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Exceptions\PaymentFailed;
|
||||
use App\PaymentDrivers\StripePaymentDriver;
|
||||
use Stripe\Exception\InvalidRequestException;
|
||||
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||
use Throwable;
|
||||
|
||||
class Alipay implements LivewireMethodInterface
|
||||
{
|
||||
@ -34,8 +36,9 @@ class Alipay implements LivewireMethodInterface
|
||||
|
||||
public function paymentView(array $data)
|
||||
{
|
||||
|
||||
$data = $this->paymentData($data);
|
||||
|
||||
|
||||
return render('gateways.stripe.alipay.pay', $data);
|
||||
}
|
||||
|
||||
@ -64,8 +67,6 @@ class Alipay implements LivewireMethodInterface
|
||||
$this->stripe->stripe_connect_auth
|
||||
);
|
||||
|
||||
nlog($pi);
|
||||
|
||||
if (in_array($pi->status, ['succeeded', 'pending'])) {
|
||||
return $this->processSuccesfulRedirect($pi);
|
||||
}
|
||||
@ -143,18 +144,24 @@ class Alipay implements LivewireMethodInterface
|
||||
*/
|
||||
public function paymentData(array $data): array
|
||||
{
|
||||
$intent = \Stripe\PaymentIntent::create([
|
||||
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
||||
'currency' => $this->stripe->client->currency()->code,
|
||||
'payment_method_types' => ['alipay'],
|
||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||
'description' => $this->stripe->getDescription(false),
|
||||
'metadata' => [
|
||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||
'gateway_type_id' => GatewayType::ALIPAY,
|
||||
],
|
||||
], $this->stripe->stripe_connect_auth);
|
||||
try {
|
||||
$intent = \Stripe\PaymentIntent::create([
|
||||
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
||||
'currency' => $this->stripe->client->currency()->code,
|
||||
'payment_method_types' => ['alipay'],
|
||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||
'description' => $this->stripe->getDescription(false),
|
||||
'metadata' => [
|
||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||
'gateway_type_id' => GatewayType::ALIPAY,
|
||||
],
|
||||
], $this->stripe->stripe_connect_auth);
|
||||
}
|
||||
catch(\Throwable $e){
|
||||
|
||||
throw new PaymentFailed($e->getMessage(), $e->getCode());
|
||||
|
||||
}
|
||||
|
||||
$data['gateway'] = $this->stripe;
|
||||
$data['return_url'] = $this->buildReturnUrl();
|
||||
|
Loading…
x
Reference in New Issue
Block a user