Skip to content

Commit

Permalink
feat(customer-payment-authorizenet): create injection tokens with fac…
Browse files Browse the repository at this point in the history
…tory (#3244)
  • Loading branch information
griest024 authored Oct 14, 2024
1 parent 81aecc5 commit c457f77
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { InjectionToken } from '@angular/core';
import { Observable } from 'rxjs';

import { createSingleInjectionToken } from '@daffodil/core';
import { DaffCustomerPaymentAuthorizeNetApplyRequest } from '@daffodil/customer-payment-authorizenet';
import { DaffPaymentResponse } from '@daffodil/payment';
import { DaffPaymentDriverInterface } from '@daffodil/payment/driver';

/**
* An injection token for the customer authorize.net payment driver.
*/
export const DaffCustomerPaymentAuthorizeNetPaymentDriver = new InjectionToken<DaffCustomerPaymentAuthorizeNetPaymentDriverInterface>('DaffCustomerPaymentAuthorizeNetPaymentDriver');
export const {
/**
* An injection token for the customer authorize.net payment driver.
*/
token: DaffCustomerPaymentAuthorizeNetPaymentDriver,
provider: daffProvideCustomerPaymentAuthorizeNetPaymentDriver,
} = createSingleInjectionToken<DaffCustomerPaymentAuthorizeNetPaymentDriverInterface>('DaffCustomerPaymentAuthorizeNetPaymentDriver');

/**
* @inheritdoc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { InjectionToken } from '@angular/core';

import { createSingleInjectionToken } from '@daffodil/core';
import { daffTransformErrorToStateError } from '@daffodil/core/state';

/**
* Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
* Can be used to further refine Daffodil errors into more specific app errors.
*/
export const DAFF_CUSTOMER_PAYMENT_AUTHORIZENET_ERROR_MATCHER = new InjectionToken<typeof daffTransformErrorToStateError>(
export const {
/**
* Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
* Can be used to further refine Daffodil errors into more specific app errors.
*/
token: DAFF_CUSTOMER_PAYMENT_AUTHORIZENET_ERROR_MATCHER,
provider: daffProvideCustomerPaymentAuthorizenetErrorMatcher,
} = createSingleInjectionToken<typeof daffTransformErrorToStateError>(
'DAFF_CUSTOMER_PAYMENT_AUTHORIZENET_ERROR_MATCHER',
{ factory: () => daffTransformErrorToStateError },
);
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { DAFF_CUSTOMER_PAYMENT_AUTHORIZENET_ERROR_MATCHER } from './error-matcher.token';
export * from './error-matcher.token';

0 comments on commit c457f77

Please sign in to comment.