/** * Tests conversion of {@link PaymentRequest} to and from XML using setters for Paymentdata. */ public function testPaymentRequestXmlPaymentDataSetters() { $cvnNumber = new CvnNumber(); $cvnNumber->setNumber(SampleXmlValidationUtils::RECEIPT_IN_CVN); $paymentData = new PaymentData(); $paymentData->setCvnNumber($cvnNumber); $request = new PaymentRequest(); $request->setAccount(SampleXmlValidationUtils::RECEIPT_IN_ACCOUNT); $request->setMerchantId(SampleXmlValidationUtils::RECEIPT_IN_MERCHANT_ID); $request->setType(PaymentType::RECEIPT_IN); $request->setPaymentData($paymentData); $amount = new Amount(); $amount->setAmount(SampleXmlValidationUtils::RECEIPT_IN_AMOUNT); $amount->setCurrency(SampleXmlValidationUtils::RECEIPT_IN_CURRENCY); $request->setAmount($amount); $request->setPayerRef(SampleXmlValidationUtils::RECEIPT_IN_PAYER); $request->setPaymentMethod(SampleXmlValidationUtils::RECEIPT_IN_PAYMENT_METHOD); $autoSettle = new AutoSettle(); $autoSettle->setFlag(SampleXmlValidationUtils::$RECEIPT_IN_AUTO_SETTLE_FLAG->getFlag()); $request->setAutoSettle($autoSettle); $request->setTimeStamp(SampleXmlValidationUtils::RECEIPT_IN_TIMESTAMP); $request->setOrderId(SampleXmlValidationUtils::RECEIPT_IN_ORDER_ID); $request->setHash(SampleXmlValidationUtils::RECEIPT_IN_REQUEST_HASH); // convert to XML $xml = $request->toXml(); // Convert from XML back to PaymentRequest /* @var PaymentRequest $fromXmlRequest */ $fromXmlRequest = new PaymentRequest(); $fromXmlRequest = $fromXmlRequest->fromXml($xml); SampleXmlValidationUtils::checkUnmarshalledReceiptInPaymentRequest($fromXmlRequest, $this); }