forked from webdna/commerce-braintree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Samuel Birch
committed
Dec 18, 2019
1 parent
7522204
commit d307928
Showing
2 changed files
with
115 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Affiliate plugin for Craft CMS 3.x | ||
* | ||
* Plugin to add affiliates to Craft Commerce | ||
* | ||
* @link https://kurious.agency | ||
* @copyright Copyright (c) 2019 Kurious Agency | ||
*/ | ||
|
||
namespace kuriousagency\commerce\braintree\controllers; | ||
|
||
use Craft; | ||
use craft\web\Controller; | ||
use kuriousagency\commerce\braintree\gateways\Gateway; | ||
|
||
use craft\commerce\Plugin as Commerce; | ||
|
||
/** | ||
* @author Kurious Agency | ||
* @package Affiliate | ||
* @since 1.0.0 | ||
*/ | ||
class PaymentMethodsController extends Controller | ||
{ | ||
|
||
public function actionDelete() | ||
{ | ||
|
||
$request = Craft::$app->getRequest(); | ||
|
||
$handle = $request->getBodyParam('gateway'); | ||
$token = $request->getBodyParam('token'); | ||
|
||
$gateway = Commerce::getInstance()->getGateways()->getGatewayByHandle($handle); | ||
|
||
$gateway->deletePaymentMethod($token); | ||
|
||
return $this->redirectToPostedUrl(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters