diff --git a/app/PaymentDrivers/WePay/ACH.php b/app/PaymentDrivers/WePay/ACH.php index d7489cac9d..a6580b22c8 100644 --- a/app/PaymentDrivers/WePay/ACH.php +++ b/app/PaymentDrivers/WePay/ACH.php @@ -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, diff --git a/app/PaymentDrivers/WePay/CreditCard.php b/app/PaymentDrivers/WePay/CreditCard.php index 7f723ca452..3bdd17876d 100644 --- a/app/PaymentDrivers/WePay/CreditCard.php +++ b/app/PaymentDrivers/WePay/CreditCard.php @@ -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, diff --git a/app/PaymentDrivers/WePayPaymentDriver.php b/app/PaymentDrivers/WePayPaymentDriver.php index d5f976bef2..8b4a2948eb 100644 --- a/app/PaymentDrivers/WePayPaymentDriver.php +++ b/app/PaymentDrivers/WePayPaymentDriver.php @@ -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 {