mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Delete credit cards from wepay
This commit is contained in:
parent
4eda6b1190
commit
f2da4d7985
@ -198,6 +198,7 @@ class ACH
|
||||
return redirect()->route('client.payment_methods.verification', ['payment_method' => $token->hashed_id, 'method' => GatewayType::BANK_TRANSFER]);
|
||||
|
||||
$response = $this->wepay_payment_driver->wepay->request('checkout/create', array(
|
||||
'callback_uri' => route('payment_webhook', ['company_key' => $this->wepay_payment_driver->company_gateway->company->company_key, 'company_gateway_id' => $this->wepay_payment_driver->company_gateway->hashed_id]),
|
||||
'unique_id' => Str::random(40),
|
||||
'account_id' => $this->wepay_payment_driver->company_gateway->getConfigField('accountId'),
|
||||
'amount' => $this->wepay_payment_driver->payment_hash->data->amount_with_fee,
|
||||
|
@ -117,6 +117,7 @@ use WePayCommon;
|
||||
nlog("authorize the card first!");
|
||||
|
||||
$response = $this->wepay_payment_driver->wepay->request('credit_card/authorize', array(
|
||||
'callback_uri' => route('payment_webhook', ['company_key' => $this->wepay_payment_driver->company_gateway->company->company_key, 'company_gateway_id' => $this->wepay_payment_driver->company_gateway->hashed_id]),
|
||||
'client_id' => config('ninja.wepay.client_id'),
|
||||
'client_secret' => config('ninja.wepay.client_secret'),
|
||||
'credit_card_id' => (int)$request->input('credit_card_id'),
|
||||
@ -141,6 +142,7 @@ use WePayCommon;
|
||||
nlog($request->all());
|
||||
// charge the credit card
|
||||
$response = $this->wepay_payment_driver->wepay->request('checkout/create', array(
|
||||
'callback_uri' => route('payment_webhook', ['company_key' => $this->wepay_payment_driver->company_gateway->company->company_key, 'company_gateway_id' => $this->wepay_payment_driver->company_gateway->hashed_id]),
|
||||
'unique_id' => Str::random(40),
|
||||
'account_id' => $this->wepay_payment_driver->company_gateway->getConfigField('accountId'),
|
||||
'amount' => $this->wepay_payment_driver->payment_hash->data->amount_with_fee,
|
||||
|
@ -265,6 +265,27 @@ class WePayPaymentDriver extends BaseDriver
|
||||
}
|
||||
|
||||
|
||||
public function detach(ClientGatewayToken $token)
|
||||
{
|
||||
/*Bank accounts cannot be deleted - only CC*/
|
||||
if($token->gateway_type_id == 2)
|
||||
return true;
|
||||
|
||||
$this->init();
|
||||
|
||||
$response = $this->wepay->request('/credit_card/delete', [
|
||||
'client_id' => config('ninja.wepay.client_id'),
|
||||
'client_secret' => config('ninja.wepay.client_secret'),
|
||||
'credit_card_id' => intval($token->token),
|
||||
]);
|
||||
|
||||
if ($response->state == 'deleted') {
|
||||
return true;
|
||||
} else {
|
||||
throw new \Exception(trans('texts.failed_remove_payment_method'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getClientRequiredFields(): array
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user