remove paypal user-id

This commit is contained in:
David Bomba 2024-06-14 17:07:52 +10:00
parent 3350685ade
commit 9c288cd452
7 changed files with 34 additions and 132 deletions

View File

@ -180,10 +180,11 @@ class PayPalBasePaymentDriver extends BaseDriver
}
//@todo turn this back on when PayPal.....
public function getClientHash()
{
nlog($this->client->present()->name());
return '';
/** @var \App\Models\ClientGatewayToken $cgt */
$cgt = ClientGatewayToken::where('company_gateway_id', $this->company_gateway->id)
->where('client_id', $this->client->id)

View File

@ -117,7 +117,7 @@
"larastan/larastan": "^2",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpstan/phpstan": "^1.9",
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^10",
"spatie/laravel-ignition": "^2.0",
"spaze/phpstan-stripe": "^3.0"

32
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a52dad71889f0bfe78dca5f02e7373c5",
"content-hash": "3a4f9e64fb5fae2cd0f6735badfd3224",
"packages": [
{
"name": "adrienrn/php-mimetyper",
@ -1385,16 +1385,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.314.0",
"version": "3.314.1",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "5867f04e0e3959085328d853a743ffc5c8e8ae0b"
"reference": "85207a1f342443f40711ac8fe246120821370f11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5867f04e0e3959085328d853a743ffc5c8e8ae0b",
"reference": "5867f04e0e3959085328d853a743ffc5c8e8ae0b",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/85207a1f342443f40711ac8fe246120821370f11",
"reference": "85207a1f342443f40711ac8fe246120821370f11",
"shasum": ""
},
"require": {
@ -1474,9 +1474,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.314.0"
"source": "https://github.com/aws/aws-sdk-php/tree/3.314.1"
},
"time": "2024-06-12T18:10:03+00:00"
"time": "2024-06-13T18:07:00+00:00"
},
{
"name": "bacon/bacon-qr-code",
@ -18810,28 +18810,28 @@
},
{
"name": "react/dns",
"version": "v1.12.0",
"version": "v1.13.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/dns.git",
"reference": "c134600642fa615b46b41237ef243daa65bb64ec"
"reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/dns/zipball/c134600642fa615b46b41237ef243daa65bb64ec",
"reference": "c134600642fa615b46b41237ef243daa65bb64ec",
"url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5",
"reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"react/cache": "^1.0 || ^0.6 || ^0.5",
"react/event-loop": "^1.2",
"react/promise": "^3.0 || ^2.7 || ^1.2.1"
"react/promise": "^3.2 || ^2.7 || ^1.2.1"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
"react/async": "^4 || ^3 || ^2",
"react/promise-timer": "^1.9"
"react/async": "^4.3 || ^3 || ^2",
"react/promise-timer": "^1.11"
},
"type": "library",
"autoload": {
@ -18874,7 +18874,7 @@
],
"support": {
"issues": "https://github.com/reactphp/dns/issues",
"source": "https://github.com/reactphp/dns/tree/v1.12.0"
"source": "https://github.com/reactphp/dns/tree/v1.13.0"
},
"funding": [
{
@ -18882,7 +18882,7 @@
"type": "open_collective"
}
],
"time": "2023-11-29T12:41:06+00:00"
"time": "2024-06-13T14:18:03+00:00"
},
{
"name": "react/event-loop",

View File

@ -7,15 +7,16 @@ parameters:
paths:
- app
excludePaths:
- 'vendor/*'
- 'resources/*/*.php'
- 'app/Jobs/Ninja/*'
- 'app/Models/Presenters/*'
- 'app/Console/Commands/*'
- 'app/DataMapper/Analytics/*'
- 'app/PaymentDrivers/Authorize/*'
- 'app/PaymentDrivers/AuthorizePaymentDriver.php'
- 'app/Utils/Traits/*'
analyseAndScan:
- 'vendor'
- 'resources'
- 'app/Jobs/Ninja/*'
- 'app/Models/Presenters/*'
- 'app/Console/Commands/*'
- 'app/DataMapper/Analytics/*'
- 'app/PaymentDrivers/Authorize/*'
- 'app/PaymentDrivers/AuthorizePaymentDriver.php'
- 'app/Utils/Traits/*'
universalObjectCratesClasses:
- App\DataMapper\Tax\RuleInterface
- App\DataMapper\FeesAndLimits

View File

@ -77,7 +77,6 @@ inset: 6px;
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&currency={!! $currency !!}&components=buttons,funding-eligibility&intent=capture&enable-funding={!! $funding_source !!}" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
<script>
//&buyer-country=US&currency=USD&enable-funding=venmo
const fundingSource = "{!! $funding_source !!}";
const clientId = "{{ $client_id }}";

View File

@ -85,115 +85,15 @@
<script type="text/javascript" src="https://c.paypal.com/da/r/fb.js"></script>
@if(isset($merchantId))
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&merchantId={!! $merchantId !!}&components=card-fields,buttons" data-user-id-token="{!! $pp_client_reference !!}" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&merchantId={!! $merchantId !!}&components=card-fields" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
@else
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&components=card-fields,buttons" data-user-id-token="{!! $pp_client_reference !!}" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&components=card-fields" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
@endif
<script>
const clientId = "{{ $client_id }}";
const orderId = "{!! $order_id !!}";
const buttons = paypal.Buttons({
client: clientId,
createOrder: function(data, actions) {
return orderId;
},
onApprove: function(data, actions) {
const { liabilityShift, orderID } = data;
if(liabilityShift) {
/* Handle liability shift. More information in 3D Secure response parameters */
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;
}
}
let storeCard = document.querySelector('input[name=token-billing-checkbox]:checked');
if (storeCard) {
document.getElementById("store_card").value = storeCard.value;
}
document.getElementById("gateway_response").value =JSON.stringify( data );
formData = JSON.stringify(Object.fromEntries(new FormData(document.getElementById("server_response")))),
fetch('{{ route('client.payments.response') }}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
"X-Requested-With": "XMLHttpRequest",
"X-CSRF-Token": document.querySelector('meta[name="csrf-token"]').content
},
body: formData,
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}
return response.json();
})
.then(data => {
var errorDetail = Array.isArray(data.details) && data.details[0];
if (errorDetail && ['INSTRUMENT_DECLINED', 'PAYER_ACTION_REQUIRED'].includes(errorDetail.issue)) {
return actions.restart();
}
if(data.redirect){
window.location.href = data.redirect;
return;
}
document.getElementById("gateway_response").value =JSON.stringify( data );
document.getElementById("server_response").submit();
})
.catch(error => {
console.error('Error:', error);
document.getElementById('errors').textContent = `Sorry, your transaction could not be processed...\n\n${error.message}`;
document.getElementById('errors').hidden = false;
});
},
onCancel: function() {
window.location.href = "/client/invoices/";
},
// onError: function(error) {
// console.log("submit catch");
// const errorM = parseError(error);
// console.log(errorM);
// const msg = handle422Error(errorM);
// document.getElementById('errors').textContent = `Sorry, your transaction could not be processed...\n\n${msg.description}`;
// document.getElementById('errors').hidden = false;
// },
onClick: function (){
}
});
@if(strlen($pp_client_reference) > 1)
buttons.render('#paypal-button-container');
@endif
const cardField = paypal.CardFields({
client: clientId,
createOrder: function(data, actions) {
@ -209,7 +109,6 @@
document.getElementById('errors').textContent = `Sorry, your transaction could not be processed, Please try a different payment method.`;
document.getElementById('errors').hidden = false;
return;
}

View File

@ -28,6 +28,8 @@ class WebhookAPITest extends TestCase
use DatabaseTransactions;
use MockAccountData;
protected $faker;
protected function setUp() :void
{
parent::setUp();