| @@ 281-296 (lines=16) @@ | ||
| 278 | } |
|
| 279 | ||
| 280 | // metadata |
|
| 281 | if (count($payment->getMetaData()->getItems()) > 0) { |
|
| 282 | $i = 0; |
|
| 283 | foreach ($payment->getMetaData()->getItems() as $item) { |
|
| 284 | if ($item instanceof PagSeguroMetaDataItem) { |
|
| 285 | if (!PagSeguroHelper::isEmpty($item->getKey()) && !PagSeguroHelper::isEmpty($item->getValue())) { |
|
| 286 | $i++; |
|
| 287 | $data['metadataItemKey' . $i] = $item->getKey(); |
|
| 288 | $data['metadataItemValue' . $i] = $item->getValue(); |
|
| 289 | ||
| 290 | if (!PagSeguroHelper::isEmpty($item->getGroup())) { |
|
| 291 | $data['metadataItemGroup' . $i] = $item->getGroup(); |
|
| 292 | } |
|
| 293 | } |
|
| 294 | } |
|
| 295 | } |
|
| 296 | } |
|
| 297 | ||
| 298 | // parameter |
|
| 299 | if (count($payment->getParameter()->getItems()) > 0) { |
|
| @@ 181-196 (lines=16) @@ | ||
| 178 | } |
|
| 179 | ||
| 180 | // metadata |
|
| 181 | if (count($payment->getMetaData()->getItems()) > 0) { |
|
| 182 | $i = 0; |
|
| 183 | foreach ($payment->getMetaData()->getItems() as $item) { |
|
| 184 | if ($item instanceof PagSeguroMetaDataItem) { |
|
| 185 | if (!PagSeguroHelper::isEmpty($item->getKey()) && !PagSeguroHelper::isEmpty($item->getValue())) { |
|
| 186 | $i++; |
|
| 187 | $data['metadataItemKey' . $i] = $item->getKey(); |
|
| 188 | $data['metadataItemValue' . $i] = $item->getValue(); |
|
| 189 | ||
| 190 | if (!PagSeguroHelper::isEmpty($item->getGroup())) { |
|
| 191 | $data['metadataItemGroup' . $i] = $item->getGroup(); |
|
| 192 | } |
|
| 193 | } |
|
| 194 | } |
|
| 195 | } |
|
| 196 | } |
|
| 197 | ||
| 198 | // paymentMethodConfig |
|
| 199 | if (count($payment->getPaymentMethodConfig()->getConfig()) > 0) { |
|
| @@ 199-213 (lines=15) @@ | ||
| 196 | } |
|
| 197 | ||
| 198 | // paymentMethodConfig |
|
| 199 | if (count($payment->getPaymentMethodConfig()->getConfig()) > 0) { |
|
| 200 | $i = 0; |
|
| 201 | foreach ($payment->getPaymentMethodConfig()->getConfig() as $config) { |
|
| 202 | if ($config instanceof PagSeguroPaymentMethodConfigItem) { |
|
| 203 | if (!PagSeguroHelper::isEmpty($config->getKey()) && !PagSeguroHelper::isEmpty($config->getValue())) { |
|
| 204 | $i++; |
|
| 205 | if (!PagSeguroHelper::isEmpty($config->getGroup())) { |
|
| 206 | $data['paymentMethodGroup' . $i] = $config->getGroup(); |
|
| 207 | } |
|
| 208 | $data['paymentMethodConfigKey' . $i . "_1"] = $config->getKey(); |
|
| 209 | $data['paymentMethodConfigValue' . $i . "_1"] = $config->getValue(); |
|
| 210 | } |
|
| 211 | } |
|
| 212 | } |
|
| 213 | } |
|
| 214 | ||
| 215 | // parameter |
|
| 216 | if (count($payment->getParameter()->getItems()) > 0) { |
|