Service - Payment Method Generic: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Overview = | = Overview = | ||
Handler service for | Handler service for generic payment methods that give text instruction to buyer at completion of sale. userPaymentMethod is also handled by each Payment Method Handler because there will be unique settings depending on the Payment Method. | ||
= Repository = | = Repository = | ||
Line 45: | Line 45: | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
nodeLabel: "{ | nodeLabel: "{PaymentMethodManagerLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}", // "paymentMethod" | ||
schema: { | schema: { | ||
identifier: true, | identifier: true, | ||
Line 54: | Line 54: | ||
identifier: true, // create unique id from translation | identifier: true, // create unique id from translation | ||
}, | }, | ||
currencyId: { | |||
immutable: true, | immutable: true, // currently not have data model for allowing this to be changed, is immutable | ||
}, | }, | ||
}, | }, | ||
Line 64: | Line 64: | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
nodeLabel: "{ | nodeLabel: "{PaymentMethodManagerLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}", // "userPaymentMethod" | ||
schema: { | schema: { | ||
identifier: true, | identifier: true, | ||
Line 73: | Line 73: | ||
identifier: true, // create unique id from user and uniqueMessageId | identifier: true, // create unique id from user and uniqueMessageId | ||
}, | }, | ||
paymentMethodId: { // stored here to reduce queries finding matching methods, eg sellOffers | |||
immutable: true, | immutable: true, | ||
}, | }, | ||
userPaymentMethodTag: { // users reference name for this userPaymentMethod | |||
}, | }, | ||
}, | }, | ||
Line 84: | Line 83: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* adds a node between a user and a payment method | * adds a node between a user and a payment method | ||
* this is the node linked to by | * this is the node linked to by sellOfferPlans | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
Line 92: | Line 91: | ||
{ | { | ||
nodeLabel: "{PaymentMethodGenericLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}Property", | nodeLabel: "{PaymentMethodGenericLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}Property", | ||
} | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
nodeLabel: "{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}PropertyLabel", | |||
} | |||
{ | |||
nodeLabel: "{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}Property", | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
nodeLabel: "{PaymentMethodGenericLib. | nodeLabel: "{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}PropertyLabel", // userPaymentMethodSalePropertyLabel | ||
} | } | ||
{ | { | ||
nodeLabel: "{PaymentMethodGenericLib. | nodeLabel: "{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}Property", | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]] | * see [[NPM module - Izara Core - Property Node|DataSchemaLib]] | ||
* two sets of property nodes, one for presentation properties (when browsing), paymentMethodSale for after sale, properties that get sent to the buyer, eg bank account number | * two sets of property nodes for userPaymentMethod, one for presentation properties (when browsing), paymentMethodSale for after sale, properties that get sent to the buyer, eg bank account number | ||
=== Relationships === | === Relationships === | ||
Line 109: | Line 117: | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
relationshipType: "{ | relationshipType: "{PaymentMethodManagerLib.createIsPaymentMethodGraphRelationshipType()}", // "is_paymentMethod" | ||
schema: { | schema: { | ||
elementCanBeRemoved: false, | elementCanBeRemoved: false, | ||
Line 122: | Line 130: | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
relationshipType: "{ | relationshipType: "{PaymentMethodManagerLib.createIsUserPaymentMethodGraphRelationshipType()}", // "is_userPaymentMethod" | ||
schema: { | schema: { | ||
elementCanBeRemoved: false, | elementCanBeRemoved: false, | ||
Line 133: | Line 141: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* not setup logic to disable userPaymentMethods at this time | |||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
Line 145: | Line 154: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
relationshipType: "has_{PaymentMethodGenericLib. | relationshipType: "has_{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}Property", | ||
} | } | ||
{ | { | ||
relationshipType: "disabled_{PaymentMethodGenericLib. | relationshipType: "disabled_{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}Property", | ||
} | } | ||
{ | { | ||
relationshipType: "is_{PaymentMethodGenericLib. | relationshipType: "is_{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}PropertyLabel", | ||
} | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
relationshipType: "has_{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}Property", | |||
} | |||
{ | |||
relationshipType: "disabled_{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}Property", | |||
} | |||
{ | |||
relationshipType: "is_{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}PropertyLabel", | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 191: | Line 212: | ||
# paymentMethodSaleProperty | # paymentMethodSaleProperty | ||
#* [[Service - Translations Graph]] | #* [[Service - Translations Graph]] | ||
= Complex Filter requests = | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
filterType: "handlerPaymentMethod" //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 | |||
}, | |||
] | |||
} | |||
}, | |||
... | |||
] | |||
} | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
filterType: "handlerUserPaymentMethod" //unique id is userPaymentMethodId | |||
type: "group", | |||
elements: | |||
[ | |||
{ | |||
type: "logical", | |||
logicalTag: "paymentMethodId", | |||
comparison: "equals", | |||
value: "xx" | |||
}, | |||
{ | |||
type: "complexFilter", | |||
complexFilter: { | |||
filterType: "paymentMethod", | |||
// 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]] | |||
} | |||
}, | |||
... | |||
] | |||
} | |||
</syntaxhighlight> | |||
= Data structure notes = | = Data structure notes = |
Latest revision as of 03:22, 13 April 2023
Overview
Handler service for generic payment methods that give text instruction to buyer at completion of sale. userPaymentMethod is also handled by each Payment Method Handler because there will be unique settings depending on the Payment Method.
Repository
https://bitbucket.org/izara-market-products/izara-market-products-payment-method-generic/src/master/
DynamoDB tables
Standard Config Table Per Service
Configuration tags
{
configTag: "PaymentMethodHandlerServiceNameTag"
configKey: "PaymentMethodHandlerServiceNameTag"
configValue: xxx // this own services ServiceNameTag, eg "PaymentMethodGeneric"
}
{
configTag: "ProductGraphServiceName"
configKey: "ProductGraphServiceName"
configValue: xxx // eg: "ProductGraph"
}
{
configTag: "PaymentMethodManagerServiceName"
configKey: "PaymentMethodManagerServiceName"
configValue: xxx // eg: "PaymentMethodManager"
}
Graph database
Service - Products Graph
Nodes
{
nodeLabel: "{PaymentMethodManagerLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}", // "paymentMethod"
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
paymentMethodId: {
identifier: true, // create unique id from translation
},
currencyId: {
immutable: true, // currently not have data model for allowing this to be changed, is immutable
},
},
}
}
{
nodeLabel: "{PaymentMethodManagerLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}", // "userPaymentMethod"
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
userPaymentMethodId: {
identifier: true, // create unique id from user and uniqueMessageId
},
paymentMethodId: { // stored here to reduce queries finding matching methods, eg sellOffers
immutable: true,
},
userPaymentMethodTag: { // users reference name for this userPaymentMethod
},
},
}
}
- adds a node between a user and a payment method
- this is the node linked to by sellOfferPlans
{
nodeLabel: "{PaymentMethodGenericLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}
{
nodeLabel: "{PaymentMethodGenericLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}Property",
}
{
nodeLabel: "{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}
{
nodeLabel: "{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}Property",
}
{
nodeLabel: "{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}PropertyLabel", // userPaymentMethodSalePropertyLabel
}
{
nodeLabel: "{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}Property",
}
- see DataSchemaLib
- two sets of property nodes for userPaymentMethod, one for presentation properties (when browsing), paymentMethodSale for after sale, properties that get sent to the buyer, eg bank account number
Relationships
{
relationshipType: "{PaymentMethodManagerLib.createIsPaymentMethodGraphRelationshipType()}", // "is_paymentMethod"
schema: {
elementCanBeRemoved: false,
allPropertiesImmutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
}
}
{
relationshipType: "{PaymentMethodManagerLib.createIsUserPaymentMethodGraphRelationshipType()}", // "is_userPaymentMethod"
schema: {
elementCanBeRemoved: false,
allPropertiesImmutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
}
}
- not setup logic to disable userPaymentMethods at this time
{
relationshipType: "has_{PaymentMethodGenericLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}Property",
}
{
relationshipType: "disabled_{PaymentMethodGenericLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}Property",
}
{
relationshipType: "is_{PaymentMethodGenericLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}
{
relationshipType: "has_{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}Property",
}
{
relationshipType: "disabled_{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}Property",
}
{
relationshipType: "is_{PaymentMethodGenericLib.USERPAYMENTMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}
{
relationshipType: "has_{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}Property",
}
{
relationshipType: "disabled_{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}Property",
}
{
relationshipType: "is_{PaymentMethodGenericLib.USERPAYMENTMETHOD_SALE_PROPERTIES_GRAPH_TAG}PropertyLabel",
}
- see DataSchemaLib
Basic node schemas
{
nodeLabel: "{PaymentMethodGenericLib.PAYMENTMETHOD_GRAPH_NODE_LABEL}", // "paymentMethod"
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
paymentMethodId: {
identifier: true,
},
paymentMethodHandlerServiceNameTag: {
immutable: true,
},
},
}
}
Schema comes from BasicNodeSchemaLib
- paymentMethodPropertyLabel
- paymentMethodProperty
- paymentMethodSalePropertyLabel
- paymentMethodSaleProperty
Complex Filter requests
{
filterType: "handlerPaymentMethod" //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: "handlerUserPaymentMethod" //unique id is userPaymentMethodId
type: "group",
elements:
[
{
type: "logical",
logicalTag: "paymentMethodId",
comparison: "equals",
value: "xx"
},
{
type: "complexFilter",
complexFilter: {
filterType: "paymentMethod",
// 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]]
}
},
...
]
}
Data structure notes
- Users can create new paymentMethods which are uniquely identified by their translation
- Users can create userPaymentMethod nodes for their account which connect to paymentMethods, one user can have multiple userPaymentMethod links to the same paymentMethod, eg different Bank Transfer nodes for different bank accounts, which can be applied to sell offers in any combination