protected function _validateGiftCardForStorate(EbayEnterprise_GiftCard_Model_IGiftcard $card) { if ($card->getCardNumber()) { return $this; } throw Mage::exception('EbayEnterprise_GiftCard', 'Invalid gift card.'); }
/** * Add a gift card to the container. Will make the gift card balance check * and make sure card can be applied to the order. * @param EbayEnterprise_GiftCard_Model_IGiftcard $card * @return self * @throws EbayEnterprise_GiftCard_Exception If gift card could not be added to the order. */ public function addGiftCardToOrder(EbayEnterprise_GiftCard_Model_IGiftcard $card, EbayEnterprise_GiftCard_Model_IContainer $giftCardContainer) { $card->checkBalance(); // Treat 0 balance gift cards as invalid. if ($card->getBalanceAmount() <= 0) { throw Mage::exception('EbayEnterprise_GiftCard', $this->__(self::ZERO_BALANCE_CARD_MESSAGE, $card->getCardNumber())); } $giftCardContainer->updateGiftCard($card); return $this; }
/** * Lookup the tender type for given gift card. * @param EbayEnterprise_GiftCard_Model_IGiftcard $giftcard * @return string * @throws EbayEnterprise_GiftCard_Exception_InvalidCardNumber_Exception If card number not found in any known range. */ public function lookupTenderTypeForCard(EbayEnterprise_GiftCard_Model_IGiftcard $giftcard) { $cardNumber = $giftcard->getCardNumber(); foreach ($this->getConfigModel()->binRanges as $tenderType => $range) { if ($this->_isCardNumberWithinRange($cardNumber, $range)) { return $tenderType; } } throw Mage::exception('EbayEnterprise_GiftCard_Exception_InvalidCardNumber', $this->__(self::INVLIAD_CARD_NUMBER_MESSAGE, $cardNumber)); }