コード例 #1
0
 /**
  * Tests conversion of {@link ThreeDSecureRequest} verify sig to and from XML using setters.
  */
 public function testThreeDSecureSigRequestXmlWithSetters()
 {
     $card = new Card();
     $card->setExpiryDate(SampleXmlValidationUtils::CARD_EXPIRY_DATE);
     $card->setNumber(SampleXmlValidationUtils::CARD_NUMBER);
     $card->setType(SampleXmlValidationUtils::$CARD_TYPE->getType());
     $card->setCardHolderName(SampleXmlValidationUtils::CARD_HOLDER_NAME);
     $card->setIssueNumber(SampleXmlValidationUtils::CARD_ISSUE_NUMBER);
     $cvn = new Cvn();
     $cvn->setNumber(SampleXmlValidationUtils::CARD_CVN_NUMBER);
     $cvn->setPresenceIndicator(SampleXmlValidationUtils::$CARD_CVN_PRESENCE->getIndicator());
     $card->setCvn($cvn);
     $request = new ThreeDSecureRequest();
     $request->setAccount(SampleXmlValidationUtils::ACCOUNT);
     $request->setMerchantId(SampleXmlValidationUtils::MERCHANT_ID);
     $amount = new Amount();
     $amount->setAmount(SampleXmlValidationUtils::AMOUNT);
     $amount->setCurrency(SampleXmlValidationUtils::CURRENCY);
     $request->setAmount($amount);
     $request->setCard($card);
     $request->setTimeStamp(SampleXmlValidationUtils::TIMESTAMP);
     $request->setOrderId(SampleXmlValidationUtils::ORDER_ID);
     $request->setPares(SampleXmlValidationUtils::THREE_D_SECURE_PARES);
     $request->setHash(SampleXmlValidationUtils::THREE_D_SECURE_VERIFY_SIG_REQUEST_HASH);
     $request->setType(ThreeDSecureType::VERIFY_SIG);
     //convert to XML
     $xml = $request->toXml();
     // Convert from XML back to PaymentRequest
     /* @var ThreeDSecureRequest $fromXmlRequest */
     $fromXmlRequest = new ThreeDSecureRequest();
     $fromXmlRequest = $fromXmlRequest->fromXml($xml);
     SampleXmlValidationUtils::checkUnmarshalledVerifySigRequest($fromXmlRequest, $this);
 }
コード例 #2
0
 /**
  * Tests conversion of {@link ThreeDSecureRequest} card enrolled to and from XML using setters.
  */
 public function testThreeDSecureCardEnrolledRequestXmlWithSetters()
 {
     $request = new ThreeDSecureRequest();
     $request->setAccount(SampleXmlValidationUtils::CARD_VERIFY_ACCOUNT);
     $request->setMerchantId(SampleXmlValidationUtils::CARD_VERIFY_MERCHANT_ID);
     $paymentData = new PaymentData();
     $paymentData->addCvnNumber(SampleXmlValidationUtils::CARD_PAYMENT_DATA_CVN);
     $request->setPaymentData($paymentData);
     $amount = new Amount();
     $amount->setAmount(SampleXmlValidationUtils::CARD_VERIFY_AMOUNT);
     $amount->setCurrency(SampleXmlValidationUtils::CARD_VERIFY_CURRENCY);
     $request->setAmount($amount);
     $request->setTimeStamp(SampleXmlValidationUtils::CARD_VERIFY_TIMESTAMP);
     $request->setOrderId(SampleXmlValidationUtils::CARD_VERIFY_ORDER_ID);
     $request->setPaymentMethod(SampleXmlValidationUtils::CARD_VERIFY_REF);
     $request->setPayerRef(SampleXmlValidationUtils::CARD_VERIFY_PAYER_REF);
     $request->setHash(SampleXmlValidationUtils::CARD_VERIFY_REQUEST_HASH);
     $request->setType(ThreeDSecureType::VERIFY_STORED_CARD_ENROLLED);
     $autoSettle = new AutoSettle();
     $autoSettle->setFlag(SampleXmlValidationUtils::$CARD_VERIFY_AUTO_SETTLE_FLAG->getFlag());
     $request->setAutoSettle($autoSettle);
     // convert to XML
     $xml = $request->toXml();
     // Convert from XML back to PaymentRequest
     /* @var ThreeDSecureRequest $fromXmlRequest */
     $fromXmlRequest = new ThreeDSecureRequest();
     $fromXmlRequest = $fromXmlRequest->fromXml($xml);
     SampleXmlValidationUtils::checkUnmarshalledVerifyCardEnrolledPaymentRequest($fromXmlRequest, $this);
 }