Skip to content

Commit c457f77

Browse files
authoredOct 14, 2024
feat(customer-payment-authorizenet): create injection tokens with factory (#3244)
1 parent 81aecc5 commit c457f77

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed
 

Diff for: ‎libs/customer-payment-authorizenet/driver/src/interfaces/payment-service.interface.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
import { InjectionToken } from '@angular/core';
21
import { Observable } from 'rxjs';
32

3+
import { createSingleInjectionToken } from '@daffodil/core';
44
import { DaffCustomerPaymentAuthorizeNetApplyRequest } from '@daffodil/customer-payment-authorizenet';
55
import { DaffPaymentResponse } from '@daffodil/payment';
66
import { DaffPaymentDriverInterface } from '@daffodil/payment/driver';
77

8-
/**
9-
* An injection token for the customer authorize.net payment driver.
10-
*/
11-
export const DaffCustomerPaymentAuthorizeNetPaymentDriver = new InjectionToken<DaffCustomerPaymentAuthorizeNetPaymentDriverInterface>('DaffCustomerPaymentAuthorizeNetPaymentDriver');
8+
export const {
9+
/**
10+
* An injection token for the customer authorize.net payment driver.
11+
*/
12+
token: DaffCustomerPaymentAuthorizeNetPaymentDriver,
13+
provider: daffProvideCustomerPaymentAuthorizeNetPaymentDriver,
14+
} = createSingleInjectionToken<DaffCustomerPaymentAuthorizeNetPaymentDriverInterface>('DaffCustomerPaymentAuthorizeNetPaymentDriver');
1215

1316
/**
1417
* @inheritdoc
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import { InjectionToken } from '@angular/core';
2-
1+
import { createSingleInjectionToken } from '@daffodil/core';
32
import { daffTransformErrorToStateError } from '@daffodil/core/state';
43

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

0 commit comments

Comments
 (0)