-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CIVIEWAY-261 WIP - Add Action Provider action to EWAY to fill credit …
…card meta data
- Loading branch information
1 parent
9372117
commit 4052f66
Showing
4 changed files
with
144 additions
and
0 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
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,70 @@ | ||
<?php | ||
|
||
namespace Civi\Ewayactions\Actions; | ||
|
||
use Civi\ActionProvider\Parameter\ParameterBagInterface; | ||
use Civi\ActionProvider\Parameter\SpecificationBag; | ||
use Civi\ActionProvider\Action\AbstractAction; | ||
use Civi\ActionProvider\Parameter\Specification; | ||
use CRM_eWAYRecurring_ExtensionUtil as E; | ||
use CRM_eWAYRecurring_PaymentToken; | ||
|
||
class FillPaymentTokenMeta extends AbstractAction { | ||
|
||
/** | ||
* Run the action | ||
* | ||
* @param ParameterBagInterface $parameters | ||
* The parameters to this action. | ||
* @param ParameterBagInterface $output | ||
* The parameters this action can send back | ||
* | ||
* @return void | ||
*/ | ||
protected function doAction(ParameterBagInterface $parameters, ParameterBagInterface $output) { | ||
try { | ||
$payment_processor_id = $this->configuration->getParameter('payment_processor_id'); | ||
$payment_token_id = $parameters->getParameter('payment_token_id'); | ||
|
||
CRM_eWAYRecurring_PaymentToken::fillTokenMetaSingle($payment_processor_id,$payment_token_id); | ||
return TRUE; | ||
} | ||
catch (\Exception $e) { | ||
return FALSE; | ||
} | ||
} | ||
|
||
/** | ||
* Returns the specification of the configuration options for the actual action. | ||
* | ||
* @return SpecificationBag | ||
*/ | ||
public function getConfigurationSpecification() { | ||
return new SpecificationBag; | ||
} | ||
|
||
/** | ||
* Returns the specification of the parameters of the actual action. | ||
* | ||
* @return SpecificationBag | ||
*/ | ||
public function getParameterSpecification() { | ||
return new SpecificationBag([ | ||
new Specification('payment_processor_id', 'Integer', E::ts('Payment Processor'), TRUE, NULL, NULL, NULL, FALSE), | ||
new Specification('payment_token_id', 'Integer', E::ts('Payment Token ID'), TRUE, NULL, NULL, NULL, FALSE), | ||
]); | ||
} | ||
|
||
/** | ||
* Returns the specification of the output parameters of this action. | ||
* | ||
* This function could be overridden by child classes. | ||
* | ||
* @return SpecificationBag | ||
*/ | ||
public function getOutputSpecification() { | ||
return new SpecificationBag([ | ||
new Specification('execution', 'Boolean', E::ts('Execution Success')), | ||
]); | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Civi\Ewayactions; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use CRM_eWAYRecurring_ExtensionUtil as E; | ||
|
||
class CompilerPass implements CompilerPassInterface { | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function process( ContainerBuilder $container ) { | ||
if ($container->hasDefinition('action_provider')) { | ||
$actionProviderDefinition = $container->getDefinition('action_provider'); | ||
$actionProviderDefinition->addMethodCall('addAction', [ | ||
'EwayactionsFillPaymentTokenMeta', | ||
'Civi\Ewayactions\Actions\FillPaymentTokenMeta', | ||
E::ts('EWAY: Fill Payment Token Metadata'), | ||
[]]); | ||
} | ||
} | ||
} |
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