@daffodil/payment 0.0.0-PLACEHOLDER

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/.eslintrc.js +52 -0
  2. package/README.md +11 -0
  3. package/driver/in-memory/ng-package.json +8 -0
  4. package/driver/in-memory/package.json +3 -0
  5. package/driver/in-memory/src/backend/payment.service.spec.ts +68 -0
  6. package/driver/in-memory/src/backend/payment.service.ts +55 -0
  7. package/driver/in-memory/src/driver/payment-driver.module.ts +33 -0
  8. package/driver/in-memory/src/driver/payment.service.spec.ts +70 -0
  9. package/driver/in-memory/src/driver/payment.service.ts +32 -0
  10. package/driver/in-memory/src/index.ts +1 -0
  11. package/driver/in-memory/src/public_api.ts +3 -0
  12. package/driver/ng-package.json +8 -0
  13. package/driver/package.json +3 -0
  14. package/driver/src/errors/invalid-api-response.ts +17 -0
  15. package/driver/src/errors/map.ts +11 -0
  16. package/driver/src/errors/public_api.ts +5 -0
  17. package/driver/src/index.ts +1 -0
  18. package/driver/src/interfaces/payment-service.interface.ts +24 -0
  19. package/driver/src/public_api.ts +6 -0
  20. package/driver/testing/ng-package.json +8 -0
  21. package/driver/testing/package.json +3 -0
  22. package/driver/testing/src/drivers/payment-driver.module.ts +31 -0
  23. package/driver/testing/src/drivers/payment.service.spec.ts +33 -0
  24. package/driver/testing/src/drivers/payment.service.ts +32 -0
  25. package/driver/testing/src/drivers/public_api.ts +2 -0
  26. package/driver/testing/src/index.ts +1 -0
  27. package/driver/testing/src/public_api.ts +1 -0
  28. package/karma.conf.js +11 -0
  29. package/ng-package.json +7 -0
  30. package/ng-package.prod.json +7 -0
  31. package/package.json +41 -0
  32. package/src/index.ts +1 -0
  33. package/src/injection-tokens/error-matcher.token.ts +12 -0
  34. package/src/injection-tokens/public_api.ts +1 -0
  35. package/src/models/public_api.ts +2 -0
  36. package/src/models/request.type.ts +13 -0
  37. package/src/models/response.type.ts +14 -0
  38. package/src/public_api.ts +2 -0
  39. package/state/ng-package.json +8 -0
  40. package/state/package.json +3 -0
  41. package/state/src/actions/payment.actions.ts +56 -0
  42. package/state/src/facades/payment/facade.spec.ts +70 -0
  43. package/state/src/facades/payment/facade.ts +43 -0
  44. package/state/src/facades/payment/interface.ts +21 -0
  45. package/state/src/facades/public_api.ts +2 -0
  46. package/state/src/index.ts +1 -0
  47. package/state/src/injection-tokens/available-processors.token.ts +29 -0
  48. package/state/src/injection-tokens/processor-collection.token.ts +22 -0
  49. package/state/src/injection-tokens/public_api.ts +5 -0
  50. package/state/src/models/available-processor.type.ts +23 -0
  51. package/state/src/models/processor-collection.type.ts +6 -0
  52. package/state/src/models/public_api.ts +2 -0
  53. package/state/src/payment.module.ts +15 -0
  54. package/state/src/public_api.ts +8 -0
  55. package/state/src/reducers/payment/adapter.spec.ts +89 -0
  56. package/state/src/reducers/payment/adapter.ts +46 -0
  57. package/state/src/reducers/payment/initial-state.ts +9 -0
  58. package/state/src/reducers/payment/interface.ts +16 -0
  59. package/state/src/reducers/payment/public_api.ts +4 -0
  60. package/state/src/reducers/payment/reducer.ts +35 -0
  61. package/state/src/reducers/public_api.ts +8 -0
  62. package/state/src/reducers/reducers.interface.ts +16 -0
  63. package/state/src/reducers/store-feature-key.ts +4 -0
  64. package/state/src/reducers/token/extra.token.spec.ts +35 -0
  65. package/state/src/reducers/token/extra.token.ts +42 -0
  66. package/state/src/reducers/token/public_api.ts +4 -0
  67. package/state/src/reducers/token/reducers.token.spec.ts +60 -0
  68. package/state/src/reducers/token/reducers.token.ts +36 -0
  69. package/state/src/selectors/feature.selector.ts +25 -0
  70. package/state/src/selectors/payment.selector.spec.ts +64 -0
  71. package/state/src/selectors/payment.selector.ts +57 -0
  72. package/state/src/selectors/public_api.ts +1 -0
  73. package/state/testing/ng-package.json +8 -0
  74. package/state/testing/package.json +3 -0
  75. package/state/testing/src/index.ts +1 -0
  76. package/state/testing/src/mock-payment-facade.ts +19 -0
  77. package/state/testing/src/payment-testing.module.ts +15 -0
  78. package/state/testing/src/public_api.ts +2 -0
  79. package/test.ts +23 -0
  80. package/testing/ng-package.json +8 -0
  81. package/testing/package.json +3 -0
  82. package/testing/src/factories/kind.factory.spec.ts +57 -0
  83. package/testing/src/factories/kind.factory.ts +37 -0
  84. package/testing/src/factories/payment-request.factory.spec.ts +37 -0
  85. package/testing/src/factories/payment-request.factory.ts +24 -0
  86. package/testing/src/factories/payment-response.factory.spec.ts +37 -0
  87. package/testing/src/factories/payment-response.factory.ts +24 -0
  88. package/testing/src/factories/public_api.ts +3 -0
  89. package/testing/src/index.ts +1 -0
  90. package/testing/src/injection-tokens/factories/kind.token.spec.ts +51 -0
  91. package/testing/src/injection-tokens/factories/kind.token.ts +43 -0
  92. package/testing/src/injection-tokens/public_api.ts +4 -0
  93. package/testing/src/public_api.ts +4 -0
  94. package/testing/src/testing.module.ts +18 -0
  95. package/tsconfig.json +32 -0
  96. package/tsconfig.lib.json +28 -0
  97. package/tsconfig.lib.prod.json +9 -0
  98. package/tsconfig.spec.json +17 -0
