mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Throw is payments are not yet receivable
This commit is contained in:
parent
e7ffc00306
commit
08b4d320cd
@ -153,7 +153,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
|||||||
->withQueryParameters(['grant_type' => 'client_credentials'])
|
->withQueryParameters(['grant_type' => 'client_credentials'])
|
||||||
->post("{$this->api_endpoint_url}/v1/oauth2/token");
|
->post("{$this->api_endpoint_url}/v1/oauth2/token");
|
||||||
|
|
||||||
nlog($response->body());
|
// nlog($response->body());
|
||||||
|
|
||||||
if($response->successful()) {
|
if($response->successful()) {
|
||||||
$this->access_token = $response->json()['access_token'];
|
$this->access_token = $response->json()['access_token'];
|
||||||
@ -193,9 +193,19 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function checkPaymentsReceivable(): self
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!$this->company_gateway->getConfigField('payments_receivable'))
|
||||||
|
throw new PaymentFailed('Unable to accept payments at this time, please contact PayPal for more information.', 401);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function processPaymentView($data)
|
public function processPaymentView($data)
|
||||||
{
|
{
|
||||||
$this->init();
|
$this->init()->checkPaymentsReceivable();
|
||||||
|
|
||||||
$data['gateway'] = $this;
|
$data['gateway'] = $this;
|
||||||
$this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['total']['amount_with_fee']]);
|
$this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['total']['amount_with_fee']]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user