mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:47:32 -05:00 
			
		
		
		
	Merge branch 'v5-develop' into Przelewy24
This commit is contained in:
		
						commit
						d7e9d6f71f
					
				@ -630,7 +630,7 @@ class CreateSingleAccount extends Command
 | 
			
		||||
            $cg->config = encrypt(config('ninja.testvars.stripe'));
 | 
			
		||||
            $cg->save();
 | 
			
		||||
 | 
			
		||||
            $gateway_types = $cg->driver(new Client)->gatewayTypes();
 | 
			
		||||
            $gateway_types = $cg->driver()->gatewayTypes();
 | 
			
		||||
 | 
			
		||||
            $fees_and_limits = new stdClass;
 | 
			
		||||
            $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
 | 
			
		||||
@ -653,7 +653,7 @@ class CreateSingleAccount extends Command
 | 
			
		||||
            $cg->config = encrypt(config('ninja.testvars.paypal'));
 | 
			
		||||
            $cg->save();
 | 
			
		||||
 | 
			
		||||
            $gateway_types = $cg->driver(new Client)->gatewayTypes();
 | 
			
		||||
            $gateway_types = $cg->driver()->gatewayTypes();
 | 
			
		||||
 | 
			
		||||
            $fees_and_limits = new stdClass;
 | 
			
		||||
            $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
 | 
			
		||||
@ -716,7 +716,7 @@ class CreateSingleAccount extends Command
 | 
			
		||||
            $cg->config = encrypt(config('ninja.testvars.wepay'));
 | 
			
		||||
            $cg->save();
 | 
			
		||||
 | 
			
		||||
            $gateway_types = $cg->driver(new Client)->gatewayTypes();
 | 
			
		||||
            $gateway_types = $cg->driver()->gatewayTypes();
 | 
			
		||||
 | 
			
		||||
            $fees_and_limits = new stdClass;
 | 
			
		||||
            $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
 | 
			
		||||
@ -737,7 +737,7 @@ class CreateSingleAccount extends Command
 | 
			
		||||
            $cg->config = encrypt(config('ninja.testvars.braintree'));
 | 
			
		||||
            $cg->save();
 | 
			
		||||
 | 
			
		||||
            $gateway_types = $cg->driver(new Client)->gatewayTypes();
 | 
			
		||||
            $gateway_types = $cg->driver()->gatewayTypes();
 | 
			
		||||
 | 
			
		||||
            $fees_and_limits = new stdClass;
 | 
			
		||||
            $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
 | 
			
		||||
@ -761,7 +761,7 @@ class CreateSingleAccount extends Command
 | 
			
		||||
            $cg->save();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            $gateway_types = $cg->driver(new Client)->gatewayTypes();
 | 
			
		||||
            $gateway_types = $cg->driver()->gatewayTypes();
 | 
			
		||||
 | 
			
		||||
            $fees_and_limits = new stdClass;
 | 
			
		||||
            $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
 | 
			
		||||
@ -782,7 +782,7 @@ class CreateSingleAccount extends Command
 | 
			
		||||
            $cg->config = encrypt(config('ninja.testvars.mollie'));
 | 
			
		||||
            $cg->save();
 | 
			
		||||
 | 
			
		||||
            $gateway_types = $cg->driver(new Client)->gatewayTypes();
 | 
			
		||||
            $gateway_types = $cg->driver()->gatewayTypes();
 | 
			
		||||
 | 
			
		||||
            $fees_and_limits = new stdClass;
 | 
			
		||||
            $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
 | 
			
		||||
@ -803,7 +803,7 @@ class CreateSingleAccount extends Command
 | 
			
		||||
            $cg->config = encrypt(config('ninja.testvars.square'));
 | 
			
		||||
            $cg->save();
 | 
			
		||||
 | 
			
		||||
            $gateway_types = $cg->driver(new Client)->gatewayTypes();
 | 
			
		||||
            $gateway_types = $cg->driver()->gatewayTypes();
 | 
			
		||||
 | 
			
		||||
            $fees_and_limits = new stdClass;
 | 
			
		||||
            $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
 | 
			
		||||
 | 
			
		||||
@ -17,9 +17,11 @@ use App\Jobs\Util\StripeUpdatePaymentMethods;
 | 
			
		||||
use App\Libraries\MultiDB;
 | 
			
		||||
use App\Models\Client;
 | 
			
		||||
use App\Models\CompanyGateway;
 | 
			
		||||
use App\Utils\Traits\MakesHash;
 | 
			
		||||
 | 
			
		||||
