mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01: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");
|
||||
}
|
||||
|
||||
$zip_path = storage_path('backups/'.$file_name);
|
||||
$zip_path = storage_path('backups/'.\Illuminate\Support\Str::ascii($file_name));
|
||||
$zip = new \ZipArchive();
|
||||
|
||||
if ($zip->open($zip_path, \ZipArchive::CREATE)!==true) {
|
||||
@ -484,12 +484,12 @@ class CompanyExport implements ShouldQueue
|
||||
$t = app('translator');
|
||||
$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->mailable = new DownloadBackup($url, $company_reference);
|
||||
$nmo->mailable = new DownloadBackup($url, $this->company->withoutRelations());
|
||||
$nmo->to_user = $this->user;
|
||||
$nmo->company = $company_reference;
|
||||
$nmo->company = $this->company->withoutRelations();
|
||||
$nmo->settings = $this->company->settings;
|
||||
|
||||
(new NinjaMailerJob($nmo, true))->handle();
|
||||
|
@ -139,7 +139,8 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
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');
|
||||
$client_id = config('ninja.paypal.client_id');
|
||||
@ -230,7 +231,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
$data['funding_source'] = $this->paypal_payment_method;
|
||||
$data['gateway_type_id'] = $this->gateway_type_id;
|
||||
$data['merchantId'] = $this->company_gateway->getConfigField('merchantId');
|
||||
|
||||
$data['currency'] = $this->client->currency()->code;
|
||||
// nlog($data['merchantId']);
|
||||
|
||||
return render('gateways.paypal.ppcp.pay', $data);
|
||||
|
@ -30,26 +30,29 @@
|
||||
|
||||
@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>
|
||||
<script>
|
||||
|
||||
//&buyer-country=US¤cy=USD&enable-funding=venmo
|
||||
const fundingSource = "{!! $funding_source !!}";
|
||||
const testMode = {{ $gateway->company_gateway->getConfigField('testMode') }};
|
||||
const clientId = "{{ $client_id }}";
|
||||
const sandbox = { sandbox: clientId };
|
||||
const production = { production: clientId };
|
||||
const orderId = "{!! $order_id !!}";
|
||||
|
||||
paypal.Buttons({
|
||||
env: testMode ? 'sandbox' : 'production',
|
||||
env: 'production',
|
||||
fundingSource: fundingSource,
|
||||
client: testMode ? sandbox : production,
|
||||
client: clientId,
|
||||
createOrder: function(data, actions) {
|
||||
return orderId;
|
||||
},
|
||||
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) {
|
||||
document.getElementById("gateway_response").value =JSON.stringify( details );
|
||||
document.getElementById("server_response").submit();
|
||||
|
Loading…
Reference in New Issue
Block a user