示例#1
0
 /**
  * @param Response\TransactionInfo $response
  *
  * @throws Exception\MethodNotSupportedException
  */
 public function transactionInfoResponse(Response\TransactionInfo $response)
 {
     $this->setSuccess($response);
     if ($response->getSuccess()) {
         $creditCard = new Helper\CreditCard();
         $cardInfo = $response->getApiResponse('card');
         $billingData = $response->getApiResponse('billing');
         $cardExpMonth = $cardInfo['expiry_month'];
         $cardExpYear = $cardInfo['expiry_year'] + 2000;
         $creditCard->setCardExpiry($cardExpMonth, $cardExpYear);
         $creditCard->setCardNumber('0000 0000 0000 ' . $cardInfo['last_four']);
         $creditCard->setName($cardInfo['name']);
         $creditCard->setAddress1($billingData['address_line1']);
         $creditCard->setAddress2($billingData['address_line2']);
         $creditCard->setCity($billingData['city']);
         $creditCard->setState($billingData['province']);
         $creditCard->setZipCode($billingData['postal_code']);
         $creditCard->setCountry($billingData['country']);
         $creditCard->setPhoneNumber($billingData['phone_number']);
         $creditCard->setEmailAddress($billingData['email_address']);
         $response->setCreditCard($creditCard);
         $response->setAmount($response->getApiResponse('amount'));
         $response->setOperation($response->getApiResponse('type'));
         $response->setDate(new \DateTime($response->getApiResponse('created')));
     }
 }
示例#2
0
 /**
  * @param Response\TransactionInfo $response
  */
 public function transactionInfoResponse(Response\TransactionInfo $response)
 {
     $this->setSuccess($response);
     if ($response->getSuccess()) {
         $creditCard = new Helper\CreditCard();
         $cardInfo = $response->getApiResponse('card');
         $customerInfo = $cardInfo['customer'];
         $creditCard->setCardExpiry($cardInfo['exp_month'], $cardInfo['exp_year']);
         $creditCard->setCardNumber('0000 0000 0000 ' . $cardInfo['last4']);
         $creditCard->setName($cardInfo['name']);
         $creditCard->setAddress1($cardInfo['address_line1']);
         $creditCard->setAddress2($cardInfo['address_line2']);
         $creditCard->setCity($cardInfo['address_city']);
         $creditCard->setState($cardInfo['address_state']);
         $creditCard->setZipCode($cardInfo['address_zip']);
         $creditCard->setCountry($cardInfo['address_country']);
         $creditCard->setEmailAddress(isset($customerInfo['email']) ? $customerInfo['email'] : null);
         $response->setCreditCard($creditCard);
         $response->setAmount($response->getApiResponse('amount'));
         $response->setOperation($response->getApiResponse('object'));
         $response->setDate((new \DateTime())->setTimestamp($response->getApiResponse('created')));
     }
 }
示例#3
0
 /**
  * @param Response\TransactionInfo $response
  */
 public function transactionInfoResponse(Response\TransactionInfo $response)
 {
     $transactionData = [];
     if (null !== $response->getApiResponse('a001')) {
         parse_str($response->getApiResponse('a001'), $transactionData);
     }
     $transactionInfo = function ($key) use($transactionData) {
         return false === isset($transactionData[$key]) ? null : $transactionData[$key];
     };
     $response->setSuccess($transactionInfo('FinalStatus') === 'success');
     if ($transactionInfo('FinalStatus') !== null) {
         $creditCard = new Helper\CreditCard();
         $cardExp = $transactionInfo('card-exp');
         $cardExpMonth = null;
         $cardExpYear = null;
         if (sizeOf($cardExp)) {
             list($cardExpMonth, $cardExpYear) = explode('/', $cardExp);
             $cardExpYear += 2000;
             $creditCard->setCardExpiry($cardExpMonth, $cardExpYear);
         }
         $creditCard->setName($transactionInfo('card-name'));
         $creditCard->setAddress1($transactionInfo('card-address1'));
         $creditCard->setAddress2($transactionInfo('card-address2'));
         $creditCard->setCity($transactionInfo('card-city'));
         $creditCard->setState($transactionInfo('card-state'));
         $creditCard->setZipCode($transactionInfo('card-zip'));
         $creditCard->setCountry($transactionInfo('card-country'));
         $creditCard->setCardNumber($transactionInfo('card-number'));
         $response->setCreditCard($creditCard);
         $response->setAmount($transactionInfo('card-amount'));
         $response->setOperation($transactionInfo('operation'));
         $response->setDate(new \DateTime($transactionInfo('trans_date')));
     }
 }