class StripeController extends BaseController
 | 
			
		||||
{
 | 
			
		||||
	use MakesHash;
 | 
			
		||||
 | 
			
		||||
    private $stripe_keys = ['d14dd26a47cecc30fdd65700bfb67b34', 'd14dd26a37cecc30fdd65700bfb55b23'];
 | 
			
		||||
 | 
			
		||||
@ -75,4 +77,16 @@ class StripeController extends BaseController
 | 
			
		||||
		return response()->json(['message' => 'Unauthorized'], 403);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function disconnect(string $company_gateway_id)
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
		$company_gateway = CompanyGateway::where('company_id', auth()->user()->company()->id)
 | 
			
		||||
										 ->where('id', $this->decodePrimaryKey($company_gateway_id))
 | 
			
		||||
										 ->whereIn('gateway_key', $this->stripe_keys)
 | 
			
		||||
										 ->firstOrFail();
 | 
			
		||||
 | 
			
		||||
		return $company_gateway->driver()->disconnect();
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -105,7 +105,10 @@ class Gateway extends StaticModel
 | 
			
		||||
                    GatewayType::APPLE_PAY => ['refund' => false, 'token_billing' => false],
 | 
			
		||||
                    GatewayType::SOFORT => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']], //Stripe
 | 
			
		||||
                    GatewayType::SEPA => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']],
 | 
			
		||||
                    GatewayType::PRZELEWY24 => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']]];
 | 
			
		||||
                    GatewayType::PRZELEWY24 => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']],
 | 
			
		||||
                    GatewayType::GIROPAY => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']],
 | 
			
		||||
                    GatewayType::IDEAL => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']]];
 | 
			
		||||
 | 
			
		||||
            case 39:
 | 
			
		||||
                return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true]]; //Checkout
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
@ -29,6 +29,7 @@ class GatewayType extends StaticModel
 | 
			
		||||
    const BANCONTACT = 12;
 | 
			
		||||
    const IDEAL = 13;
 | 
			
		||||
    const HOSTED_PAGE = 14; // For gateways that contain multiple methods.
 | 
			
		||||
    const GIROPAY = 15;
 | 
			
		||||
    const PRZELEWY24 = 16;
 | 
			
		||||
 | 
			
		||||
    public function gateway()
 | 
			
		||||
