Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigurableInfo.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Payment\Block;
7 
11 
18 {
22  private $config;
23 
29  public function __construct(
30  Context $context,
31  ConfigInterface $config,
32  array $data = []
33  ) {
34  parent::__construct($context, $data);
35  $this->config = $config;
36 
37  if (isset($data['pathPattern'])) {
38  $this->config->setPathPattern($data['pathPattern']);
39  }
40 
41  if (isset($data['methodCode'])) {
42  $this->config->setMethodCode($data['methodCode']);
43  }
44  }
45 
52  protected function _prepareSpecificInformation($transport = null)
53  {
54  $transport = parent::_prepareSpecificInformation($transport);
55  $payment = $this->getInfo();
56  $storedFields = explode(',', (string)$this->config->getValue('paymentInfoKeys'));
57  if ($this->getIsSecureMode()) {
58  $storedFields = array_diff(
59  $storedFields,
60  explode(',', (string)$this->config->getValue('privateInfoKeys'))
61  );
62  }
63 
64  foreach ($storedFields as $field) {
65  if ($payment->getAdditionalInformation($field) !== null) {
66  $this->setDataToTransfer(
67  $transport,
68  $field,
69  $payment->getAdditionalInformation($field)
70  );
71  }
72  }
73 
74  return $transport;
75  }
76 
85  protected function setDataToTransfer(
86  \Magento\Framework\DataObject $transport,
87  $field,
88  $value
89  ) {
90  $transport->setData(
91  (string)$this->getLabel($field),
92  (string)$this->getValueView(
93  $field,
94  $value
95  )
96  );
97  }
98 
105  protected function getLabel($field)
106  {
107  return $field;
108  }
109 
118  protected function getValueView($field, $value)
119  {
120  return $value;
121  }
122 }
$config
Definition: fraud_order.php:17
$payment
Definition: order.php:17
$value
Definition: gender.phtml:16
__construct(Context $context, ConfigInterface $config, array $data=[])
setDataToTransfer(\Magento\Framework\DataObject $transport, $field, $value)