@@ -0,0 +1,43 @@
1
+ import {
2
+ inject,
3
+ InjectionToken,
4
+ Provider,
5
+ Type,
6
+ } from '@angular/core';
7
+
8
+ import { DaffModelFactory } from '@daffodil/core/testing';
9
+ import { DaffPaymentResponse } from '@daffodil/payment';
10
+
11
+ import { DaffPaymentResponseFactory } from '../../factories/payment-response.factory';
12
+
13
+ /**
14
+ * A multi-provider injection token for providing extra payment result kind factories.
15
+ * These factories correspond to different types of payment results that may be added by other packages.
16
+ * This is useful for backend mocks (such as the testing driver) to generate an accurate representation
17
+ * of the variety of results that an application can receive in production.
18
+ */
19
+ export const DAFF_PAYMENT_RESPONSE_KIND_FACTORIES = new InjectionToken<DaffModelFactory<DaffPaymentResponse>[]>(
20
+ 'DAFF_PAYMENT_RESPONSE_KIND_FACTORIES',
21
+ { factory: () => [inject(DaffPaymentResponseFactory)], providedIn: 'root' },
22
+ );
23
+
24
+ /**
25
+ * Provides extra payment result factory kinds.
26
+ *
27
+ * See {@link DAFF_PAYMENT_RESPONSE_KIND_FACTORIES}.
28
+ *
29
+ * ```ts
30
+ * providers: [
31
+ * ...daffProvidePaymentResponseKindFactories(
32
+ * MyPaymentResponseFactory
33
+ * )
34
+ * ]
35
+ * ```
36
+ */
37
+ export function daffProvidePaymentResponseKindFactories<T extends DaffPaymentResponse = DaffPaymentResponse>(...factoryTypes: Type<DaffModelFactory<T>>[]): Provider[] {
38
+ return factoryTypes.map(factoryType => ({
39
+ provide: DAFF_PAYMENT_RESPONSE_KIND_FACTORIES,
40
+ useExisting: factoryType,
41
+ multi: true,
42
+ }));
43
+ }
@@ -0,0 +1,4 @@
1
+ export {
2
+ DAFF_PAYMENT_RESPONSE_KIND_FACTORIES,
3
+ daffProvidePaymentResponseKindFactories,
4
+ } from './factories/kind.token';
@@ -0,0 +1,4 @@
1
+ export * from './factories/public_api';
2
+ export * from './injection-tokens/public_api';
3
+
4
+ export { DaffPaymentTestingModule } from './testing.module';
@@ -0,0 +1,18 @@
1
+ import { NgModule } from '@angular/core';
2
+
3
+ import { DaffPaymentResponseFactory } from './factories/public_api';
4
+ import { DAFF_PAYMENT_RESPONSE_KIND_FACTORIES } from './injection-tokens/public_api';
5
+
6
+ /**
7
+ * Provides the default payment result factory as a payment result type factory.
8
+ */
9
+ @NgModule({
10
+ providers: [
11
+ {
12
+ provide: DAFF_PAYMENT_RESPONSE_KIND_FACTORIES,
13
+ useExisting: DaffPaymentResponseFactory,
14
+ multi: true,
15
+ },
16
+ ],
17
+ })
18
+ export class DaffPaymentTestingModule { }
package/tsconfig.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "../..",
5
+ "paths": {
6
+ "@daffodil/*": [
7
+ "dist/*"
8
+ ],
9
+ "@daffodil/payment": [
10
+ "libs/payment/src"
11
+ ],
12
+ "@daffodil/payment/testing": [
13
+ "libs/payment/testing/src"
14
+ ],
15
+ "@daffodil/payment/state": [
16
+ "libs/payment/state/src"
17
+ ],
18
+ "@daffodil/payment/state/testing": [
19
+ "libs/payment/state/testing/src"
20
+ ],
21
+ "@daffodil/payment/driver": [
22
+ "libs/payment/driver/src"
23
+ ],
24
+ "@daffodil/payment/driver/in-memory": [
25
+ "libs/payment/driver/in-memory/src"
26
+ ],
27
+ "@daffodil/payment/driver/testing": [
28
+ "libs/payment/driver/testing/src"
29
+ ],
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../out-tsc/lib",
5
+ "declarationMap": true,
6
+ "moduleResolution": "node",
7
+ "declaration": true,
8
+ "sourceMap": true,
9
+ "inlineSources": true,
10
+ "emitDecoratorMetadata": true,
11
+ "experimentalDecorators": true,
12
+ "importHelpers": true,
13
+ "types": [],
14
+ },
15
+ "angularCompilerOptions": {
16
+ "annotateForClosureCompiler": true,
17
+ "skipTemplateCodegen": true,
18
+ "strictMetadataEmit": true,
19
+ "fullTemplateTypeCheck": true,
20
+ "strictInjectionParameters": true,
21
+ "flatModuleId": "AUTOGENERATED",
22
+ "flatModuleOutFile": "AUTOGENERATED"
23
+ },
24
+ "exclude": [
25
+ "./test.ts",
26
+ "**/*.spec.ts"
27
+ ]
28
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.lib.json",
3
+ "compilerOptions": {
4
+ "declarationMap": false
5
+ },
6
+ "angularCompilerOptions": {
7
+ "compilationMode": "partial"
8
+ }
9
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../out-tsc/spec",
5
+ "types": [
6
+ "jasmine",
7
+ "node"
8
+ ]
9
+ },
10
+ "files": [
11
+ "./test.ts"
12
+ ],
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.d.ts"
16
+ ]
17
+ }