Example #1
0
 protected function convertToModel($key, $params)
 {
     $paymentTypes = ['Boleto' => 'Braspag\\BoletoPayment', 'CreditCard' => 'Braspag\\CreditCardPayment', 'DebitCard' => 'Braspag\\DebitCardPayment', 'EletronicTransfer' => 'Braspag\\EletronicTransferPayment'];
     if ($key === 'payment') {
         return new $paymentTypes[$params['Type']]($params);
     }
     return parent::convertToModel($key, $params);
 }
Example #2
0
 protected function convertToModel($key, $params)
 {
     $property = [];
     if ($key === 'links') {
         $types = $this->getTypes();
         foreach ($params as $link) {
             $property[] = new $types['link']($link);
         }
         return $property;
     }
     return parent::convertToModel($key, $params);
 }