Service - Payment Method Manager

From Izara Wiki
Revision as of 05:20, 24 November 2025 by Mint (talk | contribs) (→‎paymentMethod)
Jump to navigation Jump to search

Overview

Each payment method is handled by a Service - Payment Method (handlers) service, with Service - Payment Method Generic taking all new/simple payment methods.

The Payment Method Manager service handles shared orchestration of the Payment Method Handler services.

Repository

https://bitbucket.org/izara-market-products/izara-market-products-payment-method-manager/src/master/

Schemas

paymentMethod

{
  "objectType": "paymentMethod",
  "canDelete": false,
  "storageResources": {
    "graph": {
      "storageType": "graph",
      "graphServerTag": "GraphHandler"
    },
    "dynamoDB": {
      "storageType": "dynamoDB",
      "tableName": "PaymentMethodRecords",
      "serviceTag": "PaymentMethodManager"
    }
  },
  "fieldNames": {
    "paymentMethodId": {
      "type": "string",
      "randomOnCreate": true,
      "requiredOnCreate": false,
      "optionalOnCreate": false,
      "canUpdate": false,
      "storageResourceTags": ["dynamoDB","graph"],
      "validation": {
          "pattern": "^[a-zA-Z0-9-_]+$"}
    },
    "paymentMethodHandlerServiceNameTag": {
      "type": "string",
      "randomOnCreate": false,
      "requiredOnCreate": true,
      "optionalOnCreate": false,
      "canUpdate": false,
      "storageResourceTags": ["dynamoDB"],
      "validation": { "pattern": "^[a-zA-Z0-9-_]+$"}}
    },
    "currencyId": {
      "type": "string",
      "randomOnCreate": false,
      "requiredOnCreate": true,
      "optionalOnCreate": false,
      "canUpdate": false,
      "storageResourceTags": ["dynamoDB"],
      "validation": { "pattern": "^[a-zA-Z0-9-_]+$"}}
    }
  },
  "identifiers": [
    {
      "type": "identifier",
      "fieldName": "paymentMethodId"
    }
  ],
  "generatedBy": "userGenerated"
}

userPaymentMethod

{
  "objectType": "userPaymentMethod",
  "canDelete": false,
  "storageResources": {
    "graph": {
      "storageType": "graph",
      "graphServerTag": "GraphHandler"
    },
    "dynamoDB": {
      "storageType": "dynamoDB",
      "tableName": "UserPaymentMethodsRecords",
      "serviceTag": "PaymentMethodManager"
    }
  },
  "fieldNames": {
    "userPaymentMethodId": {
      "type": "string",
      "randomOnCreate": true,
      "requiredOnCreate": false,
      "optionalOnCreate": false,
      "canUpdate": false,
      "storageResourceTags": [
        "dynamoDB",
        "graph"
      ],
      "validation": {"pattern": "^[a-zA-Z0-9-_]+$"}
    },
    "paymentMethodHandlerServiceNameTag": {
      "type": "string",
      "randomOnCreate": false,
      "requiredOnCreate": true,
      "optionalOnCreate": false,
      "canUpdate": true,
      "storageResourceTags": [
        "dynamoDB"
      ],
      "validation": {"pattern": "^[a-zA-Z0-9-_]+$"}
    }
  },
  "identifiers": [
    {
      "type": "identifier",
      "fieldName": "userPaymentMethodId"
    }
  ],
  "generatedBy": "userGenerated"
}

DynamoDB tables

Standard Config Table Per Service

Configuration tags

{
	configKey: "ProductGraphServiceName"
	configTag: "ProductGraphServiceName"
	configValue: xxx // eg: "ProductGraph"
}
{
	configKey: "PaymentMethodHandlerService"
	configTag: xxx // paymentMethodHandlerServiceNameTag, eg: "PaymentMethodGeneric"
	configValue: {
		serviceName: xxx // eg: "PaymentMethodGeneric", this is the actual deployed service name
	}
}

paymentMethod

Records which Handler manages each payment method

{
	paymentMethodId,
    currencyId,
	paymentMethodHandlerServiceNameTag
}
  • partition key: paymentMethodId
  • sort key: (none)
  • all Handler services are expected to create a paymentMethod node in the shared Products graph

UserPaymentMethods

Records which Handler manages each user payment method

{
	userPaymentMethodId
	paymentMethodHandlerServiceNameTag
}
  • partition key: userPaymentMethodId
  • sort key: (none)
  • all Handler services are expected to create a userPaymentMethod node in the shared Products graph

Complex Filter requests

  • Not yet used at the Manager level, would send requests to all handlers, could perhaps setup to automatically pass on processLogical requests to all handlers, and not have a processLogical function in the Manager service
{
	filterType: "managerPaymentMethod" //unique id is paymentMethodId
	type: "group",
	elements:
	[
		{
			type: "logical",
			logicalTag: "currencyId",
			comparison: "equals",
			value: "xx"
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "paymentMethodProperty",
				// see [[NPM module - Izara Core - Property Node|Complex Filter requests]]
			}
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "paymentMethodNameTranslation" //unique id is paymentMethodId
				type: "group",
				elements: 
				[
					{
						// see [[Service - Translations|Complex Filter requests]]
						type: "logical",
						logicalTag: "textTag_languageId_text",
						resultType: "paymentMethod",
						textTag: "paymentMethodName",
						languageId: "en",
						text: "Is a great term",
						subjectIdentifierPropertyName: "paymentMethodId",
						caseSensitive: true
					},
				]
			}
		},		
		...
	]
}
{
	filterType: "managerUserPaymentMethod" //unique id is userPaymentMethodId
	type: "group",
	elements:
	[
		{
			type: "logical",
			logicalTag: "paymentMethodId",
			comparison: "equals",
			value: "xx"
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "managerPaymentMethod",
				// see above
			}
		},		
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "userPaymentMethodProperty",
				// see [[NPM module - Izara Core - Property Node|Complex Filter requests]]
			}
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "userPaymentMethodSaleProperty",
				// see [[NPM module - Izara Core - Property Node|Complex Filter requests]]
			}
		},
		...
	]
}

Working documents

Payment Method Manager