Beispiel #1
0
 /**
  * @see http://php.net/manual/pt_BR/function.curl-setopt.php
  */
 public function __construct(Collection $options)
 {
     $this->curl = curl_init();
     $sslVersion = $options->get('sslVersion', 'SecureTransport');
     $this->setOption(CURLOPT_SSLVERSION, $sslVersion);
     $this->setOption(CURLOPT_RETURNTRANSFER, true);
     $this->setOption(CURLINFO_HEADER_OUT, true);
     $this->setOption(CURLOPT_VERBOSE, $options->get('verbose'));
     $this->setOption(CURLOPT_SSL_VERIFYPEER, $options->get('sslVerifyPeer', true));
     parent::__construct([]);
 }
Beispiel #2
0
 public function __construct(array $elements = [], array $parameters = null)
 {
     if (2 > count($elements)) {
         throw new \Exception('Map require elements');
     }
     $data = ['method' => $elements[0], 'resource' => $elements[1], 'parameters' => $parameters];
     parent::__construct($data);
 }
Beispiel #3
0
 /**
  * @depends testAcessoAListaDeSkus
  */
 public function testAtualizaPrecoDoSkuInformado(Collection $data)
 {
     foreach ($data->getSkus() as $sku) {
         $client = $this->factoryClient();
         $response = $client->get('/sku/' . $sku['id']);
         $info = $response->getData()->getPrice();
         $price = Factory::factoryPrice($info);
         $this->assertSame($info['sellPrice'], $price->getSellPrice());
         $newSellPrice = number_format($info['sellPrice'] * 0.99, 2, '.', '');
         $price->setSellPrice($newSellPrice);
         $this->assertSame($newSellPrice, $price->getSellPrice());
         $changeData = $client->put('/sku/' . $sku['id'] . '/price', $price->toJson());
         $this->assertHttpStatusCodeSuccess($changeData->getHttpStatusCode());
         $newResponse = $client->get('/sku/' . $sku['id']);
         $newPrice = Factory::factoryPrice($newResponse->getData()->getPrice());
         $this->assertSame($newSellPrice, $newPrice->getSellPrice());
     }
 }
Beispiel #4
0
 public function __construct(array $elements = [])
 {
     parent::__construct($elements);
 }
Beispiel #5
0
 protected function factoryFromStatusResponse(Collection $response)
 {
     $data = ['id' => $response->getSteloId(), 'statusCode' => $response->getSteloStatus()['statusCode'], 'statusMessage' => $response->getSteloStatus()['statusMessage'], 'freight' => $response->getFreight(), 'amount' => $response->getAmount()];
     return new Transaction($data);
 }
Beispiel #6
0
 /**
  * @dataProvider dataProviderInformacao
  */
 public function testPossuiEstruturaDeInformacao($value)
 {
     $collection = new Collection();
     $collection->set('foo', $value);
     $this->assertSame($value, $collection->get('foo'));
 }
Beispiel #7
0
 public function receiveOptions(Collection $options)
 {
     return $this->setOptions(array_merge($this->getDefaultOptions(), $options->toArray()));
 }
Beispiel #8
0
 public function __construct(array $elements = [], array $parameters = null)
 {
     $data = ['method' => $elements[0], 'resource' => $elements[1], 'parameters' => $parameters];
     parent::__construct($data);
 }