@ -72,6 +73,8 @@ class GatewayType extends StaticModel
 | 
			
		||||
                return ctrans('texts.aio_checkout');
 | 
			
		||||
            case self::PRZELEWY24:
 | 
			
		||||
                return ctrans('texts.przelewy24');
 | 
			
		||||
            case self::GIROPAY:
 | 
			
		||||
                return ctrans('texts.giropay');
 | 
			
		||||
            default:
 | 
			
		||||
                return 'Undefined.';
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
@ -47,8 +47,10 @@ class PaymentType extends StaticModel
 | 
			
		||||
    const BANCONTACT = 36;
 | 
			
		||||
    const IDEAL = 37;
 | 
			
		||||
    const HOSTED_PAGE = 38;
 | 
			
		||||
    const GIROPAY = 39;
 | 
			
		||||
    const PRZELEWY24 = 40;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static function parseCardType($cardName)
 | 
			
		||||
    {
 | 
			
		||||
        $cardTypes = [
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										141
									
								
								app/PaymentDrivers/Stripe/GIROPAY.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								app/PaymentDrivers/Stripe/GIROPAY.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,141 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com).
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://www.elastic.co/licensing/elastic-license
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace App\PaymentDrivers\Stripe;
 | 
			
		||||
 | 
			
		||||
use App\Exceptions\PaymentFailed;
 | 
			
		||||
use App\Jobs\Mail\PaymentFailureMailer;
 | 
			
		||||
use App\Jobs\Util\SystemLogger;
 | 
			
		||||
use App\Models\GatewayType;
 | 
			
		||||
use App\Models\Payment;
 | 
			
		||||
use App\Models\PaymentType;
 | 
			
		||||
use App\Models\SystemLog;
 | 
			
		||||
use App\PaymentDrivers\StripePaymentDriver;
 | 
			
		||||
 | 
			
		||||
class GIROPAY
 | 
			
		||||
{
 | 
			
		||||
    /** @var StripePaymentDriver */
 | 
			
		||||
    public StripePaymentDriver $stripe;
 | 
			
		||||
 | 
			
		||||
    public function __construct(StripePaymentDriver $stripe)
 | 
			
		||||
    {
 | 
			
		||||
        $this->stripe = $stripe;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function authorizeView($data)
 | 
			
		||||
    {
 | 
			
		||||
        return render('gateways.stripe.giropay.authorize', $data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function paymentView(array $data)
 | 
			
		||||
    {
 | 
			
		||||
        $data['gateway'] = $this->stripe;
 | 
			
		||||
        $data['return_url'] = $this->buildReturnUrl();
 | 
			
		||||
        $data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
 | 
			
		||||
        $data['client'] = $this->stripe->client;
 | 
			
		||||
        $data['customer'] = $this->stripe->findOrCreateCustomer()->id;
 | 
			
		||||
        $data['country'] = $this->stripe->client->country->iso_3166_2;
 | 
			
		||||
 | 
			
		||||
        $intent = \Stripe\PaymentIntent::create([
 | 
			
		||||
            'amount' => $data['stripe_amount'],
 | 
			
		||||
            'currency' => 'eur',
 | 
			
		||||
            'payment_method_types' => ['giropay'],
 | 
			
		||||
            'customer' => $this->stripe->findOrCreateCustomer(),
 | 
			
		||||
            'description' => $this->stripe->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')),
 | 
			
		||||
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $data['pi_client_secret'] = $intent->client_secret;
 | 
			
		||||
 | 
			
		||||
        $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
 | 
			
		||||
        $this->stripe->payment_hash->save();
 | 
			
		||||
 | 
			
		||||
        return render('gateways.stripe.giropay.pay', $data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function buildReturnUrl(): string
 | 
			
		||||
    {
 | 
			
		||||
        return route('client.payments.response', [
 | 
			
		||||
            'company_gateway_id' => $this->stripe->company_gateway->id,
 | 
			
		||||
            'payment_hash' => $this->stripe->payment_hash->hash,
 | 
			
		||||
            'payment_method_id' => GatewayType::GIROPAY,
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function paymentResponse($request)
 | 
			
		||||
    {
 | 
			
		||||
        $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
 | 
			
		||||
        $this->stripe->payment_hash->save();
 | 
			
		||||
 | 
			
		||||
        if ($request->redirect_status == 'succeeded') {
 | 
			
		||||
            return $this->processSuccessfulPayment($request->payment_intent);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->processUnsuccessfulPayment();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function processSuccessfulPayment(string $payment_intent)
 | 
			
		||||
    {
 | 
			
		||||
        /* @todo: https://github.com/invoiceninja/invoiceninja/pull/3789/files#r436175798 */
 | 
			
		||||
 | 
			
		||||
        $this->stripe->init();
 | 
			
		||||
 | 
			
		||||
        $data = [
 | 
			
		||||
            'payment_method' => $payment_intent,
 | 
			
		||||
            'payment_type' => PaymentType::GIROPAY,
 | 
			
		||||
            'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
 | 
			
		||||
            'transaction_reference' => $payment_intent,
 | 
			
		||||
            'gateway_type_id' => GatewayType::GIROPAY,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $this->stripe->createPayment($data, Payment::STATUS_PENDING);
 | 
			
		||||
 | 
			
		||||
        SystemLogger::dispatch(
 | 
			
		||||
            ['response' => $this->stripe->payment_hash->data, 'data' => $data],
 | 
			
		||||
            SystemLog::CATEGORY_GATEWAY_RESPONSE,
 | 
			
		||||
            SystemLog::EVENT_GATEWAY_SUCCESS,
 | 
			
		||||
            SystemLog::TYPE_STRIPE,
 | 
			
		||||
            $this->stripe->client,
 | 
			
		||||
            $this->stripe->client->company,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        return redirect()->route('client.payments.index');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function processUnsuccessfulPayment()
 | 
			
		||||
    {
 | 
			
		||||
        $server_response = $this->stripe->payment_hash->data;
 | 
			
		||||
 | 
			
		||||
        PaymentFailureMailer::dispatch(
 | 
			
		||||
            $this->stripe->client,
 | 
			
		||||
            $server_response,
 | 
			
		||||
            $this->stripe->client->company,
 | 
			
		||||
            $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency())
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $message = [
 | 
			
		||||
            'server_response' => $server_response,
 | 
			
		||||
            'data' => $this->stripe->payment_hash->data,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        SystemLogger::dispatch(
 | 
			
		||||
            $message,
 | 
			
		||||
            SystemLog::CATEGORY_GATEWAY_RESPONSE,
 | 
			
		||||
            SystemLog::EVENT_GATEWAY_FAILURE,
 | 
			
		||||
            SystemLog::TYPE_STRIPE,
 | 
			
		||||
            $this->stripe->client,
 | 
			
		||||
            $this->stripe->client->company,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        throw new PaymentFailed('Failed to process the payment.', 500);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										141
									
								
								app/PaymentDrivers/Stripe/iDeal.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								app/PaymentDrivers/Stripe/iDeal.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,141 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com).
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://www.elastic.co/licensing/elastic-license
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace App\PaymentDrivers\Stripe;
 | 
			
		||||
 | 
			
		||||
use App\Exceptions\PaymentFailed;
 | 
			
		||||
use App\Jobs\Mail\PaymentFailureMailer;
 | 
			
		||||
use App\Jobs\Util\SystemLogger;
 | 
			
		||||
use App\Models\GatewayType;
 | 
			
		||||
use App\Models\Payment;
 | 
			
		||||
use App\Models\PaymentType;
 | 
			
		||||
use App\Models\SystemLog;
 | 
			
		||||
use App\PaymentDrivers\StripePaymentDriver;
 | 
			
		||||
 | 
			
		||||
class iDeal
 | 
			
		||||
{
 | 
			
		||||
    /** @var StripePaymentDriver */
 | 
			
		||||
    public StripePaymentDriver $stripe;
 | 
			
		||||
 | 
			
		||||
    public function __construct(StripePaymentDriver $stripe)
 | 
			
		||||
    {
 | 
			
		||||
        $this->stripe = $stripe;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function authorizeView($data)
 | 
			
		||||
    {
 | 
			
		||||
        return render('gateways.stripe.ideal.authorize', $data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function paymentView(array $data)
 | 
			
		||||
    {
 | 
			
		||||
        $data['gateway'] = $this->stripe;
 | 
			
		||||
        $data['return_url'] = $this->buildReturnUrl();
 | 
			
		||||
        $data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
 | 
			
		||||
        $data['client'] = $this->stripe->client;
 | 
			
		||||
        $data['customer'] = $this->stripe->findOrCreateCustomer()->id;
 | 
			
		||||
        $data['country'] = $this->stripe->client->country->iso_3166_2;
 | 
			
		||||
 | 
			
		||||
        $intent = \Stripe\PaymentIntent::create([
 | 
			
		||||
            'amount' => $data['stripe_amount'],
 | 
			
		||||
            'currency' => 'eur',
 | 
			
		||||
            'payment_method_types' => ['ideal'],
 | 
			
		||||
            'customer' => $this->stripe->findOrCreateCustomer(),
 | 
			
		||||
            'description' => $this->stripe->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')),
 | 
			
		||||
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $data['pi_client_secret'] = $intent->client_secret;
 | 
			
		||||
 | 
			
		||||
        $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
 | 
			
		||||
        $this->stripe->payment_hash->save();
 | 
			
		||||
 | 
			
		||||
        return render('gateways.stripe.ideal.pay', $data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function buildReturnUrl(): string
 | 
			
		||||
    {
 | 
			
		||||
        return route('client.payments.response', [
 | 
			
		||||
            'company_gateway_id' => $this->stripe->company_gateway->id,
 | 
			
		||||
            'payment_hash' => $this->stripe->payment_hash->hash,
 | 
			
		||||
            'payment_method_id' => GatewayType::IDEAL,
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function paymentResponse($request)
 | 
			
		||||
    {
 | 
			
		||||
        $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
 | 
			
		||||
        $this->stripe->payment_hash->save();
 | 
			
		||||
 | 
			
		||||
        if ($request->redirect_status == 'succeeded') {
 | 
			
		||||
            return $this->processSuccessfulPayment($request->payment_intent);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->processUnsuccessfulPayment();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function processSuccessfulPayment(string $payment_intent)
 | 
			
		||||
    {
 | 
			
		||||
        /* @todo: https://github.com/invoiceninja/invoiceninja/pull/3789/files#r436175798 */
 | 
			
		||||
 | 
			
		||||
        $this->stripe->init();
 | 
			
		||||
 | 
			
		||||
        $data = [
 | 
			
		||||
            'payment_method' => $payment_intent,
 | 
			
		||||
            'payment_type' => PaymentType::IDEAL,
 | 
			
		||||
            'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
 | 
			
		||||
            'transaction_reference' => $payment_intent,
 | 
			
		||||
            'gateway_type_id' => GatewayType::IDEAL,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $this->stripe->createPayment($data, Payment::STATUS_PENDING);
 | 
			
		||||
 | 
			
		||||
        SystemLogger::dispatch(
 | 
			
		||||
            ['response' => $this->stripe->payment_hash->data, 'data' => $data],
 | 
			
		||||
            SystemLog::CATEGORY_GATEWAY_RESPONSE,
 | 
			
		||||
            SystemLog::EVENT_GATEWAY_SUCCESS,
 | 
			
		||||
            SystemLog::TYPE_STRIPE,
 | 
			
		||||
            $this->stripe->client,
 | 
			
		||||
            $this->stripe->client->company,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        return redirect()->route('client.payments.index');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function processUnsuccessfulPayment()
 | 
			
		||||
    {
 | 
			
		||||
        $server_response = $this->stripe->payment_hash->data;
 | 
			
		||||
 | 
			
		||||
        PaymentFailureMailer::dispatch(
 | 
			
		||||
            $this->stripe->client,
 | 
			
		||||
            $server_response,
 | 
			
		||||
            $this->stripe->client->company,
 | 
			
		||||
            $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency())
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $message = [
 | 
			
		||||
            'server_response' => $server_response,
 | 
			
		||||
            'data' => $this->stripe->payment_hash->data,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        SystemLogger::dispatch(
 | 
			
		||||
            $message,
 | 
			
		||||
            SystemLog::CATEGORY_GATEWAY_RESPONSE,
 | 
			
		||||
            SystemLog::EVENT_GATEWAY_FAILURE,
 | 
			
		||||
            SystemLog::TYPE_STRIPE,
 | 
			
		||||
            $this->stripe->client,
 | 
			
		||||
            $this->stripe->client->company,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        throw new PaymentFailed('Failed to process the payment.', 500);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -34,6 +34,8 @@ use App\PaymentDrivers\Stripe\ImportCustomers;
 | 
			
		||||
use App\PaymentDrivers\Stripe\SOFORT;
 | 
			
		||||
use App\PaymentDrivers\Stripe\SEPA;
 | 
			
		||||
use App\PaymentDrivers\Stripe\PRZELEWY24;
 | 
			
		||||
use App\PaymentDrivers\Stripe\GIROPAY;
 | 
			
		||||
use App\PaymentDrivers\Stripe\iDeal;
 | 
			
		||||
use App\PaymentDrivers\Stripe\UpdatePaymentMethods;
 | 
			
		||||
use App\PaymentDrivers\Stripe\Utilities;
 | 
			
		||||
use App\Utils\Traits\MakesHash;
 | 
			
		||||
@ -79,7 +81,8 @@ class StripePaymentDriver extends BaseDriver
 | 
			
		||||
        GatewayType::APPLE_PAY => ApplePay::class,
 | 
			
		||||
        GatewayType::SEPA => SEPA::class,
 | 
			
		||||
        GatewayType::PRZELEWY24 => PRZELEWY24::class,
 | 
			
		||||
 | 
			
		||||
        GatewayType::GIROPAY => GIROPAY::class,
 | 
			
		||||
        GatewayType::IDEAL => iDeal::class,
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    const SYSTEM_LOG_TYPE = SystemLog::TYPE_STRIPE;
 | 
			
		||||
@ -151,6 +154,8 @@ class StripePaymentDriver extends BaseDriver
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->client
 | 
			
		||||
            && $this->client->currency()
 | 
			
		||||
            && ($this->client->currency()->code == 'EUR')
 | 
			
		||||
            && isset($this->client->country)
 | 
			
		||||
            && in_array($this->client->country->iso_3166_3, ['AUS', 'DNK', 'DEU', 'ITA', 'LUX', 'NOR', 'SVN', 'GBR', 'EST', 'GRC', 'JPN', 'PRT', 'ESP', 'USA', 'BEL', 'FIN'])) { // TODO: More has to be added https://stripe.com/docs/payments/sepa-debit
 | 
			
		||||
            $types[] = GatewayType::SEPA;
 | 
			
		||||
@ -162,6 +167,21 @@ class StripePaymentDriver extends BaseDriver
 | 
			
		||||
            $types[] = GatewayType::PRZELEWY24;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if($this->client
 | 
			
		||||
            && $this->client->currency()
 | 
			
		||||
            && ($this->client->currency()->code == 'EUR')
 | 
			
		||||
            && isset($this->client->country)
 | 
			
		||||
            && in_array($this->client->country->iso_3166_3, ["DEU"])){
 | 
			
		||||
            $types[] = GatewayType::GIROPAY;
 | 
			
		||||
        }
 | 
			
		||||
      
 | 
			
		||||
        if ($this->client
 | 
			
		||||
            && $this->client->currency()
 | 
			
		||||
            && ($this->client->currency()->code == 'EUR')
 | 
			
		||||
            && isset($this->client->country)
 | 
			
		||||
            && in_array($this->client->country->iso_3166_3, ["NLD"]))
 | 
			
		||||
            $types[] = GatewayType::IDEAL;
 | 
			
		||||
 | 
			
		||||
        return $types;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -188,7 +208,11 @@ class StripePaymentDriver extends BaseDriver
 | 
			
		||||
            case GatewayType::APPLE_PAY:
 | 
			
		||||
                return 'gateways.stripe.other';
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
            case GatewayType::GIROPAY:
 | 
			
		||||
                return 'gateways.stripe.giropay';
 | 
			
		||||
                break;
 | 
			
		||||
            case GatewayType::IDEAL:
 | 
			
		||||
                return 'gateways.stripe.ideal';
 | 
			
		||||
            default:
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
@ -648,6 +672,11 @@ class StripePaymentDriver extends BaseDriver
 | 
			
		||||
              'stripe_user_id' => $this->company_gateway->getConfigField('account_id'),
 | 
			
		||||
            ]);
 | 
			
		||||
 | 
			
		||||
            $config = $this->company_gateway->getConfig();
 | 
			
		||||
            $config->account_id = "";
 | 
			
		||||
            $this->company_gateway->setConfig($config);
 | 
			
		||||
            $this->company_gateway->save();
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        catch(\Exception $e){
 | 
			
		||||
            throw new StripeConnectFailure('Unable to disconnect Stripe Connect');
 | 
			
		||||
 | 
			
		||||
@ -203,6 +203,7 @@ class HtmlEngine
 | 
			
		||||
        if ($this->entity->partial > 0) {
 | 
			
		||||
            $data['$balance_due'] = ['value' => Number::formatMoney($this->entity->partial, $this->client) ?: ' ', 'label' => ctrans('texts.partial_due')];
 | 
			
		||||
            $data['$balance_due_raw'] = ['value' => $this->entity->partial, 'label' => ctrans('texts.partial_due')];
 | 
			
		||||
            $data['$amount_raw'] = ['value' => $this->entity->partial, 'label' => ctrans('texts.partial_due')];
 | 
			
		||||
            $data['$due_date'] = ['value' => $this->translateDate($this->entity->partial_due_date, $this->client->date_format(), $this->client->locale()) ?: ' ', 'label' => ctrans('texts.'.$this->entity_string.'_due_date')];
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
@ -210,10 +211,12 @@ class HtmlEngine
 | 
			
		||||
            if($this->entity->status_id == 1){
 | 
			
		||||
                $data['$balance_due'] = ['value' => Number::formatMoney($this->entity->amount, $this->client) ?: ' ', 'label' => ctrans('texts.balance_due')];
 | 
			
		||||
                $data['$balance_due_raw'] = ['value' => $this->entity->amount, 'label' => ctrans('texts.balance_due')];
 | 
			
		||||
                $data['$amount_raw'] = ['value' => $this->entity->amount, 'label' => ctrans('texts.amount')];
 | 
			
		||||
            }
 | 
			
		||||
            else{
 | 
			
		||||
                $data['$balance_due'] = ['value' => Number::formatMoney($this->entity->balance, $this->client) ?: ' ', 'label' => ctrans('texts.balance_due')];
 | 
			
		||||
                $data['$balance_due_raw'] = ['value' => $this->entity->balance, 'label' => ctrans('texts.balance_due')];
 | 
			
		||||
                $data['$amount_raw'] = ['value' => $this->entity->amount, 'label' => ctrans('texts.amount')];
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								public/js/clients/payments/stripe-giropay.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								public/js/clients/payments/stripe-giropay.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=6)}({6:function(e,t,n){e.exports=n("RFiP")},RFiP:function(e,t){var n,r,o,i;function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",l=null!==(o=null===(i=document.querySelector('meta[name="stripe-account-id"]'))||void 0===i?void 0:i.content)&&void 0!==o?o:"";new function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"setupStripe",function(){return r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=l),r}),u(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",function(e){let t=document.getElementById("errors");if(!document.getElementById("giropay-mandate-acceptance").checked)return t.textContent="Accept Terms",t.hidden=!1,void console.log("Terms");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmGiropayPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("giropay-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})})}),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}(c,l).setupStripe().handle()}});
 | 
			
		||||
							
								
								
									
										9
									
								
								public/js/clients/payments/stripe-giropay.js.LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								public/js/clients/payments/stripe-giropay.js.LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://opensource.org/licenses/AAL
 | 
			
		||||
 */
 | 
			
		||||
							
								
								
									
										1
									
								
								public/js/clients/payments/stripe-ideal.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								public/js/clients/payments/stripe-ideal.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
!function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=6)}({6:function(e,t,n){e.exports=n("RFiP")},RFiP:function(e,t){var n;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",i=null!==(n=null===(n=document.querySelector('meta[name="stripe-account-id"]'))||void 0===n?void 0:n.content)&&void 0!==n?n:"";new function t(e,n){var r=this;!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),o(this,"setupStripe",function(){r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=i);let e=r.stripe.elements();return this.ideal=e.create("idealBank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),this.ideal.mount("#ideal-bank-element"),r}),o(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",e=>{let t=document.getElementById("errors");if(!document.getElementById("ideal-name").value)return t.textContent="Enter name",t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmIdealPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{ideal:this.ideal,billing_details:{name:document.getElementById("ideal-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})})}),this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=n}(r,i).setupStripe().handle()}});
 | 
			
		||||
							
								
								
									
										9
									
								
								public/js/clients/payments/stripe-ideal.js.LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								public/js/clients/payments/stripe-ideal.js.LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://opensource.org/licenses/AAL
 | 
			
		||||
 */
 | 
			
		||||
							
								
								
									
										65
									
								
								resources/js/clients/payments/stripe-giropay.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								resources/js/clients/payments/stripe-giropay.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,65 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://opensource.org/licenses/AAL
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
class ProcessGiroPay {
 | 
			
		||||
    constructor(key, stripeConnect) {
 | 
			
		||||
        this.key = key;
 | 
			
		||||
        this.errors = document.getElementById('errors');
 | 
			
		||||
        this.stripeConnect = stripeConnect;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    setupStripe = () => {
 | 
			
		||||
        this.stripe = Stripe(this.key);
 | 
			
		||||
 | 
			
		||||
        if(this.stripeConnect)
 | 
			
		||||
            this.stripe.stripeAccount = stripeConnect;
 | 
			
		||||
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    handle = () => {
 | 
			
		||||
        document.getElementById('pay-now').addEventListener('click', (e) => {
 | 
			
		||||
            let errors = document.getElementById('errors');
 | 
			
		||||
 | 
			
		||||
            if (!document.getElementById('giropay-mandate-acceptance').checked) {
 | 
			
		||||
                errors.textContent = "Accept Terms";
 | 
			
		||||
                errors.hidden = false;
 | 
			
		||||
                console.log("Terms");
 | 
			
		||||
                return ;
 | 
			
		||||
            }
 | 
			
		||||
            document.getElementById('pay-now').disabled = true;
 | 
			
		||||
            document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
			
		||||
            document.querySelector('#pay-now > span').classList.add('hidden');
 | 
			
		||||
 | 
			
		||||
            this.stripe.confirmGiropayPayment(
 | 
			
		||||
                document.querySelector('meta[name=pi-client-secret').content,
 | 
			
		||||
                {
 | 
			
		||||
                    payment_method: {
 | 
			
		||||
                        billing_details: {
 | 
			
		||||
                            name: document.getElementById("giropay-name").value,
 | 
			
		||||
                        },
 | 
			
		||||
                    },
 | 
			
		||||
                    return_url: document.querySelector(
 | 
			
		||||
                        'meta[name="return-url"]'
 | 
			
		||||
                    ).content,
 | 
			
		||||
                }
 | 
			
		||||
            );
 | 
			
		||||
        });
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const publishableKey = document.querySelector(
 | 
			
		||||
    'meta[name="stripe-publishable-key"]'
 | 
			
		||||
)?.content ?? '';
 | 
			
		||||
 | 
			
		||||
const stripeConnect =
 | 
			
		||||
    document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
 | 
			
		||||
 | 
			
		||||
new ProcessGiroPay(publishableKey, stripeConnect).setupStripe().handle();
 | 
			
		||||
							
								
								
									
										80
									
								
								resources/js/clients/payments/stripe-ideal.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								resources/js/clients/payments/stripe-ideal.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,80 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://opensource.org/licenses/AAL
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
class ProcessIDEALPay {
 | 
			
		||||
    constructor(key, stripeConnect) {
 | 
			
		||||
        this.key = key;
 | 
			
		||||
        this.errors = document.getElementById('errors');
 | 
			
		||||
        this.stripeConnect = stripeConnect;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    setupStripe = () => {
 | 
			
		||||
        this.stripe = Stripe(this.key);
 | 
			
		||||
 | 
			
		||||
        if(this.stripeConnect)
 | 
			
		||||
            this.stripe.stripeAccount = stripeConnect;
 | 
			
		||||
        let elements = this.stripe.elements();
 | 
			
		||||
        var options = {
 | 
			
		||||
            style: {
 | 
			
		||||
                base: {
 | 
			
		||||
                    padding: '10px 12px',
 | 
			
		||||
                    color: '#32325d',
 | 
			
		||||
                    fontSize: '16px',
 | 
			
		||||
                    '::placeholder': {
 | 
			
		||||
                        color: '#aab7c4'
 | 
			
		||||
                    },
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
        };
 | 
			
		||||
        this.ideal = elements.create('idealBank', options);
 | 
			
		||||
        this.ideal.mount("#ideal-bank-element");
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    handle = () => {
 | 
			
		||||
        document.getElementById('pay-now').addEventListener('click', (e) => {
 | 
			
		||||
            let errors = document.getElementById('errors');
 | 
			
		||||
 | 
			
		||||
            if (!document.getElementById('ideal-name').value) {
 | 
			
		||||
                errors.textContent = "Enter name";
 | 
			
		||||
                errors.hidden = false;
 | 
			
		||||
                console.log("name");
 | 
			
		||||
                return ;
 | 
			
		||||
            }
 | 
			
		||||
            document.getElementById('pay-now').disabled = true;
 | 
			
		||||
            document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
			
		||||
            document.querySelector('#pay-now > span').classList.add('hidden');
 | 
			
		||||
 | 
			
		||||
            this.stripe.confirmIdealPayment(
 | 
			
		||||
                document.querySelector('meta[name=pi-client-secret').content,
 | 
			
		||||
                {
 | 
			
		||||
                    payment_method: {
 | 
			
		||||
                        ideal: this.ideal,
 | 
			
		||||
                        billing_details: {
 | 
			
		||||
                            name: document.getElementById("ideal-name").value,
 | 
			
		||||
                        },
 | 
			
		||||
                    },
 | 
			
		||||
                    return_url: document.querySelector(
 | 
			
		||||
                        'meta[name="return-url"]'
 | 
			
		||||
                    ).content,
 | 
			
		||||
                }
 | 
			
		||||
            );
 | 
			
		||||
        });
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const publishableKey = document.querySelector(
 | 
			
		||||
    'meta[name="stripe-publishable-key"]'
 | 
			
		||||
)?.content ?? '';
 | 
			
		||||
 | 
			
		||||
const stripeConnect =
 | 
			
		||||
    document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
 | 
			
		||||
 | 
			
		||||
new ProcessIDEALPay(publishableKey, stripeConnect).setupStripe().handle();
 | 
			
		||||
@ -4322,6 +4322,8 @@ $LANG = array(
 | 
			
		||||
    'aio_checkout' => 'All-in-one checkout',
 | 
			
		||||
    'przelewy24' => 'Przelewy24',
 | 
			
		||||
    'przelewy24_accept' => 'I declare that I have familiarized myself with the regulations and information obligation of the Przelewy24 service.'
 | 
			
		||||
    'giropay' => 'GiroPay',
 | 
			
		||||
    'giropay_law' => 'By entering your Customer information (such as name, sort code and account number) you (the Customer) agree that this information is given voluntarily.'
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
return $LANG;
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,7 @@
 | 
			
		||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.bank_account'), 'card_title' => ctrans('texts.bank_account')])
 | 
			
		||||
 | 
			
		||||
@section('gateway_content')
 | 
			
		||||
    @component('portal.ninja2020.components.general.card-element-single', ['title' => ctrans('texts.bank_account'), 'show_title' => false])
 | 
			
		||||
        {{ __('texts.sofort_authorize_label') }}
 | 
			
		||||
    @endcomponent
 | 
			
		||||
@endsection
 | 
			
		||||
@ -0,0 +1,11 @@
 | 
			
		||||
<div id="stripe--payment-container">
 | 
			
		||||
    @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.name')])
 | 
			
		||||
        <label for="giropay-name">
 | 
			
		||||
            <input class="input w-full" id="giropay-name" type="text" placeholder="{{ ctrans('texts.bank_account_holder') }}">
 | 
			
		||||
        </label>
 | 
			
		||||
        <div id="mandate-acceptance">
 | 
			
		||||
            <input type="checkbox" id="giropay-mandate-acceptance" class="input mr-4">
 | 
			
		||||
            <label for="giropay-mandate-acceptance">{{ctrans('texts.giropay_law')}}</label>
 | 
			
		||||
        </div>
 | 
			
		||||
    @endcomponent
 | 
			
		||||
</div>
 | 
			
		||||
@ -0,0 +1,28 @@
 | 
			
		||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'GiroPay', 'card_title' => 'GiroPay'])
 | 
			
		||||
 | 
			
		||||
@section('gateway_head')
 | 
			
		||||
    <meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
 | 
			
		||||
    <meta name="stripe-account-id" content="{{ $gateway->company_gateway->getConfigField('account_id') }}">
 | 
			
		||||
    <meta name="return-url" content="{{ $return_url }}">
 | 
			
		||||
    <meta name="amount" content="{{ $stripe_amount }}">
 | 
			
		||||
    <meta name="country" content="{{ $country }}">
 | 
			
		||||
    <meta name="customer" content="{{ $customer }}">
 | 
			
		||||
    <meta name="pi-client-secret" content="{{ $pi_client_secret }}">
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('gateway_content')
 | 
			
		||||
    <div class="alert alert-failure mb-4" hidden id="errors"></div>
 | 
			
		||||
 | 
			
		||||
    @include('portal.ninja2020.gateways.includes.payment_details')
 | 
			
		||||
 | 
			
		||||
    @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')])
 | 
			
		||||
        {{ ctrans('texts.giropay') }} ({{ ctrans('texts.bank_transfer') }})
 | 
			
		||||
    @endcomponent
 | 
			
		||||
    @include('portal.ninja2020.gateways.stripe.giropay.giropay')
 | 
			
		||||
    @include('portal.ninja2020.gateways.includes.pay_now')
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@push('footer')
 | 
			
		||||
    <script src="https://js.stripe.com/v3/"></script>
 | 
			
		||||
    <script src="{{ asset('js/clients/payments/stripe-giropay.js') }}"></script>
 | 
			
		||||
@endpush
 | 
			
		||||
@ -0,0 +1,7 @@
 | 
			
		||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.bank_account'), 'card_title' => ctrans('texts.bank_account')])
 | 
			
		||||
 | 
			
		||||
@section('gateway_content')
 | 
			
		||||
    @component('portal.ninja2020.components.general.card-element-single', ['title' => ctrans('texts.bank_account'), 'show_title' => false])
 | 
			
		||||
        {{ __('texts.sofort_authorize_label') }}
 | 
			
		||||
    @endcomponent
 | 
			
		||||
@endsection
 | 
			
		||||
@ -0,0 +1,11 @@
 | 
			
		||||
<div id="stripe--payment-container">
 | 
			
		||||
    @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.name')])
 | 
			
		||||
        <label for="giropay-name">
 | 
			
		||||
            <input class="input w-full" id="ideal-name" type="text" placeholder="{{ ctrans('texts.bank_account_holder') }}">
 | 
			
		||||
        </label>
 | 
			
		||||
        <label for="ideal-bank-element"></label>
 | 
			
		||||
        <div class="border p-4 rounded">
 | 
			
		||||
            <div id="ideal-bank-element"></div>
 | 
			
		||||
        </div>
 | 
			
		||||
    @endcomponent
 | 
			
		||||
</div>
 | 
			
		||||
@ -0,0 +1,28 @@
 | 
			
		||||
@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'iDeal', 'card_title' => 'iDeal'])
 | 
			
		||||
 | 
			
		||||
@section('gateway_head')
 | 
			
		||||
    <meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
 | 
			
		||||
    <meta name="stripe-account-id" content="{{ $gateway->company_gateway->getConfigField('account_id') }}">
 | 
			
		||||
    <meta name="return-url" content="{{ $return_url }}">
 | 
			
		||||
    <meta name="amount" content="{{ $stripe_amount }}">
 | 
			
		||||
    <meta name="country" content="{{ $country }}">
 | 
			
		||||
    <meta name="customer" content="{{ $customer }}">
 | 
			
		||||
    <meta name="pi-client-secret" content="{{ $pi_client_secret }}">
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('gateway_content')
 | 
			
		||||
    <div class="alert alert-failure mb-4" hidden id="errors"></div>
 | 
			
		||||
 | 
			
		||||
    @include('portal.ninja2020.gateways.includes.payment_details')
 | 
			
		||||
 | 
			
		||||
    @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')])
 | 
			
		||||
        {{ ctrans('texts.ideal') }} ({{ ctrans('texts.bank_transfer') }})
 | 
			
		||||
    @endcomponent
 | 
			
		||||
    @include('portal.ninja2020.gateways.stripe.ideal.ideal')
 | 
			
		||||
    @include('portal.ninja2020.gateways.includes.pay_now')
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@push('footer')
 | 
			
		||||
    <script src="https://js.stripe.com/v3/"></script>
 | 
			
		||||
    <script src="{{ asset('js/clients/payments/stripe-ideal.js') }}"></script>
 | 
			
		||||
@endpush
 | 
			
		||||
@ -199,6 +199,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
 | 
			
		||||
    Route::post('stripe/import_customers', 'StripeController@import')->middleware('password_protected')->name('stripe.import');
 | 
			
		||||
 | 
			
		||||
    Route::post('stripe/verify', 'StripeController@verify')->middleware('password_protected')->name('stripe.verify');
 | 
			
		||||
    Route::post('stripe/disconnect/{company_gateway_id}', 'StripeController@disconnect')->middleware('password_protected')->name('stripe.disconnect');
 | 
			
		||||
 | 
			
		||||
    Route::resource('subscriptions', 'SubscriptionController');
 | 
			
		||||
    Route::post('subscriptions/bulk', 'SubscriptionController@bulk')->name('subscriptions.bulk');
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user