/** * @param CreditCardInterface $creditCard * @param array $options * @return array */ public function serializeCreditCard(CreditCardInterface $creditCard, $options = array()) { $result = array(); if ($creditCard->getCustomer() && $creditCard->getCustomer()->getSubscriptionCustomerId()) { $result['customerId'] = $creditCard->getCustomer()->getSubscriptionCustomerId(); } if ($creditCard->getNumber()) { $result['number'] = $creditCard->getNumber(); } if ($creditCard->getCVV()) { $result['cvv'] = $creditCard->getCVV(); } if ($creditCard->getExpirationDate()) { $result['expirationDate'] = $creditCard->getExpirationDate(); } if ($creditCard->getCardholderName()) { $result['cardholderName'] = $creditCard->getCardholderName(); } if (count($options) > 0) { $result['options'] = $options; } return $result; }
/** * Add credit card * * @param \Kairos\SubscriptionBundle\Model\CreditCardInterface $creditCard * @return Plan */ public function addCreditCard(\Kairos\SubscriptionBundle\Model\CreditCardInterface $creditCard) { $creditCard->setCustomer($this); $this->creditCards[] = $creditCard; return $this; }