/** * @return \SimpleXMLElement */ public function getXml() { $request_type = in_array($this->type, array('txn', 'acs')) ? 'MpiRequest' : 'request'; $xml = new \SimpleXMLElement("<{$request_type}/>"); $xml->addChild('store_id', $this->config->getStoreId()); $xml->addChild('api_token', $this->config->getApiKey()); $type = $xml->addChild($this->type); foreach ($this->params as $key => $value) { $type->addChild($key, $value); } $type->addChild('crypt_type', $this->config->getCryptType()); return $xml; }
public function testConstructor() { $apiKey = "test_api_key"; $storeId = "my_custom_store"; $config = new Config($apiKey, $storeId); $this->assertEquals($apiKey, $config->getApiKey()); $this->assertEquals($storeId, $config->getStoreId()); $this->assertEquals(Config::ENV_LIVE, $config->getEnvironment()); $this->assertEquals(false, $config->isRequireAvs()); $this->assertEquals(false, $config->isRequireCvd()); $this->assertEquals(7, $config->getCryptType()); return $config; }