All files / platform/modules/booking/src/Services OrderService.js

100% Statements 8/8
100% Branches 0/0
100% Functions 4/4
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32    1x 1x       133x       133x 133x             3x             297x       1x  
'use strict';
 
const Config = use('Config');
const namespace = Config.get('modules.booking.general.namespace');
 
class OrderService {
  static get inject() {
    return [`${namespace}/UseCases/HandleOrderCreatedError`, `${namespace}/UseCases/CreateOrder`];
  }
 
  constructor(handleOrderCreatedErrorUseCase, createOrderUseCase) {
    this._handleOrderCreatedErrorUseCase = handleOrderCreatedErrorUseCase;
    this._createOrderUseCase = createOrderUseCase;
  }
 
  /**
   * @return {void}
   */
  async handleOrderCreatedError(payload) {
    await this._handleOrderCreatedErrorUseCase.execute(payload);
  }
 
  /**
   * @return {Order}
   */
  async createOrder(payload) {
    return this._createOrderUseCase.execute(payload);
  }
}
 
module.exports = OrderService;