예제 #1
0
 /**
  * @return array|void
  */
 public function getConfig()
 {
     if (!$this->config->isActive()) {
         return [];
     }
     $config = parent::getConfig();
     $clientToken = $this->config->getClientToken();
     $useVault = $this->config->useVault();
     $selectedCardToken = null;
     $storedCardOptions = [];
     if ($useVault) {
         $storedCards = $this->getStoredCards();
         if (count($storedCards) == 0) {
             $useVault = false;
         } else {
             foreach ($storedCards as $creditCard) {
                 $storedCardOptions[] = ['token' => $creditCard->token, 'maskedNumber' => $creditCard->maskedNumber . ' - ' . $creditCard->cardType, 'selected' => $creditCard->default, 'type' => $this->dataHelper->getCcTypeCodeByName($creditCard->cardType)];
                 if ($creditCard->default) {
                     $selectedCardToken = $creditCard->token;
                 }
             }
         }
     }
     $config = array_merge_recursive($config, ['payment' => ['braintree' => ['clientToken' => $clientToken, 'useVault' => $useVault, 'canSaveCard' => $this->canSaveCard(), 'show3dSecure' => $this->show3dSecure(), 'storedCards' => $storedCardOptions, 'selectedCardToken' => $selectedCardToken, 'creditCardExpMonth' => (int) $this->dataHelper->getTodayMonth(), 'creditCardExpYear' => (int) $this->dataHelper->getTodayYear(), 'countrySpecificCardTypes' => $this->config->getCountrySpecificCardTypeConfig(), 'isFraudDetectionEnabled' => $this->config->isFraudDetectionEnabled(), 'isCcDetectionEnabled' => $this->config->isCcDetectionEnabled(), 'availableCardTypes' => $this->getCcAvailableCcTypes(), 'braintreeDataJs' => $this->config->getBraintreeDataJs(), 'ajaxGenerateNonceUrl' => $this->getAjaxGenerateNonceUrl()]]]);
     return $config;
 }
예제 #2
0
 /**
  * Retrieve today month
  *
  * @return string
  */
 public function getTodayMonth()
 {
     return $this->dataHelper->getTodayMonth();
 }