/** * @param OpenpayCardType $object * @param array $data * @return OpenpayCardType */ public function populate(OpenpayCardType $object, array $data) { /* Mandatory fields */ $object->setHolderName($data['holder_name']); $object->setExpirationMonth($data['expiration_month']); $object->setExpirationYear($data['expiration_year']); /* Optional Fields */ if (isset($data['address'])) { $openpayAddressType = $this->openpayAddressMapper->create($data['address']); $object->setAddress($openpayAddressType); } $object->setCvv2(isset($data['cvv2']) ? $data['cvv2'] : null); $object->setAllowsCharges(isset($data['allows_charges']) ? $data['allows_charges'] : null); $object->setAllowsPayouts(isset($data['allows_payouts']) ? $data['allows_payouts'] : null); $object->setBankCode(isset($data['bank_code']) ? $data['bank_code'] : null); $object->setBankName(isset($data['bank_name']) ? $data['bank_name'] : null); $object->setBrand(isset($data['brand']) ? $data['brand'] : null); $object->setCardNumber(isset($data['card_number']) ? $data['card_number'] : null); $object->setCreationDate(isset($data['creation_date']) ? $data['creation_date'] : null); $object->setCustomerId(isset($data['customer_id']) ? $data['customer_id'] : null); $object->setId(isset($data['id']) ? $data['id'] : null); $object->setPointsCard(isset($data['points_card']) ? $data['points_card'] : null); $object->setType(isset($data['type']) ? $data['type'] : null); return $object; }