. */ /* */ /*************************************************************************************/ namespace WireTransfer\Loop; use Thelia\Core\Template\Element\ArraySearchLoopInterface; use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Model\Base\OrderQuery; use WireTransfer\WireTransfer; /** * Class GetBankInformation * @package WireTransfer\Loop * @author Thelia */ class GetBankInformation extends BaseLoop implements ArraySearchLoopInterface { /** * @param LoopResult $loopResult * * @return LoopResult */ public function parseResults(LoopResult $loopResult) { $order = OrderQuery::create()->findPk($this->getOrderId()); if ($order !== null || $order->getPaymentModuleId() === WireTransfer::getModuleId() ) { $loopResultRow = new LoopResultRow(); $loopResultRow ->set("BIC" , WireTransfer::getConfigValue('bic')) ->set("IBAN" , WireTransfer::getConfigValue('iban')) ->set("ACCOUNT_HOLDER_NAME", WireTransfer::getConfigValue('name')) ; $loopResult->addRow($loopResultRow); } return $loopResult; } protected function getArgDefinitions() { return new ArgumentCollection( Argument::createIntTypeArgument("order_id", null, true, false) ); } /** * this method returns an array * * @return array */ public function buildArray() { // Return an array containing one element, so that parseResults() will be called one time. return [ 'one-element' ]; } }