コード例 #1
0
 /**
  * @param OpenpayCardType $cardType
  * @return CardInterface
  */
 protected function populate(OpenpayCardType $cardType)
 {
     $object = clone $this->object;
     $object->setCustomerId($cardType->getCustomerId());
     $object->setCardId($cardType->getId());
     $object->setCreatedAt($cardType->getCreationDate());
     $object->setType($cardType->getType());
     $object->setBrand($cardType->getBrand());
     $object->setCardNumber($cardType->getCardNumber());
     $object->setHolderName($cardType->getHolderName());
     $object->setExpirationYear($cardType->getExpirationYear());
     $object->setExpirationMonth($cardType->getExpirationMonth());
     $object->setAllowsCharges($cardType->isAllowsCharges());
     $object->setAllowsPayouts($cardType->isAllowsPayouts());
     $object->setBankName($cardType->getBankName());
     $object->setBankCode($cardType->getBankCode());
     if (!is_null($cardType->getAddress())) {
         $address = $this->addressMapper->create($cardType->getAddress());
         $object->setAddress($address);
     }
     return $object;
 }
コード例 #2
0
 /**
  * @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;
 }