Esempio n. 1
0
 /**
  * @param $creditCardId
  * @return CompleteData
  */
 public function getCreditCard($creditCardId)
 {
     $localData = $this->getLocalData($creditCardId);
     $token = $localData->getToken();
     $remoteData = $this->getRemoteData($token);
     $completeData = new CompleteData();
     $completeData->setPan($localData->getFirstDigits() . $remoteData->getLast10());
     $completeData->setSecurityCode($remoteData->getSecurityCode());
     $completeData->setExpirationMonth($remoteData->getExpirationMonth());
     $completeData->setExpirationYear($remoteData->getExpirationYear());
     $completeData->setHolder($remoteData->getHolder());
     $completeData->setBrand($localData->getBrand());
     return $completeData;
 }
Esempio n. 2
0
 public function storeCardAction()
 {
     /**
      * @var StoreService $storeService
      */
     $storeService = $this->getServiceLocator()->get('service_store_cc');
     $ccRawData = new CompleteData();
     $ccRawData->setPan('4111111111111111');
     $ccRawData->setExpirationMonth('01');
     $ccRawData->setExpirationYear('16');
     $ccRawData->setSecurityCode('123');
     $ccRawData->setHolder('Some VISA dddddddd Holder');
     $ccRawData->setCustomerId(1);
     $ccRawData->setPartnerId(0);
     $ccRawData->setBrand(1);
     $ccRawData->setSource(0);
     $ccRawData->setStatus(0);
     $token = $storeService->store($ccRawData);
     echo $token;
     $ccRawData = new CompleteData();
     $ccRawData->setPan('378282246310005');
     $ccRawData->setExpirationMonth('01');
     $ccRawData->setExpirationYear('16');
     $ccRawData->setSecurityCode('123');
     $ccRawData->setHolder('Some AMEX dddddddddddddddddddddd Holder');
     $ccRawData->setBrand(2);
     $token = $storeService->store($ccRawData);
     echo $token;
     $ccRawData = new CompleteData();
     $ccRawData->setPan('30569309025904');
     $ccRawData->setExpirationMonth('01');
     $ccRawData->setExpirationYear('16');
     $ccRawData->setSecurityCode('123');
     $ccRawData->setHolder('Some DINNERS CLUBddddddddddddddddddddddddddddddd Holder');
     $ccRawData->setBrand(2);
     $token = $storeService->store($ccRawData);
     echo $token;
     die;
 }
Esempio n. 3
0
File: Card.php Progetto: arbi/MyCode
 /**
  * @param $rawData
  * @return int
  */
 public function processCreditCardData($rawData)
 {
     $partnerId = Partners::PARTNER_WEBSITE;
     /**
      * @var \CreditCard\Service\Encrypt $encryptService
      */
     $encryptService = $this->getServiceLocator()->get('service_encrypt');
     // Detect partner business model
     if (isset($rawData['partner_id']) && $rawData['partner_id']) {
         /**
          * @var \DDD\Dao\Partners\Partners $partnerDao
          */
         $partnerDao = $this->getServiceLocator()->get('dao_partners_partners');
         $partnerData = $partnerDao->getPartnerModel($rawData['partner_id']);
         if ($partnerData && $partnerData->getBusinessModel() == Partners::BUSINESS_MODEL_GINOSI_COLLECT_PARTNER) {
             $partnerId = $rawData['partner_id'];
         }
     }
     // Save CC Details
     $creditCard = new CompleteData();
     $pan = isset($rawData['number']) ? $rawData['number'] : '';
     $creditCard->setPan($encryptService->encrypt($pan, ''));
     $holder = isset($rawData['holder']) ? $rawData['holder'] : '';
     $creditCard->setHolder($encryptService->encrypt($holder, ''));
     $cvc = isset($rawData['cvc']) ? $rawData['cvc'] : '';
     $creditCard->setSecurityCode($encryptService->encrypt($cvc, ''));
     if (isset($rawData['year']) && strlen($rawData['year']) == 4) {
         $rawData['year'] = substr($rawData['year'], 2, 2);
     }
     $year = isset($rawData['year']) ? $rawData['year'] : '';
     $creditCard->setExpirationYear($encryptService->encrypt($year, ''));
     $month = isset($rawData['month']) ? $rawData['month'] : '';
     $creditCard->setExpirationMonth($encryptService->encrypt($month, ''));
     // Card Type
     $creditCardValidator = new CreditCardValidator();
     $cardType = $creditCardValidator->getCardTypeByNumber(substr($pan, 0, 6));
     $creditCard->setBrand(0);
     if ($cardType) {
         $creditCardType = Objects::getCreditCardId($cardType);
         $creditCard->setBrand($creditCardType);
     }
     $creditCard->setSource($rawData['source']);
     $creditCard->setStatus(self::CC_STATUS_UNKNOWN);
     $creditCard->setPartnerId($partnerId);
     $creditCard->setCustomerId($rawData['customer_id']);
     $creditCard->setDateProvided(date('Y-m-d h:i:s'));
     // Save cc details locally
     //        $this->gr2info('Successfully created CC data from ' . ucfirst($params['source_provider']), ['module' => 'Finance']);
     //        $ccId = $creditCard->getId();
     /**
      * @var Queue $creditCardCreationQueueService
      */
     $creditCardCreationQueueService = $this->getServiceLocator()->get('service_card_creation_queue');
     $cardId = $creditCardCreationQueueService->insert($creditCard);
     return $cardId;
     //        $this->gr2info('Successfully send to Processing Queue from ' . ucfirst($params['source_provider']), ['module' => 'Finance']);
     //
     //        $this->gr2info('Customer or CC create/update end from ' . ucfirst($params['source_provider']), ['module' => 'Finance']);
     //
     //        $logger->save(Logger::MODULE_BOOKING, $reservationId, Logger::ACTION_NEW_CC_DETAILS, $cardId);
     //        $this->gr2logException($e, 'Cannot update CC data from Frontier');
     //        $this->gr2debug($e->getMessage(), [
     //            'reservation_id'              => $reservationId,
     //            'customer_id'                 => $reservationData['customer_id'],
     //            'credit_card_source_provider' => 'frontier'
     //        ]);
 }