Exemple #1
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')));
     }
 }
Exemple #2
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')));
     }
 }