diff --git a/app/DataProviders/EDocRules.php b/app/DataProviders/EDocRules.php index d58458154460..7c7f5ff1f54b 100644 --- a/app/DataProviders/EDocRules.php +++ b/app/DataProviders/EDocRules.php @@ -67,6 +67,7 @@ class EDocRules "type" => "dropdown", "resource" => "CondizioniPagamento", "required" => false, + "children" => [], ], [ "key" => "DatiContratto", @@ -74,6 +75,14 @@ class EDocRules "type" => "object", "resource" => "DatiContratto", "required" => false, + "children" => [ + [ + "key"=> "RiferimentoNumeroLinea", + "validation" => [ + "string","min:1","max:10","required" + ], + ] + ], ], [ "key" => "DatiOrdineAcquisto", diff --git a/app/Http/Controllers/TwilioController.php b/app/Http/Controllers/TwilioController.php index f47a2920ac5d..ddd0df7ab763 100644 --- a/app/Http/Controllers/TwilioController.php +++ b/app/Http/Controllers/TwilioController.php @@ -144,7 +144,6 @@ class TwilioController extends BaseController public function generate2faResetCode(Generate2faRequest $request) { nlog($request->all()); - nlog($request->headers()); $user = User::where('email', $request->email)->first(); diff --git a/app/PaymentDrivers/PayPalRestPaymentDriver.php b/app/PaymentDrivers/PayPalRestPaymentDriver.php index f02c2fa27634..5e553dd526df 100644 --- a/app/PaymentDrivers/PayPalRestPaymentDriver.php +++ b/app/PaymentDrivers/PayPalRestPaymentDriver.php @@ -167,9 +167,9 @@ class PayPalRestPaymentDriver extends BaseDriver $data['currency'] = $this->client->currency()->code; -// return render('gateways.paypal.ppcp.card', $data); +return render('gateways.paypal.ppcp.card', $data); -return render('gateways.paypal.pay', $data); +// return render('gateways.paypal.pay', $data); } @@ -327,6 +327,65 @@ return render('gateways.paypal.pay', $data); } + private function getPaymentSource(): array + { + + if($this->gateway_type_id == 1) { + + return [ + "card" => [ + "attributes" => [ + "verification" => [ + "method" => "SCA_WHEN_REQUIRED", //SCA_ALWAYS + ], + ], + "name" => $this->client->present()->primary_contact_name(), + "email_address" => $this->client->present()->email(), + "address" => [ + "address_line_1" => $this->client->address1, + "address_line_2" => $this->client->address2, + "admin_area_2" => $this->client->city, + "admin_area_1" => $this->client->state, + "postal_code" => $this->client->postal_code, + "country_code" => $this->client->country->iso_3166_2, + ], + "experience_context" => [ + "user_action" => "PAY_NOW" + ], + "stored_credential" => [ + "payment_initiator" => "MERCHANT", //"CUSTOMER" who initiated the transaction? + "payment_type" => "UNSCHEDULED", + "usage"=> "DERIVED", + ], + ], + ]; + + } + + return [ + "paypal" => [ + "name" => [ + "given_name" => $this->client->present()->first_name(), + "surname" => $this->client->present()->last_name(), + ], + "email_address" => $this->client->present()->email(), + "address" => [ + "address_line_1" => $this->client->address1, + "address_line_2" => $this->client->address2, + "admin_area_2" => $this->client->city, + "admin_area_1" => $this->client->state, + "postal_code" => $this->client->postal_code, + "country_code" => $this->client->country->iso_3166_2, + ], + "experience_context" => [ + "user_action" => "PAY_NOW" + ], + ], + ]; + + } + + private function createOrder(array $data): string { @@ -341,27 +400,7 @@ return render('gateways.paypal.pay', $data); $order = [ "intent" => "CAPTURE", - "payment_source" => [ - "paypal" => [ - - "name" => [ - "given_name" => $this->client->present()->first_name(), - "surname" => $this->client->present()->last_name(), - ], - "email_address" => $this->client->present()->email(), - "address" => [ - "address_line_1" => $this->client->address1, - "address_line_2" => $this->client->address2, - "admin_area_2" => $this->client->city, - "admin_area_1" => $this->client->state, - "postal_code" => $this->client->postal_code, - "country_code" => $this->client->country->iso_3166_2, - ], - "experience_context" => [ - "user_action" => "PAY_NOW" - ], - ], - ], + "payment_source" => $this->getPaymentSource(), "purchase_units" => [ [ "custom_id" => $this->payment_hash->hash, diff --git a/resources/views/portal/ninja2020/gateways/paypal/ppcp/card.blade.php b/resources/views/portal/ninja2020/gateways/paypal/ppcp/card.blade.php index 020db788697c..aea037e36670 100644 --- a/resources/views/portal/ninja2020/gateways/paypal/ppcp/card.blade.php +++ b/resources/views/portal/ninja2020/gateways/paypal/ppcp/card.blade.php @@ -1,4 +1,4 @@ -@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.payment_type_credit_card'), 'card_title' => 'PayPal']) +@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.payment_type_credit_card'), 'card_title' => '']) @section('gateway_head') @@ -14,19 +14,23 @@ -
+ +