private function denormaliseAutoSettle(\ArrayAccess $array) { $autoSettleData = $array['autosettle']; if (is_null($autoSettleData)) { return null; } $data = new SafeArrayAccess($autoSettleData); $autoSettle = new AutoSettle(); $autoSettle->addFlag($data['@flag']); return $autoSettle; }
/** * Tests conversion of {@link PaymentRequest} to and from XML using setters for DCCInfo. */ public function testPaymentRequestXmlDCCInfoFluentSetters() { $request = new PaymentRequest(); $request->addAccount(SampleXmlValidationUtils::DCC_RATE_ACCOUNT)->addMerchantId(SampleXmlValidationUtils::DCC_RATE_MERCHANT_ID)->addType(PaymentType::DCC_RATE_LOOKUP); $card = new Card(); $card->addExpiryDate(SampleXmlValidationUtils::DCC_RATE_CARD_EXPIRY_DATE)->addNumber(SampleXmlValidationUtils::DCC_RATE_CARD_NUMBER)->addType(SampleXmlValidationUtils::DCC_RATE_CARD_TYPE)->addCardHolderName(SampleXmlValidationUtils::DCC_RATE_CARD_HOLDER_NAME); $request->addCard($card); $dccInfo = new DccInfo(); $dccInfo->addDccProcessor(SampleXmlValidationUtils::DCC_RATE_CCP); $request->addDccInfo($dccInfo); $request->addAmount(SampleXmlValidationUtils::DCC_RATE_AMOUNT)->addCurrency(SampleXmlValidationUtils::DCC_RATE_CURRENCY); $autoSettle = new AutoSettle(); $autoSettle->addFlag(SampleXmlValidationUtils::$AUTO_SETTLE_FLAG->getFlag()); $request->addAutoSettle($autoSettle)->addTimeStamp(SampleXmlValidationUtils::DCC_RATE_TIMESTAMP)->addOrderId(SampleXmlValidationUtils::DCC_RATE_ORDER_ID)->addHash(SampleXmlValidationUtils::DCC_RATE_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::checkUnmarshalledDccRateLookUpPaymentRequest($fromXmlRequest, $this); }