Exemple #1
0
 /**
  * @dataProvider receiveDataProvider
  *
  * @param array $parameters
  * @param array $response
  *
  * @throws ServiceException
  * @throws UndefinedCallbackException
  */
 public function testProcessDataInterface($parameters, $response)
 {
     $orderCancel = \Mockery::mock('\\Hcapi\\Interfaces\\IShopImplementation');
     $orderCancel->shouldReceive('getResponse')->with($parameters)->once()->andReturn($response);
     $service = new OrderCancel();
     $this->assertNotNull($service->processData($orderCancel, $parameters));
 }
Exemple #2
0
 /**
  * @return array|null
  * @throws \Hcapi\Services\ServiceException
  * @throws \Hcapi\Services\UndefinedCallbackException
  */
 function listenRouteCallbackExample()
 {
     /**
      * Specific url required by Heureka
      */
     $routeUrl = $_SERVER['REQUEST_URI'];
     /**
      * Data received from Heureka
      */
     $receiveData = $_POST;
     if ($routeUrl === '/api/1/products/availability') {
         $service = new ProductsAvailability();
         return $service->processData(['Example\\CallableExample\\ProductsAvailability', 'getActualData'], $receiveData);
     }
     if ($routeUrl === '/api/1/payment/delivery') {
         $service = new PaymentDelivery();
         return $service->processData(['Example\\CallableExample\\PaymentDelivery', 'getTransportsPayments'], $receiveData);
     }
     if ($routeUrl === '/api/1/order/status') {
         $service = new OrderStatus();
         return $service->processData(['Example\\CallableExample\\OrderStatus', 'checkStatus'], $receiveData);
     }
     if ($routeUrl === '/api/1/order/send') {
         $service = new OrderSend();
         return $service->processData(['Example\\CallableExample\\OrderSend', 'processOrder'], $receiveData);
     }
     if ($routeUrl === '/api/1/order/cancel') {
         $service = new OrderCancel();
         return $service->processData(['Example\\CallableExample\\OrderCancel', 'cancelOrder'], $receiveData);
     }
     if ($routeUrl === '/api/1/payment/status') {
         $service = new PaymentStatus();
         return $service->processData(['Example\\CallableExample\\PaymentStatus', 'setPaymentStatus'], $receiveData);
     }
     return null;
 }