8 use Braintree\Transaction;
23 private $attributeValueFactory;
37 'paymentInstrumentType',
38 'paypalDetails_paymentId',
42 'processorSettlementResponseCode',
44 'processorSettlementResponseText',
56 Transaction $transaction
58 $this->attributeValueFactory = $attributeValueFactory;
69 return $this->getMappedValue(
'id');
92 $attributeValue = $this->attributeValueFactory->create();
95 return $attributeValue;
118 $shouldBeLocalized = [
'paymentInstrumentType',
'type',
'status'];
120 foreach ($this->getMappedValues() as $key =>
$value) {
121 $attribute = $this->attributeValueFactory->create();
122 if (in_array($key, $shouldBeLocalized)) {
149 private function getMappedValue($key)
151 if (!in_array($key, static::$simpleFieldsMap)) {
155 $val = $this->getTransactionFieldValue($key);
156 $val = $this->convertToText($val);
163 private function getMappedValues()
167 foreach (static::$simpleFieldsMap as $key) {
168 $val = $this->getTransactionFieldValue($key);
169 $val = $this->convertToText($val);
182 private function getTransactionFieldValue($key)
184 $keys = explode(self::TRANSACTION_FIELD_MAP_DELIMITER, $key);
186 foreach ($keys as $k) {
202 private function convertToText($val)
204 if (is_object($val)) {
205 switch (get_class($val)) {
208 $val = $val->format(\
Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
210 }
elseif (is_array($val)) {
211 $val = implode(
', ', $val);
214 return (
string) $val;
elseif(isset( $params[ 'redirect_parent']))
getCustomAttribute($attributeCode)
setCustomAttribute($attributeCode, $attributeValue)
const TRANSACTION_FIELD_MAP_DELIMITER
__construct(AttributeValueFactory $attributeValueFactory, Transaction $transaction)
setCustomAttributes(array $attributes)