public function __construct($responseArray)
 {
     $apiPayload = $responseArray->APIResponse;
     $apiResponse = new APIResponse($apiPayload->ResponseCode, $apiPayload->ResponseText);
     parent::__construct($apiResponse);
     if ($apiResponse->getResponseCode() == "0") {
         $elements = $responseArray->TxnResp;
         $this->action = $elements->Action;
         $this->amount = $elements->Amount;
         $this->amountSurcharge = $elements->AmountSurcharge;
         $this->threeDSResponse = $elements->ThreeDSResponse;
         $this->authoriseId = $elements->AuthoriseId;
         $this->bankAccountDetails = $elements->BankAccountDetails;
         $this->bankResponseCode = $elements->BankResponseCode;
         $this->cvnResult = new CVNResult($elements->CVNResult);
         $ccDetails = new CardDetails();
         $cardPayload = $elements->CardDetails;
         $ccDetails->setCardHolderName($cardPayload->CardHolderName);
         $ccDetails->setExpiryDate($cardPayload->ExpiryDate);
         $ccDetails->setMaskedCardNumber($cardPayload->MaskedCardNumber);
         $this->cardDetails = $ccDetails;
         $this->cardType = $elements->CardType;
         $this->currency = $elements->Currency;
         $this->isThreeDS = $elements->IsThreeDS;
         $this->isCVNPresent = $elements->IsCVNPresent;
         $this->merchantNumber = $elements->MerchantNumber;
         $this->originalTxnNumber = $elements->OriginalTxnNumber;
         $this->processedDateTime = $elements->ProcessedDateTime;
         $this->rrn = $elements->RRN;
         $this->receiptNumber = $elements->ReceiptNumber;
         $this->crn1 = $elements->Crn1;
         $this->crn2 = $elements->Crn2;
         $this->crn3 = $elements->Crn3;
         $this->responseCode = $elements->ResponseCode;
         $this->responseText = $elements->ResponseText;
         $this->billerCode = $elements->BillerCode;
         $this->settlementDate = $elements->SettlementDate;
         $this->source = $elements->Source;
         $this->subType = $elements->SubType;
         $this->storeCard = $elements->StoreCard;
         $this->txnNumber = $elements->TxnNumber;
         $this->type = $elements->Type;
         $this->isTestTxn = $elements->IsTestTxn;
         $fsDetails = new FraudScreeningResponse($elements->FraudScreeningResponse);
         $this->fraudScreeningResponse = $fsDetails;
         if (isset($elements->DVToken)) {
             $this->dvtoken = $elements->DVToken;
         }
         if (isset($elements->EmailAddress)) {
             $this->emailAddress = $elements->EmailAddress;
         }
     }
 }
Ejemplo n.º 2
0
 public function sendTransaction()
 {
     utils\URLDirectory::setBaseURL('https://www.bpoint.com.au/webapi/v2', 'https://www.bpoint.com.au/webapi/v2');
     $transaction = new Transaction();
     $transaction->setAction(constants\Actions::Payment);
     $transaction->setMode(constants\Mode::Live);
     $transaction->setAmount(10000);
     $transaction->setTestMode(true);
     $transaction->setUsername(Yii::$app->params['bpoint']['username']);
     $transaction->setPassword(Yii::$app->params['bpoint']['password']);
     $transaction->setMerchantNumber(Yii::$app->params['bpoint']['merchantNumber']);
     $transaction->setCrn1('1');
     $transaction->setCurrency('AUD');
     $transaction->setType(constants\TransactionType::ECommerce);
     $transaction->setSubType(constants\TransactionSubType::Single);
     $card = new CardDetails();
     $card->setCardHolderName('MasterCard');
     $card->setCardNumber('4987654321098769');
     $card->setCVN('888');
     $card->setExpiryDate('1117');
     $transaction->setCardDetails($card);
     $resp = $transaction->submit();
     print_r($resp);
 }