From d387bed9c8a99ec5faf778d8dd3eec5519161da9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 2 May 2024 13:59:18 +1000 Subject: [PATCH 1/3] SCA compliance PayPal Rest --- app/PaymentDrivers/PayPalRestPaymentDriver.php | 4 ++-- .../gateways/paypal/ppcp/card.blade.php | 17 +---------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/app/PaymentDrivers/PayPalRestPaymentDriver.php b/app/PaymentDrivers/PayPalRestPaymentDriver.php index 6583e99489e8..35fa3a902d6d 100644 --- a/app/PaymentDrivers/PayPalRestPaymentDriver.php +++ b/app/PaymentDrivers/PayPalRestPaymentDriver.php @@ -170,9 +170,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); } 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 a950e690d0c8..d28545083011 100644 --- a/resources/views/portal/ninja2020/gateways/paypal/ppcp/card.blade.php +++ b/resources/views/portal/ninja2020/gateways/paypal/ppcp/card.blade.php @@ -97,17 +97,11 @@ if(liabilityShift) { /* Handle liability shift. More information in 3D Secure response parameters */ - console.log("inside liability shift") - console.log(liabilityShift) - console.log(orderID); - console.log(data); - //doesn't really do anything as failure is linked in SUBMIT. We only hit here after a successful return - //and where SCA is optional? - if(liabilityShift == 'NO') { document.getElementById('errors').textContent = `Sorry, your transaction could not be processed, Please try a different payment method.`; document.getElementById('errors').hidden = false; + return; } @@ -118,9 +112,6 @@ return actions.restart(); } - // console.log("on approve"); - // console.log(data); - // console.log(actions); let storeCard = document.querySelector('input[name=token-billing-checkbox]:checked'); if (storeCard) { @@ -182,7 +173,6 @@ expiryField.render("#card-expiry-field-container"); document.getElementById("pay-now").addEventListener('click', (e) => { - console.log("paynow"); document.getElementById('errors').textContent = ''; document.getElementById('errors').hidden = true; @@ -196,14 +186,9 @@ document.querySelector('#pay-now > span').classList.add('hidden'); cardField.submit().then((response) => { - console.log("then"); - console.log(response); }).catch((error) => { - // console.log("catch error") - // console.log(error); - document.getElementById('pay-now').disabled = false; document.querySelector('#pay-now > svg').classList.add('hidden'); document.querySelector('#pay-now > span').classList.remove('hidden'); From 35fd12419088433e55acdbde14838640d439951d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 2 May 2024 14:27:37 +1000 Subject: [PATCH 2/3] Paypal Advanced card payments --- app/PaymentDrivers/PayPalRestPaymentDriver.php | 6 +++--- app/Services/ClientPortal/InstantPayment.php | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/PaymentDrivers/PayPalRestPaymentDriver.php b/app/PaymentDrivers/PayPalRestPaymentDriver.php index 35fa3a902d6d..e22706024668 100644 --- a/app/PaymentDrivers/PayPalRestPaymentDriver.php +++ b/app/PaymentDrivers/PayPalRestPaymentDriver.php @@ -170,9 +170,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); } @@ -400,7 +400,7 @@ return render('gateways.paypal.ppcp.card', $data); $data['token'] = $token; $data['payment_method_id'] = GatewayType::PAYPAL_ADVANCED_CARDS; $data['payment_meta'] = $payment_meta; - $data['payment_method_id'] = GatewayType::CREDIT_CARD; + // $data['payment_method_id'] = GatewayType::CREDIT_CARD; $additional['gateway_customer_reference'] = $gateway_customer_reference; diff --git a/app/Services/ClientPortal/InstantPayment.php b/app/Services/ClientPortal/InstantPayment.php index 7bd29f8f3bc5..3bbb8489e42b 100644 --- a/app/Services/ClientPortal/InstantPayment.php +++ b/app/Services/ClientPortal/InstantPayment.php @@ -208,11 +208,6 @@ class InstantPayment $credit_totals = in_array($first_invoice->client->getSetting('use_credits_payment'), ['always', 'option']) ? $first_invoice->client->service()->getCreditBalance() : 0; $starting_invoice_amount = $first_invoice->balance; - /* Schedule a job to check the gateway fees for this invoice*/ - // if (Ninja::isHosted()) { - // CheckGatewayFee::dispatch($first_invoice->id, $client->company->db)->delay(800); - // } - if ($gateway) { $first_invoice->service()->addGatewayFee($gateway, $payment_method_id, $invoice_totals)->save(); } From c31442c19b2521aaae61e33ba24e3227b766ad3f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 3 May 2024 08:20:19 +1000 Subject: [PATCH 3/3] v5.8.53 --- VERSION.txt | 2 +- .../BillingPortal/Authentication/ClientRegisterService.php | 2 +- app/Livewire/BillingPortal/Authentication/Register.php | 7 +++++++ app/PaymentDrivers/PayPalRestPaymentDriver.php | 3 ++- config/ninja.php | 4 ++-- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index b96e85006119..68803f5e543f 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.8.52 \ No newline at end of file +5.8.53 \ No newline at end of file diff --git a/app/Livewire/BillingPortal/Authentication/ClientRegisterService.php b/app/Livewire/BillingPortal/Authentication/ClientRegisterService.php index 35cea03d6941..1e6a60a6b672 100644 --- a/app/Livewire/BillingPortal/Authentication/ClientRegisterService.php +++ b/app/Livewire/BillingPortal/Authentication/ClientRegisterService.php @@ -43,7 +43,7 @@ class ClientRegisterService foreach ($rules as $field => $properties) { if ($field === 'email') { - $rules[$field] = array_merge($rules[$field], ['email:rfc,dns', 'max:191', Rule::unique('client_contacts')->where('company_id', $this->company->id)]); + $rules[$field] = array_merge($rules[$field], ['email:rfc', 'max:191', Rule::unique('client_contacts')->where('company_id', $this->company->id)]); } if ($field === 'current_password' || $field === 'password') { diff --git a/app/Livewire/BillingPortal/Authentication/Register.php b/app/Livewire/BillingPortal/Authentication/Register.php index 43c5631b5f47..0bed4bdfda99 100644 --- a/app/Livewire/BillingPortal/Authentication/Register.php +++ b/app/Livewire/BillingPortal/Authentication/Register.php @@ -59,6 +59,8 @@ class Register extends Component public function register(array $data) { + nlog($data); + $service = new ClientRegisterService( company: $this->subscription->company, additional: $this->additional_fields, @@ -66,8 +68,13 @@ class Register extends Component $rules = $service->rules(); + nlog($rules); + $data = Validator::make($data, $rules)->validate(); + nlog("validated data"); + nlog($data); + $client = $service->createClient($data); $contact = $service->createClientContact($data, $client); diff --git a/app/PaymentDrivers/PayPalRestPaymentDriver.php b/app/PaymentDrivers/PayPalRestPaymentDriver.php index e22706024668..5745ab86d725 100644 --- a/app/PaymentDrivers/PayPalRestPaymentDriver.php +++ b/app/PaymentDrivers/PayPalRestPaymentDriver.php @@ -244,7 +244,8 @@ return render('gateways.paypal.pay', $data); nlog("post order creation"); nlog($orderId); - $r = $this->gatewayRequest("/v2/checkout/orders/{$orderId}", 'get', ['body' => '']); + + $r = $this->gatewayRequest("/v2/checkout/orders/{$orderId}", 'get', ['body' => '']); nlog($r); $response = $r->json(); diff --git a/config/ninja.php b/config/ninja.php index fc12f803c3df..1cc85778fe09 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -17,8 +17,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION', '5.8.52'), - 'app_tag' => env('APP_TAG', '5.8.52'), + 'app_version' => env('APP_VERSION', '5.8.53'), + 'app_tag' => env('APP_TAG', '5.8.53'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false),