mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 21:34:37 -04:00
detach payment method from authorize gateway
This commit is contained in:
parent
64dfe1d6c3
commit
af523a6346
@ -151,7 +151,8 @@ class PaymentMethodController extends Controller
|
|||||||
event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars()));
|
event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars()));
|
||||||
$payment_method->delete();
|
$payment_method->delete();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error(json_encode($e));
|
|
||||||
|
nlog($e->getMessage());
|
||||||
|
|
||||||
return back();
|
return back();
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ class AuthorizeCreateCustomer
|
|||||||
$request = new GetCustomerProfileRequest();
|
$request = new GetCustomerProfileRequest();
|
||||||
$request->setMerchantAuthentication($this->authorize->merchant_authentication);
|
$request->setMerchantAuthentication($this->authorize->merchant_authentication);
|
||||||
$request->setCustomerProfileId($profileIdRequested);
|
$request->setCustomerProfileId($profileIdRequested);
|
||||||
|
|
||||||
$controller = new GetCustomerProfileController($request);
|
$controller = new GetCustomerProfileController($request);
|
||||||
$response = $controller->executeWithApiResponse($this->authorize->merchant_authentication);
|
$response = $controller->executeWithApiResponse($this->authorize->merchant_authentication);
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ class AuthorizeCreateCustomer
|
|||||||
echo "List of subscriptions:";
|
echo "List of subscriptions:";
|
||||||
foreach($response->getSubscriptionIds() as $subscriptionid)
|
foreach($response->getSubscriptionIds() as $subscriptionid)
|
||||||
echo $subscriptionid . "\n";
|
echo $subscriptionid . "\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,12 @@ use App\PaymentDrivers\AuthorizePaymentDriver;
|
|||||||
use net\authorize\api\contract\v1\CreateCustomerPaymentProfileRequest;
|
use net\authorize\api\contract\v1\CreateCustomerPaymentProfileRequest;
|
||||||
use net\authorize\api\contract\v1\CustomerAddressType;
|
use net\authorize\api\contract\v1\CustomerAddressType;
|
||||||
use net\authorize\api\contract\v1\CustomerPaymentProfileType;
|
use net\authorize\api\contract\v1\CustomerPaymentProfileType;
|
||||||
|
use net\authorize\api\contract\v1\DeleteCustomerPaymentProfileRequest;
|
||||||
use net\authorize\api\contract\v1\GetCustomerPaymentProfileRequest;
|
use net\authorize\api\contract\v1\GetCustomerPaymentProfileRequest;
|
||||||
use net\authorize\api\contract\v1\OpaqueDataType;
|
use net\authorize\api\contract\v1\OpaqueDataType;
|
||||||
use net\authorize\api\contract\v1\PaymentType;
|
use net\authorize\api\contract\v1\PaymentType;
|
||||||
use net\authorize\api\controller\CreateCustomerPaymentProfileController;
|
use net\authorize\api\controller\CreateCustomerPaymentProfileController;
|
||||||
|
use net\authorize\api\controller\DeleteCustomerPaymentProfileController;
|
||||||
use net\authorize\api\controller\GetCustomerPaymentProfileController;
|
use net\authorize\api\controller\GetCustomerPaymentProfileController;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
@ -246,4 +248,37 @@ class AuthorizePaymentMethod
|
|||||||
throw new GenericPaymentDriverFailure('Error communicating with Authorize.net');
|
throw new GenericPaymentDriverFailure('Error communicating with Authorize.net');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deletePaymentProfile($gateway_customer_reference, $payment_profile_id) {
|
||||||
|
|
||||||
|
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||||
|
|
||||||
|
$this->authorize->init();
|
||||||
|
|
||||||
|
// Set the transaction's refId
|
||||||
|
$refId = 'ref' . time();
|
||||||
|
|
||||||
|
// Use an existing payment profile ID for this Merchant name and Transaction key
|
||||||
|
|
||||||
|
$request = new DeleteCustomerPaymentProfileRequest();
|
||||||
|
$request->setMerchantAuthentication($this->authorize->merchant_authentication);
|
||||||
|
$request->setCustomerProfileId($gateway_customer_reference);
|
||||||
|
$request->setCustomerPaymentProfileId($payment_profile_id);
|
||||||
|
$controller = new DeleteCustomerPaymentProfileController($request);
|
||||||
|
|
||||||
|
$response = $controller->executeWithApiResponse($this->authorize->mode());
|
||||||
|
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
|
||||||
|
{
|
||||||
|
nlog("SUCCESS: Delete Customer Payment Profile SUCCESS :");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlog("ERROR : Delete Customer Payment Profile: Invalid response\n");
|
||||||
|
$errorMessages = $response->getMessages()->getMessage();
|
||||||
|
nlog("Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -156,6 +156,6 @@ class AuthorizePaymentDriver extends BaseDriver
|
|||||||
*/
|
*/
|
||||||
public function detach(ClientGatewayToken $token)
|
public function detach(ClientGatewayToken $token)
|
||||||
{
|
{
|
||||||
// Authorize.net doesn't support this feature.
|
return (new AuthorizePaymentMethod($this))->deletePaymentProfile($token->gateway_customer_reference, $token->token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user