graycoreio/daffodil

View on GitHub
libs/cart/driver/src/interfaces/cart-payment-methods-service.interface.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Observable } from 'rxjs';

import {
  DaffCartPaymentMethod,
  DaffCart,
} from '@daffodil/cart';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
 * The interface responsible for retrieving the available payment methods of a cart.
 */
export interface DaffCartPaymentMethodsServiceInterface<T extends DaffCartPaymentMethod = DaffCartPaymentMethod> {
  /**
   * List the available payment methods of a cart.
   */
  list(cartId: DaffCart['id']): Observable<T[]>;
}

export const {
  token: DaffCartPaymentMethodsDriver,
  /**
   * Provider function for {@link DaffCartPaymentMethodsDriver}.
   */
  provider: provideDaffCartPaymentMethodsDriver,
} = createSingletonInjectionToken<DaffCartPaymentMethodsServiceInterface>('DaffCartPaymentMethodsDriver');