mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Hide test mode from paypal PPCP
This commit is contained in:
parent
c0904b0021
commit
0f92b6c82e
@ -454,7 +454,7 @@ class CompanyExport implements ShouldQueue
|
|||||||
nlog("could not create directory");
|
nlog("could not create directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
$zip_path = storage_path('backups/'.$file_name);
|
$zip_path = storage_path('backups/'.\Illuminate\Support\Str::ascii($file_name));
|
||||||
$zip = new \ZipArchive();
|
$zip = new \ZipArchive();
|
||||||
|
|
||||||
if ($zip->open($zip_path, \ZipArchive::CREATE)!==true) {
|
if ($zip->open($zip_path, \ZipArchive::CREATE)!==true) {
|
||||||
@ -484,12 +484,12 @@ class CompanyExport implements ShouldQueue
|
|||||||
$t = app('translator');
|
$t = app('translator');
|
||||||
$t->replace(Ninja::transformTranslations($this->company->settings));
|
$t->replace(Ninja::transformTranslations($this->company->settings));
|
||||||
|
|
||||||
$company_reference = Company::find($this->company->id);
|
// $company_reference = Company::find($this->company->id);
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new DownloadBackup($url, $company_reference);
|
$nmo->mailable = new DownloadBackup($url, $this->company->withoutRelations());
|
||||||
$nmo->to_user = $this->user;
|
$nmo->to_user = $this->user;
|
||||||
$nmo->company = $company_reference;
|
$nmo->company = $this->company->withoutRelations();
|
||||||
$nmo->settings = $this->company->settings;
|
$nmo->settings = $this->company->settings;
|
||||||
|
|
||||||
(new NinjaMailerJob($nmo, true))->handle();
|
(new NinjaMailerJob($nmo, true))->handle();
|
||||||
|
@ -139,7 +139,8 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
|||||||
public function init(): self
|
public function init(): self
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->api_endpoint_url = $this->company_gateway->getConfigField('testMode') ? 'https://api-m.sandbox.paypal.com' : 'https://api-m.paypal.com';
|
// $this->api_endpoint_url = $this->company_gateway->getConfigField('testMode') ? 'https://api-m.sandbox.paypal.com' : 'https://api-m.paypal.com';
|
||||||
|
$this->api_endpoint_url = 'https://api-m.paypal.com';
|
||||||
|
|
||||||
$secret = config('ninja.paypal.secret');
|
$secret = config('ninja.paypal.secret');
|
||||||
$client_id = config('ninja.paypal.client_id');
|
$client_id = config('ninja.paypal.client_id');
|
||||||
@ -230,7 +231,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
|||||||
$data['funding_source'] = $this->paypal_payment_method;
|
$data['funding_source'] = $this->paypal_payment_method;
|
||||||
$data['gateway_type_id'] = $this->gateway_type_id;
|
$data['gateway_type_id'] = $this->gateway_type_id;
|
||||||
$data['merchantId'] = $this->company_gateway->getConfigField('merchantId');
|
$data['merchantId'] = $this->company_gateway->getConfigField('merchantId');
|
||||||
|
$data['currency'] = $this->client->currency()->code;
|
||||||
// nlog($data['merchantId']);
|
// nlog($data['merchantId']);
|
||||||
|
|
||||||
return render('gateways.paypal.ppcp.pay', $data);
|
return render('gateways.paypal.ppcp.pay', $data);
|
||||||
|
@ -30,26 +30,29 @@
|
|||||||
|
|
||||||
@push('footer')
|
@push('footer')
|
||||||
|
|
||||||
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&merchant-id={!! $merchantId !!}&components=buttons,funding-eligibility&intent=capture" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}¤cy={!! $currency !!}&merchant-id={!! $merchantId !!}&components=buttons,funding-eligibility&intent=capture" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
||||||
<div id="paypal-button-container"></div>
|
<div id="paypal-button-container"></div>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
//&buyer-country=US¤cy=USD&enable-funding=venmo
|
//&buyer-country=US¤cy=USD&enable-funding=venmo
|
||||||
const fundingSource = "{!! $funding_source !!}";
|
const fundingSource = "{!! $funding_source !!}";
|
||||||
const testMode = {{ $gateway->company_gateway->getConfigField('testMode') }};
|
|
||||||
const clientId = "{{ $client_id }}";
|
const clientId = "{{ $client_id }}";
|
||||||
const sandbox = { sandbox: clientId };
|
|
||||||
const production = { production: clientId };
|
|
||||||
const orderId = "{!! $order_id !!}";
|
const orderId = "{!! $order_id !!}";
|
||||||
|
|
||||||
paypal.Buttons({
|
paypal.Buttons({
|
||||||
env: testMode ? 'sandbox' : 'production',
|
env: 'production',
|
||||||
fundingSource: fundingSource,
|
fundingSource: fundingSource,
|
||||||
client: testMode ? sandbox : production,
|
client: clientId,
|
||||||
createOrder: function(data, actions) {
|
createOrder: function(data, actions) {
|
||||||
return orderId;
|
return orderId;
|
||||||
},
|
},
|
||||||
onApprove: function(data, actions) {
|
onApprove: function(data, actions) {
|
||||||
|
|
||||||
|
var errorDetail = Array.isArray(data.details) && data.details[0];
|
||||||
|
if (errorDetail && ['INSTRUMENT_DECLINED', 'PAYER_ACTION_REQUIRED'].includes(errorDetail.issue)) {
|
||||||
|
return actions.restart();
|
||||||
|
}
|
||||||
|
|
||||||
return actions.order.capture().then(function(details) {
|
return actions.order.capture().then(function(details) {
|
||||||
document.getElementById("gateway_response").value =JSON.stringify( details );
|
document.getElementById("gateway_response").value =JSON.stringify( details );
|
||||||
document.getElementById("server_response").submit();
|
document.getElementById("server_response").submit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user