/**
  * Scenario: Mask StoredValue* Payload XML sensitive data
  * Given an XML Payload containing sensitive data.
  * When the mask XML nodes is applied.
  * Then all sensitive data are masked in XML Payload.
  *
  * @param string
  * @param string
  * @param array
  * @param string
  * @dataProvider providerMaskXmlNodes
  */
 public function testMaskXmlNodes($xml, $mask, array $expressionList, $prefix)
 {
     /** @var DOMDocument */
     $doc = $this->coreHelper->getNewDomDocument();
     $doc->loadXML($xml);
     /** @var DOMXPath */
     $xpath = $this->getXPath($doc, $prefix);
     foreach ($expressionList as $expression) {
         // Proving that the value of the nodes are not masked prior to calling
         // the method ebayenterprise_giftcard/giftcard::maskXmlNodes() on the
         // XML Payload.
         $this->assertNotSame($mask, $xpath->evaluate($expression));
     }
     /** @var DOMDocument */
     $maskDoc = $this->coreHelper->getNewDomDocument();
     // Masking the node values in the XML Payload
     $maskDoc->loadXML($this->mask->maskXmlNodes($xml));
     /** @var DOMXPath */
     $maskXPath = $this->getXPath($maskDoc, $prefix);
     foreach ($expressionList as $expression) {
         // Proving that the value of the nodes are now masked after calling
         // the method ebayenterprise_giftcard/giftcard::maskXmlNodes() on the
         // XML Payload.
         $this->assertSame($mask, $maskXPath->evaluate($expression));
     }
 }
 /**
  * Log request and response of stored value various service API calls.
  *
  * @param Api\IBidirectionalApi
  * @param bool
  * @param string
  */
 protected function _logStoredValuePayload(Api\IBidirectionalApi $api, $isRequest, $logMessage)
 {
     /** @var string */
     $method = 'getRequestBody';
     /** @var string */
     $metaDataKey = 'rom_request_body';
     if (!$isRequest) {
         $method = 'getResponseBody';
         $metaDataKey = 'rom_response_body';
     }
     /** @var string */
     $cleanedXml = $this->_mask->maskXmlNodes($api->{$method}()->serialize());
     $this->_logger->debug($logMessage, $this->_context->getMetaData(__CLASS__, [$metaDataKey => $cleanedXml]));
     return $this;
 }
 /**
  * Log the api call with sensitive information masked.
  *
  * @param ILookupRequest
  * @param string
  * @return self
  */
 protected function logRequest(ILookupRequest $request, $logMessage)
 {
     $metaData = ['rom_request_body' => $this->logMask->maskXmlNodes($request->serialize())];
     $this->logger->debug($logMessage, $this->logContext->getMetaData(__CLASS__, $metaData));
     return $this;
 }