mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
d967329bc5
@ -1 +1 @@
|
|||||||
5.10.11
|
5.10.12
|
@ -530,6 +530,11 @@ class PayPalBasePaymentDriver extends BaseDriver
|
|||||||
public function createNinjaPayment($request, $response)
|
public function createNinjaPayment($request, $response)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(isset($response['purchase_units'][0]['payments']['captures'][0]['status']) && in_array($response['purchase_units'][0]['payments']['captures'][0]['status'], ['COMPLETED', 'PENDING']))
|
||||||
|
{
|
||||||
|
|
||||||
|
$payment_status = $response['purchase_units'][0]['payments']['captures'][0]['status'] == 'COMPLETED' ? \App\Models\Payment::STATUS_COMPLETED : \App\Models\Payment::STATUS_PENDING;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'payment_type' => $this->getPaymentMethod($request->gateway_type_id),
|
'payment_type' => $this->getPaymentMethod($request->gateway_type_id),
|
||||||
'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
|
'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
|
||||||
@ -537,7 +542,7 @@ class PayPalBasePaymentDriver extends BaseDriver
|
|||||||
'gateway_type_id' => GatewayType::PAYPAL,
|
'gateway_type_id' => GatewayType::PAYPAL,
|
||||||
];
|
];
|
||||||
|
|
||||||
$payment = $this->createPayment($data, \App\Models\Payment::STATUS_COMPLETED);
|
$payment = $this->createPayment($data, $payment_status);
|
||||||
|
|
||||||
if ($request->has('store_card') && $request->input('store_card') === true) {
|
if ($request->has('store_card') && $request->input('store_card') === true) {
|
||||||
$payment_source = $response->json()['payment_source'] ?? false;
|
$payment_source = $response->json()['payment_source'] ?? false;
|
||||||
@ -580,6 +585,13 @@ class PayPalBasePaymentDriver extends BaseDriver
|
|||||||
);
|
);
|
||||||
|
|
||||||
return response()->json(['redirect' => route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)], false)]);
|
return response()->json(['redirect' => route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)], false)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company);
|
||||||
|
|
||||||
|
$error = isset($response['purchase_units'][0]['payments']['captures'][0]['status_details'][0]) ? $response['purchase_units'][0]['payments']['captures'][0]['status_details'][0] : $response['purchase_units'][0]['payments']['captures'][0]['status'];
|
||||||
|
|
||||||
|
return response()->json(['message' => $error], 400);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,8 +288,6 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
|
|
||||||
$orderId = $this->createOrder($data);
|
$orderId = $this->createOrder($data);
|
||||||
|
|
||||||
// $r = $this->gatewayRequest("/v2/checkout/orders/{$orderId}", 'get', ['body' => '']);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$r = $this->gatewayRequest("/v2/checkout/orders/{$orderId}", 'get', ['body' => '']);
|
$r = $this->gatewayRequest("/v2/checkout/orders/{$orderId}", 'get', ['body' => '']);
|
||||||
@ -318,6 +316,8 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
|
|
||||||
$response = $r->json();
|
$response = $r->json();
|
||||||
|
|
||||||
|
if(isset($response['purchase_units'][0]['payments']['captures'][0]['status']) && $response['purchase_units'][0]['payments']['captures'][0]['status'] == 'COMPLETED')
|
||||||
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'payment_type' => $this->getPaymentMethod($request->gateway_type_id),
|
'payment_type' => $this->getPaymentMethod($request->gateway_type_id),
|
||||||
'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
|
'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
|
||||||
@ -340,6 +340,12 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
|
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -387,6 +393,9 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
|
|
||||||
$response = $r->json();
|
$response = $r->json();
|
||||||
|
|
||||||
|
if(isset($response['purchase_units'][0]['payments']['captures'][0]['status']) && $response['purchase_units'][0]['payments']['captures'][0]['status'] == 'COMPLETED')
|
||||||
|
{
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'payment_type' => $this->getPaymentMethod((string)$cgt->gateway_type_id),
|
'payment_type' => $this->getPaymentMethod((string)$cgt->gateway_type_id),
|
||||||
'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
|
'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
|
||||||
@ -404,7 +413,11 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
$this->client,
|
$this->client,
|
||||||
$this->client->company,
|
$this->client->company,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->processInternallyFailedPayment($this, new \Exception('Auto billing failed.', 400));
|
||||||
|
|
||||||
|
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
use App\Utils\Ninja;
|
||||||
use App\Models\Design;
|
use App\Models\Design;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@ -54,4 +55,20 @@ class DesignRepository extends BaseRepository
|
|||||||
|
|
||||||
return $design;
|
return $design;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $entity
|
||||||
|
*/
|
||||||
|
public function restore($design)
|
||||||
|
{
|
||||||
|
|
||||||
|
$design->name = str_ireplace("_deleted_", "_restored_", $design->name);
|
||||||
|
|
||||||
|
parent::restore($design);
|
||||||
|
|
||||||
|
return $design;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => env('APP_VERSION', '5.10.11'),
|
'app_version' => env('APP_VERSION', '5.10.12'),
|
||||||
'app_tag' => env('APP_TAG', '5.10.11'),
|
'app_tag' => env('APP_TAG', '5.10.12'),
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', false),
|
'api_secret' => env('API_SECRET', false),
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
@endphp
|
@endphp
|
||||||
@section('gateway_head')
|
@section('gateway_head')
|
||||||
<meta http-equiv="Content-Security-Policy" content="
|
<!-- <meta http-equiv="Content-Security-Policy" content="
|
||||||
img-src 'self' https://c.paypal.com https://b.stats.paypal.com;
|
img-src 'self' https://c.paypal.com https://b.stats.paypal.com;
|
||||||
frame-src 'self' https://c.paypal.com;
|
frame-src 'self' https://c.paypal.com;
|
||||||
script-src 'self' https://c.paypal.com;">
|
script-src 'self' https://c.paypal.com;"> -->
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('gateway_content')
|
@section('gateway_content')
|
||||||
@ -86,7 +86,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript" src="https://c.paypal.com/da/r/fb.js"></script>
|
<!-- <script type="text/javascript" src="https://c.paypal.com/da/r/fb.js"></script> -->
|
||||||
|
|
||||||
@if(isset($merchantId))
|
@if(isset($merchantId))
|
||||||
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&merchant-id={!! $merchantId !!}&components=card-fields" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&merchant-id={!! $merchantId !!}&components=card-fields" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
||||||
@ -138,10 +138,15 @@
|
|||||||
body: formData,
|
body: formData,
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Network response was not ok ' + response.statusText);
|
return response.json().then(errorData => {
|
||||||
|
throw new Error(errorData.message);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.json();
|
return response.json();
|
||||||
|
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
||||||
@ -164,7 +169,6 @@
|
|||||||
|
|
||||||
document.getElementById('errors').textContent = `Sorry, your transaction could not be processed...\n\n${error.message}`;
|
document.getElementById('errors').textContent = `Sorry, your transaction could not be processed...\n\n${error.message}`;
|
||||||
document.getElementById('errors').hidden = false;
|
document.getElementById('errors').hidden = false;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -172,20 +176,6 @@
|
|||||||
|
|
||||||
window.location.href = "/client/invoices/";
|
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 (){
|
onClick: function (){
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -195,8 +185,8 @@
|
|||||||
// Render each field after checking for eligibility
|
// Render each field after checking for eligibility
|
||||||
if (cardField.isEligible()) {
|
if (cardField.isEligible()) {
|
||||||
|
|
||||||
// const nameField = cardField.NameField();
|
const nameField = cardField.NameField();
|
||||||
// nameField.render("#card-name-field-container");
|
nameField.render("#card-name-field-container");
|
||||||
|
|
||||||
const numberField = cardField.NumberField({
|
const numberField = cardField.NumberField({
|
||||||
inputEvents: {
|
inputEvents: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user