-
Notifications
You must be signed in to change notification settings - Fork 20
/
enum.js
143 lines (130 loc) · 4.07 KB
/
enum.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/
'use strict'
/**
* @module src/lib/enum.js
*/
// Code specific (non-DB) enumerations sorted alphabetically
const transferEventType = {
PREPARE: 'prepare',
POSITION: 'position',
TRANSFER: 'transfer',
FULFIL: 'fulfil',
NOTIFICATION: 'notification',
ADMIN: 'admin',
GET: 'get'
}
const notificationActionMap = {
NET_DEBIT_CAP_THRESHOLD_BREACH_EMAIL: {
enum: 'NET_DEBIT_CAP_THRESHOLD_BREACH_EMAIL',
action: 'sendEmail',
templateType: 'breach',
language: 'en'
},
NET_DEBIT_CAP_ADJUSTMENT_EMAIL: {
enum: 'NET_DEBIT_CAP_ADJUSTMENT_EMAIL',
action: 'sendEmail',
templateType: 'adjustment',
language: 'en'
},
SETTLEMENT_TRANSFER_POSITION_CHANGE_EMAIL: {
enum: 'SETTLEMENT_TRANSFER_POSITION_CHANGE_EMAIL',
action: 'sendEmail',
templateType: 'position',
language: 'en'
}
}
const limitNotificationMap = {
NET_DEBIT_CAP: {
enum: 'NET_DEBIT_CAP',
NET_DEBIT_CAP_THRESHOLD_BREACH_EMAIL: notificationActionMap.NET_DEBIT_CAP_THRESHOLD_BREACH_EMAIL,
NET_DEBIT_CAP_ADJUSTMENT_EMAIL: notificationActionMap.NET_DEBIT_CAP_ADJUSTMENT_EMAIL
}
}
const transferEventAction = {
PREPARE: 'prepare',
PREPARE_DUPLICATE: 'prepare-duplicate',
TRANSFER: 'transfer',
COMMIT: 'commit',
ABORT: 'abort',
TIMEOUT_RECEIVED: 'timeout-received',
TIMEOUT_RESERVED: 'timeout-reserved',
REJECT: 'reject',
FAIL: 'fail',
EVENT: 'event',
FULFIL: 'fulfil'
}
const headers = {
FSPIOP: {
SWITCH: 'central-switch'
}
}
const topicMap = {
notification: {
prepare: {
functionality: transferEventType.NOTIFICATION,
action: transferEventAction.EVENT
},
'prepare-duplicate': {
functionality: transferEventType.NOTIFICATION,
action: transferEventAction.EVENT
},
commit: {
functionality: transferEventType.NOTIFICATION,
action: transferEventAction.EVENT
},
abort: {
functionality: transferEventType.NOTIFICATION,
action: transferEventAction.EVENT
},
'timeout-received': {
functionality: transferEventType.NOTIFICATION,
action: transferEventAction.EVENT
},
reject: {
functionality: transferEventType.NOTIFICATION,
action: transferEventAction.EVENT
},
get: {
functionality: transferEventType.NOTIFICATION,
action: transferEventAction.EVENT
},
'email-notifier': {
functionality: transferEventType.NOTIFICATION,
action: transferEventAction.EVENT
},
'settlement-transfer-position-change': {
functionality: transferEventType.NOTIFICATION,
action: transferEventAction.EVENT
}
}
}
module.exports = {
transferEventType,
transferEventAction,
headers,
topicMap,
limitNotificationMap,
notificationActionMap
}