示例#1
0
 public function testLogError()
 {
     ob_start();
     \CashWay\Log::error('Coucou');
     $output = ob_get_clean();
     $this->assertStringMatchesFormat('[%s] ERROR: Coucou', $output);
 }
示例#2
0
 /**
  * Fetch remote (CashWay-side) status for this account.
  * FIXME. This returns ALL transactions. We should limit this to those we want.
  *
  * @return array|false
  */
 public static function getRemoteOrderStatus()
 {
     if (!self::isConfiguredService()) {
         \CashWay\Log::error('Service is not configured.');
         return false;
     }
     $cashway = self::getCashWayAPI();
     $orders = $cashway->checkTransactionsForOrders(array());
     if (array_key_exists('errors', $orders)) {
         \CashWay\Log::error(sprintf('Could not access CashWay API: %s', $orders['errors'][0]['code']));
         return false;
     }
     $refs = array_map(function ($el) {
         return $el['shop_order_id'];
     }, $orders['orders']);
     $orders = array_combine($refs, array_values($orders['orders']));
     return $orders;
 }