account-lookup-service 15.6.0-snapshot.4 → 16.1.0-iso.1
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.
- package/CHANGELOG.md +25 -0
- package/LICENSE.md +3 -4
- package/README.md +2 -0
- package/audit-ci.jsonc +2 -27
- package/config/default.json +1 -0
- package/docker/mock-proxy/README.md +21 -0
- package/docker/mock-proxy/src/config.ts +7 -0
- package/docs/Proxy/Discovery.md +20 -0
- package/docs/Proxy/FXAPI_POC_payer_conversion_RECEIVE.plantuml +577 -0
- package/docs/Proxy/FXAPI_POC_payer_conversion_SEND.plantuml +1423 -0
- package/docs/Proxy/P2P.md +11 -0
- package/docs/Proxy/Proxy pattern - Happy path.plantuml +98 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery - No Oracles.plantuml +105 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery - No Oracles.png +0 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery - Oracles.plantuml +130 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery - Oracles.png +0 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery Identifier Cache Invalid.plantuml +72 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery Identifier Cache Invalid.png +0 -0
- package/docs/Proxy/Proxy pattern - P2P.plantuml +186 -0
- package/docs/Proxy/Proxy pattern - P2P.png +0 -0
- package/docs/Proxy/Proxy pattern - Unhappy path.plantuml +103 -0
- package/docs/Proxy/Proxy pattern - Unhappy path.png +0 -0
- package/docs/Proxy/Proxy pattern - happy path.png +0 -0
- package/docs/Proxy/Readme.md +39 -0
- package/docs/Proxy/SettingUpProxys.plantuml +31 -0
- package/docs/Proxy/SettingUpProxys.png +0 -0
- package/package.json +33 -18
- package/src/constants.js +1 -1
- package/src/domain/oracle/oracle.js +63 -4
- package/src/domain/participants/participants.js +246 -129
- package/src/domain/parties/getPartiesByTypeAndID.js +29 -8
- package/src/domain/parties/parties.js +33 -4
- package/src/domain/timeout/index.js +12 -1
- package/src/handlers/monitoring/index.js +1 -1
- package/src/interface/api-swagger-iso20022-parties.yaml +7 -6
- package/src/interface/api-swagger.yaml +7 -6
- package/src/lib/config.js +2 -1
- package/src/lib/db.js +2 -1
- package/src/models/currency/currency.js +10 -1
- package/src/models/endpointType/endpointType.js +10 -1
- package/src/models/oracle/facade.js +42 -16
- package/src/models/oracle/oracleEndpoint.js +65 -10
- package/src/models/oracle/oracleEndpointCached.js +29 -9
- package/src/models/participantEndpoint/facade.js +40 -4
- package/src/models/partyIdType/partyIdType.js +10 -1
- package/src/plugins.js +8 -21
- package/src/server.js +11 -0
- package/test/fixtures/index.js +29 -6
- package/test/unit/api/health.test.js +3 -0
- package/test/unit/api/participants/participants.test.js +5 -7
- package/test/unit/api/participants/{Type}/{ID}/{SubId}.test.js +0 -3
- package/test/unit/api/participants/{Type}/{ID}.test.js +0 -3
- package/test/unit/api/participants.test.js +36 -3
- package/test/unit/domain/oracle/oracle.test.js +8 -0
- package/test/unit/domain/participants/participants.test.js +83 -48
- package/test/unit/domain/parties/parties.test.js +10 -2
- package/test/unit/domain/timeout/index.test.js +8 -0
- package/test/unit/lib/config.test.js +7 -0
- package/test/unit/mocks.js +16 -11
- package/test/unit/models/oracle/oracleEndpointCached.test.js +32 -0
- package/test/unit/models/participantEndpoint/facade.test.js +4 -2
- package/test/unit/plugins.test.js +2 -2
- package/src/lib/requestLogger.js +0 -54
- package/src/metrics/handler.js +0 -33
- package/src/metrics/plugin.js +0 -52
- package/src/metrics/routes.js +0 -43
- package/test/unit/lib/requestLogger.test.js +0 -115
@@ -0,0 +1,577 @@
|
|
1
|
+
@startuml
|
2
|
+
|
3
|
+
!$simplified = false
|
4
|
+
!$shortCutSingleFXP = true
|
5
|
+
!$hideSwitchDetail = false
|
6
|
+
!$senderName = "Keeya"
|
7
|
+
!$receiverName = "Yaro"
|
8
|
+
!$payerCurrency = "BWP"
|
9
|
+
!$payeeCurrency = "TZS"
|
10
|
+
!$payerFSPID = "PayerFSP"
|
11
|
+
!$payeeFSPID = "PayeeFSP"
|
12
|
+
!$payerMSISDN = "26787654321"
|
13
|
+
!$payeeMSISDN = "2551234567890"
|
14
|
+
!$payeeReceiveAmount = "50000"
|
15
|
+
!$payeeFee = "4000"
|
16
|
+
!$targetAmount = "54000"
|
17
|
+
!$fxpChargesSource = "33"
|
18
|
+
!$fxpChargesTarget = "6000"
|
19
|
+
!$fxpSourceAmount = "330"
|
20
|
+
!$fxpTargetAmount = "54000"
|
21
|
+
!$totalChargesSourceCurrency = "55"
|
22
|
+
|
23
|
+
|
24
|
+
title Remittance Transfer using Mojaloop FX APIs POC\nPayer DFSP requests conversion with RECEIVE amount
|
25
|
+
actor "$senderName" as A1
|
26
|
+
box "Payer DFSP" #LightBlue
|
27
|
+
participant "Payer CBS" as PayerCBS
|
28
|
+
participant "Payer\nMojaloop\nConnector" as D1
|
29
|
+
end box
|
30
|
+
|
31
|
+
participant "Mojaloop Switch" as S1
|
32
|
+
|
33
|
+
box "Discovery Service" #LightYellow
|
34
|
+
participant "ALS Oracle" as ALS
|
35
|
+
end box
|
36
|
+
|
37
|
+
box "FX provider"
|
38
|
+
participant "FXP\nConnector" as FXP
|
39
|
+
participant "Backend FX API" as FXPBackend
|
40
|
+
end box
|
41
|
+
|
42
|
+
box "Payee DFSP" #LightBlue
|
43
|
+
participant "Payee\nMojaloop\nConnector" as D2
|
44
|
+
participant "Payee CBS" as PayeeCBS
|
45
|
+
end box
|
46
|
+
|
47
|
+
actor "$receiverName" as A2
|
48
|
+
autonumber
|
49
|
+
|
50
|
+
A1->PayerCBS:I'd like to pay $receiverName\n$payeeReceiveAmount $payeeCurrency for his latest book, please
|
51
|
+
PayerCBS->D1: Initiate remittance transfer
|
52
|
+
== Discovery Phase ==
|
53
|
+
activate D1
|
54
|
+
D1->>S1:I want to send to MSISDN $payeeMSISDN\n**GET /parties/MSISDN/$payeeMSISDN**
|
55
|
+
activate S1
|
56
|
+
!if ($simplified != true)
|
57
|
+
S1-->>D1:202 I'll get back to you
|
58
|
+
!endif
|
59
|
+
deactivate D1
|
60
|
+
S1->ALS:Who owns MSISDN $payeeMSISDN?
|
61
|
+
activate ALS
|
62
|
+
ALS-->S1:It's $payeeFSPID
|
63
|
+
deactivate ALS
|
64
|
+
S1->>D2:Do you own MSISDN $payeeMSISDN?
|
65
|
+
activate D2
|
66
|
+
!if ($simplified != true)
|
67
|
+
D2-->>S1:202 I'll get back to you
|
68
|
+
!endif
|
69
|
+
D2->D2: Check Sanction list status & trigger a refresh of the status
|
70
|
+
D2->PayeeCBS: Check account and get currency type
|
71
|
+
!if ($simplified != true)
|
72
|
+
PayeeCBS-->D2: Result
|
73
|
+
!endif
|
74
|
+
deactivate S1
|
75
|
+
D2->>S1:Yes, it's $receiverName. He can receive in $payeeCurrency\n**PUT /parties/MSISDN/$payeeMSISDN**
|
76
|
+
!if ($simplified != true)
|
77
|
+
note over D2
|
78
|
+
PUT /parties
|
79
|
+
|
80
|
+
"party": {
|
81
|
+
"partyIdInfo": {
|
82
|
+
"partyIdType": "MSISDN",
|
83
|
+
"partyIdentifier": "$payeeMSISDN"
|
84
|
+
},
|
85
|
+
"name": "$receiverName",
|
86
|
+
"supportedCurrencies":[
|
87
|
+
"$payeeCurrency"
|
88
|
+
],
|
89
|
+
"kycInformation": "<Encrypted KYC Data>"
|
90
|
+
}
|
91
|
+
end note
|
92
|
+
!else
|
93
|
+
note over D2
|
94
|
+
Payee Info with Encrypted KYC Data
|
95
|
+
end note
|
96
|
+
!endif
|
97
|
+
activate S1
|
98
|
+
!if ($simplified != true)
|
99
|
+
S1-->>D2:200 Gotcha
|
100
|
+
!endif
|
101
|
+
deactivate D2
|
102
|
+
S1->>D1:Yes, it's $receiverName. He can receive in $payeeCurrency\n**PUT /parties/MSISDN/$payeeMSISDN**
|
103
|
+
activate D1
|
104
|
+
!if ($simplified != true)
|
105
|
+
D1-->>S1:200 Gotcha
|
106
|
+
!endif
|
107
|
+
deactivate S1
|
108
|
+
|
109
|
+
!if ($shortCutSingleFXP != true)
|
110
|
+
== Get FX providers ==
|
111
|
+
|
112
|
+
D1->D1:Hmmm. I can only send in $payerCurrency.\nI need to get some currency conversion
|
113
|
+
|
114
|
+
D1->>S1:What FXPs do you know about?\n**GET /services/FXP**
|
115
|
+
activate S1
|
116
|
+
!if ($simplified != true)
|
117
|
+
S1-->>D1:202 I'll get back to you
|
118
|
+
!endif
|
119
|
+
deactivate D1
|
120
|
+
S1->ALS:What FXPs do you know about?
|
121
|
+
activate ALS
|
122
|
+
ALS-->S1:FDH FX
|
123
|
+
deactivate ALS
|
124
|
+
S1->>D1:Here are the available FXPs:FDH FX
|
125
|
+
note over S1
|
126
|
+
PUT /services/FXP
|
127
|
+
|
128
|
+
"fxpProviders": [
|
129
|
+
"FDH_FX"
|
130
|
+
]
|
131
|
+
end note
|
132
|
+
activate D1
|
133
|
+
!if ($simplified != true)
|
134
|
+
D1-->>S1:200 Gotcha
|
135
|
+
!endif
|
136
|
+
|
137
|
+
!endif
|
138
|
+
|
139
|
+
D1->D1: I need to find out if payee charges any fee so that I can include that in fxQuote
|
140
|
+
|
141
|
+
== Agreement Phase ==
|
142
|
+
D1->>S1:Please quote for a payment of $payeeReceiveAmount $payeeCurrency.\n**POST /quotes**
|
143
|
+
note left
|
144
|
+
This is a standard Mojaloop quote.
|
145
|
+
No development required
|
146
|
+
end note
|
147
|
+
!if ($simplified != true)
|
148
|
+
note over D1
|
149
|
+
POST /quotes
|
150
|
+
|
151
|
+
{
|
152
|
+
"quoteId": "382987a8-75ce-4037-b500-c475e08c1727"
|
153
|
+
,"transactionId": "d9ce59d4-3598-4396-8630-581bb0551451"
|
154
|
+
, "payee": {
|
155
|
+
"partyIdInfo": {
|
156
|
+
"partyIdType": "MSISDN"
|
157
|
+
, "partyIdentifier": "$payeeMSISDN"
|
158
|
+
}
|
159
|
+
}
|
160
|
+
, "payer": {
|
161
|
+
"partyIdInfo": {
|
162
|
+
"partyIdType": "MSISDN"
|
163
|
+
, "partyIdentifier": "$payerMSISDN"
|
164
|
+
}
|
165
|
+
},
|
166
|
+
"amountType": "RECEIVE"
|
167
|
+
, "amount": {
|
168
|
+
"currency": "$payeeCurrency"
|
169
|
+
, "amount": "$payeeReceiveAmount"
|
170
|
+
}
|
171
|
+
, "validity": "2021-08-25T14:17:09.663+01:00"
|
172
|
+
}
|
173
|
+
end note
|
174
|
+
!endif
|
175
|
+
!if ($simplified != true)
|
176
|
+
S1-->>D1:202 I'll get back to you
|
177
|
+
!endif
|
178
|
+
S1->>D2:**POST /quotes**
|
179
|
+
activate D2
|
180
|
+
!if ($simplified != true)
|
181
|
+
D2-->>S1:202 I'll get back to you
|
182
|
+
!endif
|
183
|
+
deactivate S1
|
184
|
+
D2->D2:OK, so I will charge $payeeFee $payeeCurrency for this.\nNow I create terms of the transfer and sign the transaction object
|
185
|
+
D2->>S1:Here's the signed quote
|
186
|
+
note over D2
|
187
|
+
**put /quotes/382987a8-75ce-4037-b500-c475e08c1727**
|
188
|
+
|
189
|
+
{
|
190
|
+
"transferAmount": {
|
191
|
+
"currency": "$payeeCurrency"
|
192
|
+
, "amount": "$targetAmount"
|
193
|
+
}
|
194
|
+
, "payeeReceiveAmount": {
|
195
|
+
"currency": "$payeeCurrency"
|
196
|
+
, "amount": "$payeeReceiveAmount"
|
197
|
+
},
|
198
|
+
"payeeFspFee": {
|
199
|
+
"currency": "$payeeCurrency"
|
200
|
+
, "amount": "$payeeFee"
|
201
|
+
}
|
202
|
+
, "expiration": "2021-08-25T14:17:09.663+01:00
|
203
|
+
, "transaction": {
|
204
|
+
, "transactionId": "d9ce59d4-3598-4396-8630-581bb0551451"
|
205
|
+
, "quoteId": "382987a8-75ce-4037-b500-c475e08c1727"
|
206
|
+
, "payee": {
|
207
|
+
"fspId": "$payeeFSPID"
|
208
|
+
, "partyIdInfo": {
|
209
|
+
"partyIdType": "MSISDN"
|
210
|
+
, "partyIdentifier": "$payeeMSISDN"
|
211
|
+
}
|
212
|
+
}
|
213
|
+
, "payer": {
|
214
|
+
"fspId": "$payerFSPID"
|
215
|
+
, "partyIdInfo": {
|
216
|
+
"partyIdType": "MSISDN"
|
217
|
+
, "partyIdentifier": "$payerMSISDN"
|
218
|
+
}
|
219
|
+
}
|
220
|
+
, "amount": {
|
221
|
+
"currency": "$payeeCurrency"
|
222
|
+
"amount": "$payeeReceiveAmount"
|
223
|
+
}
|
224
|
+
, "payeeReceiveAmount": {
|
225
|
+
"currency": "$payeeCurrency"
|
226
|
+
, "amount": "$payeeReceiveAmount"
|
227
|
+
}
|
228
|
+
, "converter": "PAYER"
|
229
|
+
}
|
230
|
+
, "condition": "BfNFPRgfKF8Ke9kpoNAagmcI4/Hya5o/rq9/fq97ZiA="
|
231
|
+
}
|
232
|
+
|
233
|
+
end note
|
234
|
+
activate S1
|
235
|
+
!if ($simplified != true)
|
236
|
+
S1-->>D2:200 Gotcha
|
237
|
+
!endif
|
238
|
+
deactivate D2
|
239
|
+
S1->>D1:Here's the signed quote\n**PUT /quotes/382987a8-75ce-4037-b500-c475e08c1727**
|
240
|
+
activate D1
|
241
|
+
!if ($simplified != true)
|
242
|
+
D1-->>S1:200 Gotcha
|
243
|
+
!endif
|
244
|
+
deactivate S1
|
245
|
+
D1->D1:OK, I can see that there are going to be $payeeFee $payeeCurrency in charges and I need send $targetAmount $payeeCurrency to make this transfer
|
246
|
+
|
247
|
+
group Currency Conversion
|
248
|
+
D1->D1:Now I need to find out what the exchange rate is
|
249
|
+
deactivate S1
|
250
|
+
D1->D1:I'll ask FDH FX to perform my conversion
|
251
|
+
|
252
|
+
!if ($shortCutSingleFXP != true)
|
253
|
+
D1->>S1:Here is the initial version of the transfer.\nPlease quote me for the currency conversion.
|
254
|
+
!else
|
255
|
+
D1->>FXP:Here is the initial version of the transfer.\nPlease quote me for the currency conversion.
|
256
|
+
!endif
|
257
|
+
note over D1
|
258
|
+
**post /fxQuotes**
|
259
|
+
{
|
260
|
+
"conversionRequestId": "828cc75f-1654-415e-8fcd-df76cc9329b9"
|
261
|
+
, "conversionTerms": {
|
262
|
+
"conversionId": "581f68ef-b54f-416f-9161-ac34e889a84b",
|
263
|
+
, "counterPartyFsp": "FDH_FX"
|
264
|
+
, "amountType": "RECEIVE"
|
265
|
+
, "sourceAmount": {
|
266
|
+
"currency": "$payerCurrency"
|
267
|
+
}
|
268
|
+
, "targetAmount": {
|
269
|
+
"currency": "$payeeCurrency"
|
270
|
+
, "amount": "$targetAmount"
|
271
|
+
}
|
272
|
+
, "validity": "2021-08-25T14:17:09.663+01:00"
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
end note
|
277
|
+
!if ($shortCutSingleFXP != true)
|
278
|
+
activate S1
|
279
|
+
!if ($simplified != true)
|
280
|
+
S1-->>D1:202 I'll get back to you
|
281
|
+
!endif
|
282
|
+
deactivate D1
|
283
|
+
S1->>FXP:Here is the initial version of the transfer.\nPlease quote me for the currency conversion.\n**POST /fxQuote**
|
284
|
+
activate FXP
|
285
|
+
!if ($simplified != true)
|
286
|
+
FXP-->>S1:202 I'll get back to you
|
287
|
+
!endif
|
288
|
+
deactivate S1
|
289
|
+
!else
|
290
|
+
!endif
|
291
|
+
FXP->FXPBackend:Lookup FX rate
|
292
|
+
FXPBackend-->FXP:Return FX rate
|
293
|
+
' !if ($shortCutSingleFXP != true)
|
294
|
+
|
295
|
+
note over FXP
|
296
|
+
I will add a $fxpChargesSource $payerCurrency fee for undertaking the conversion.
|
297
|
+
Now I'll set an expiry time, sign the quotation object,
|
298
|
+
create an ILP prepare packet and return it in the intermediary object.
|
299
|
+
|
300
|
+
NOTE: the ILP prepare packet contains the following items, all encoded:
|
301
|
+
- The amount being sent (i.e. in the source currency)
|
302
|
+
- An expiry time
|
303
|
+
- The condition
|
304
|
+
- The name of the FXP
|
305
|
+
- The content of the conversion terms
|
306
|
+
|
307
|
+
** PUT /fxQuotes/828cc75f-1654-415e-8fcd-df76cc9329b9**
|
308
|
+
{
|
309
|
+
"condition": "bdbcf517cfc7e474392935781cc14043602e53dc2e8e8452826c5241dfd5e7ab"
|
310
|
+
, "conversionTerms": {
|
311
|
+
"conversionId": "581f68ef-b54f-416f-9161-ac34e889a84b"
|
312
|
+
, "initiatingFsp": "$payerFSPID"
|
313
|
+
"sourceAmount": {
|
314
|
+
"currency": "$payerCurrency",
|
315
|
+
"amount": "$fxpSourceAmount"
|
316
|
+
}
|
317
|
+
, "targetAmount": {
|
318
|
+
"currency": "$payeeCurrency"",
|
319
|
+
"amount": "$fxpTargetAmount"
|
320
|
+
}
|
321
|
+
, "charges": [
|
322
|
+
{
|
323
|
+
"chargeType": "Conversion fee"
|
324
|
+
, "sourceAmount": {
|
325
|
+
"currency": "$payerCurrency"
|
326
|
+
, "amount": "$fxpChargesSource"
|
327
|
+
}
|
328
|
+
, "targetAmount": {
|
329
|
+
"currency": "$payeeCurrency"
|
330
|
+
, "amount": "$fxpChargesTarget"
|
331
|
+
}
|
332
|
+
}
|
333
|
+
]
|
334
|
+
, "validity": "2021-08-25T14:17:09.663+01:00"
|
335
|
+
}
|
336
|
+
}
|
337
|
+
end note
|
338
|
+
!if ($shortCutSingleFXP != true)
|
339
|
+
FXP->>S1:Here's the signed conversion object
|
340
|
+
activate S1
|
341
|
+
!if ($simplified != true)
|
342
|
+
S1-->>FXP:200 Gotcha
|
343
|
+
!endif
|
344
|
+
deactivate FXP
|
345
|
+
S1->>D1:Here's the signed conversion object\n**PUT /fxQuotes/828cc75f-1654-415e-8fcd-df76cc9329b9**
|
346
|
+
activate D1
|
347
|
+
!if ($simplified != true)
|
348
|
+
D1-->>S1:Gotcha
|
349
|
+
!endif
|
350
|
+
deactivate S1
|
351
|
+
!else
|
352
|
+
FXP-->>D1:Here's the signed conversion object\n**PUT /fxQuotes/828cc75f-1654-415e-8fcd-df76cc9329b9**
|
353
|
+
activate D1
|
354
|
+
!endif
|
355
|
+
|
356
|
+
end group
|
357
|
+
|
358
|
+
== Sender Confirmation ==
|
359
|
+
|
360
|
+
D1->PayerCBS:Here's the quote for the transfer\nIt expires at 2021-08-25T14:17:09.663+01:00
|
361
|
+
PayerCBS->A1:Hi, $senderName: I can do the transfer.\nIt'll cost you $totalChargesSourceCurrency $payerCurrency in fees\nand $receiverName will receive\n$payeeReceiveAmount $payeeCurrency.\nLet me know if you want to go ahead
|
362
|
+
A1-->PayerCBS:Great! Yes please, go ahead
|
363
|
+
|
364
|
+
PayerCBS-->D1: Payer has accepted the terms please proceed
|
365
|
+
|
366
|
+
== Transfer Phase ==
|
367
|
+
D1->D1:First, activate the conversion
|
368
|
+
D1->>S1:Please confirm your part of the transfer
|
369
|
+
note over D1
|
370
|
+
**POST /fxTransfers**
|
371
|
+
{
|
372
|
+
"commitRequestId": "77c9d78d-c26a-4474-8b3c-99b96a814bfc"
|
373
|
+
, "determiningTransactionId": "d9ce59d4-3598-4396-8630-581bb0551451"
|
374
|
+
, "requestingFsp": "$payerFSPID"
|
375
|
+
, "respondingFxp": "FDH_FX"
|
376
|
+
, "sourceAmount": {
|
377
|
+
"currency": "$payerCurrency",
|
378
|
+
"amount": "$fxpSourceAmount"
|
379
|
+
}
|
380
|
+
, "targetAmount": {
|
381
|
+
"currency": "$payeeCurrency",
|
382
|
+
"amount": "$fxpTargetAmount"
|
383
|
+
}
|
384
|
+
, "condition": "bdbcf517cfc7e474392935781cc14043602e53dc2e8e8452826c5241dfd5e7ab"
|
385
|
+
}
|
386
|
+
end note
|
387
|
+
activate S1
|
388
|
+
!if ($simplified != true)
|
389
|
+
S1-->>D1:202 I'll get back to you
|
390
|
+
!endif
|
391
|
+
deactivate D2
|
392
|
+
!if ($hideSwitchDetail != true)
|
393
|
+
S1->S1:OK, so this is an FX confirmation.
|
394
|
+
S1->S1: Does the sender have an account in this currency?\nYes, it does.
|
395
|
+
!endif
|
396
|
+
S1->S1: Liquidity check and reserve on Payer DFSP's account
|
397
|
+
!if ($hideSwitchDetail != true)
|
398
|
+
note over S1
|
399
|
+
Reservations:
|
400
|
+
|
401
|
+
**$payerFSPID has a reservation of $fxpSourceAmount $payerCurrency**
|
402
|
+
end note
|
403
|
+
!endif
|
404
|
+
S1->>FXP:Please confirm the currency conversion part of the transfer\n** POST /fxTransfers**
|
405
|
+
activate FXP
|
406
|
+
!if ($simplified != true)
|
407
|
+
FXP-->>S1:202 I'll get back to you
|
408
|
+
!endif
|
409
|
+
deactivate S1
|
410
|
+
FXP->FXPBackend:Reserve funds for FX conversion
|
411
|
+
FXPBackend->FXP:Success
|
412
|
+
FXP->>S1:Confirmed. Here's the fulfilment
|
413
|
+
note over FXP
|
414
|
+
**PUT /fxTransfers/77c9d78d-c26a-4474-8b3c-99b96a814bfc**
|
415
|
+
{
|
416
|
+
"fulfilment": "188909ceb6cd5c35d5c6b394f0a9e5a0571199c332fbd013dc1e6b8a2d5fff42"
|
417
|
+
, "completedTimeStamp": "2021-08-25T14:17:08.175+01:00"
|
418
|
+
, "conversionState": "RESERVED"
|
419
|
+
}
|
420
|
+
end note
|
421
|
+
activate S1
|
422
|
+
!if ($simplified != true)
|
423
|
+
S1-->>FXP:200 Gotcha
|
424
|
+
!endif
|
425
|
+
deactivate FXP
|
426
|
+
!if ($simplified != true)
|
427
|
+
S1->S1:Check fulfilment matches and cancel if not.
|
428
|
+
alt Conversion failed
|
429
|
+
S1->FXP:Sorry. Conversion failed
|
430
|
+
note over FXP
|
431
|
+
**PATCH /fxTransfers/77c9d78d-c26a-4474-8b3c-99b96a814bfc**
|
432
|
+
{
|
433
|
+
"fulfilment": "188909ceb6cd5c35d5c6b394f0a9e5a0571199c332fbd013dc1e6b8a2d5fff42"
|
434
|
+
, "completedTimeStamp": "2021-08-25T14:17:08.175+01:00"
|
435
|
+
, "conversionState": "ABORTED"
|
436
|
+
}
|
437
|
+
end note
|
438
|
+
activate FXP
|
439
|
+
FXP-->S1:Acknowledged
|
440
|
+
FXP->FXP:Remove any reservations\nor obligations
|
441
|
+
deactivate FXP
|
442
|
+
|
443
|
+
S1->>D1:Sorry. Conversion failed
|
444
|
+
note over S1
|
445
|
+
**PUT /fxTransfers/77c9d78d-c26a-4474-8b3c-99b96a814bfc/error**
|
446
|
+
{
|
447
|
+
"errorCode": "9999"
|
448
|
+
, "errorDescription": "Whatever the error was"
|
449
|
+
}
|
450
|
+
end note
|
451
|
+
else Conversion succeeded
|
452
|
+
S1->D1:Conversion succeeded subject to transfer success\n**PUT /fxTransfers/77c9d78d-c26a-4474-8b3c-99b96a814bfc**
|
453
|
+
|
454
|
+
end
|
455
|
+
!else
|
456
|
+
S1->D1:Conversion succeeded subject to transfer success\n**PUT /fxTransfers/77c9d78d-c26a-4474-8b3c-99b96a814bfc**
|
457
|
+
!endif
|
458
|
+
activate D1
|
459
|
+
!if ($simplified != true)
|
460
|
+
D1-->S1:200 Gotcha
|
461
|
+
!endif
|
462
|
+
deactivate S1
|
463
|
+
D1->D1:OK, so that's all right\nNow I can send the transfer itself
|
464
|
+
|
465
|
+
D1->S1:Please do the transfer **POST /transfers**
|
466
|
+
!if ($simplified != true)
|
467
|
+
note over D1
|
468
|
+
POST /transfers
|
469
|
+
{
|
470
|
+
"transferId": "c720ae14-fc72-4acd-9113-8b601b34ba4d"
|
471
|
+
, "payeeFsp": "$payeeFSPID"
|
472
|
+
, "payerFsp": "$payerFSPID"
|
473
|
+
, "amount": {
|
474
|
+
"currency": "$payeeCurrency"
|
475
|
+
, "amount": "$targetAmount"
|
476
|
+
}
|
477
|
+
, "transaction": {
|
478
|
+
, "transactionId": "d9ce59d4-3598-4396-8630-581bb0551451"
|
479
|
+
, "quoteId": "382987a8-75ce-4037-b500-c475e08c1727"
|
480
|
+
, "payee": {
|
481
|
+
"fspId": "$payeeFSPID"
|
482
|
+
, "partyIdInfo": {
|
483
|
+
"partyIdType": "MSISDN"
|
484
|
+
, "partyIdentifier": "$payeeMSISDN"
|
485
|
+
}
|
486
|
+
}
|
487
|
+
, "payer": {
|
488
|
+
"fspId": "$payerFSPID"
|
489
|
+
, "partyIdInfo": {
|
490
|
+
"partyIdType": "MSISDN"
|
491
|
+
, "partyIdentifier": "$payerMSISDN"
|
492
|
+
}
|
493
|
+
}
|
494
|
+
}
|
495
|
+
}
|
496
|
+
end note
|
497
|
+
!endif
|
498
|
+
activate S1
|
499
|
+
!if ($simplified != true)
|
500
|
+
S1-->D1:202 I'll get back to you
|
501
|
+
!endif
|
502
|
+
deactivate D1
|
503
|
+
!if ($hideSwitchDetail != true)
|
504
|
+
S1->S1:Is there a dependent transfer? Yes
|
505
|
+
!endif
|
506
|
+
S1->S1:Perform liquidity check and reserve funds\nagainst creditor party to dependent transfer
|
507
|
+
note over S1
|
508
|
+
Reservations:
|
509
|
+
|
510
|
+
$payerFSPID has a reservation of $fxpSourceAmount $payerCurrency
|
511
|
+
**FDH_FX has a reservation of $targetAmount $payeeCurrency**
|
512
|
+
end note
|
513
|
+
|
514
|
+
S1->D2:Please do the transfer\n**POST /transfers**
|
515
|
+
activate D2
|
516
|
+
!if ($simplified != true)
|
517
|
+
D2-->S1:202 I'll get back to you
|
518
|
+
!endif
|
519
|
+
deactivate S1
|
520
|
+
D2->D2:Let me check that the terms of the dependent transfer\nare the same as the ones I agreed to\nand that the fulfilment and condition match
|
521
|
+
D2->D2:Yes, they do. I approve the transfer
|
522
|
+
D2->PayeeCBS:Please credit $receiverName's account with $payeeReceiveAmount $payeeCurrency
|
523
|
+
D2->S1:Transfer is confirmed, here's the fulfilment
|
524
|
+
note over D2
|
525
|
+
**PUT /transfers/c720ae14-fc72-4acd-9113-8b601b34ba4d**
|
526
|
+
{
|
527
|
+
"fulfilment": "mhPUT9ZAwd-BXLfeSd7-YPh46rBWRNBiTCSWjpku90s"
|
528
|
+
, "completedTimestamp": "2021-08-25T14:17:08.227+01:00"
|
529
|
+
, "transferState": "COMMITTED"
|
530
|
+
}
|
531
|
+
end note
|
532
|
+
activate S1
|
533
|
+
!if ($simplified != true)
|
534
|
+
S1-->D2:200 Gotcha
|
535
|
+
!endif
|
536
|
+
deactivate D2
|
537
|
+
!if ($hideSwitchDetail != true)
|
538
|
+
S1->S1:Is there a dependent transfer?\nYes, there is.
|
539
|
+
S1->S1:Is this dependency against the debtor party to the transfer?\nYes, it is.
|
540
|
+
S1->S1:Create an obligation from the debtor party to the party named in the dependency (the FXP)
|
541
|
+
S1->S1:Is the transfer denominated in the currency of the payee receive amount?\nYes, it is.
|
542
|
+
S1->S1:Create an obligation from the party named in the dependency\nto the creditor party for the transfer
|
543
|
+
!else
|
544
|
+
S1->S1:Create obligations from the payer to the FXP and from FXP to the payee
|
545
|
+
!endif
|
546
|
+
S1->FXP:The transfer succeeded.\nYou can clear it in your ledgers
|
547
|
+
note over S1
|
548
|
+
**PATCH /fxTransfers/77c9d78d-c26a-4474-8b3c-99b96a814bfc**
|
549
|
+
{
|
550
|
+
"fulfilment": "2e6870fb4eda9c2a29ecf376ceb5b05c"
|
551
|
+
, "completedTimeStamp": "2021-08-25T14:17:08.175+01:00"
|
552
|
+
, "conversionState": "COMMITTED"
|
553
|
+
}
|
554
|
+
end note
|
555
|
+
activate FXP
|
556
|
+
FXP->FXP:Let's just check: does this match the stuff I sent?
|
557
|
+
FXP->FXP:It does. Great. I'll clear the conversion
|
558
|
+
FXP-->S1:200 Gotcha
|
559
|
+
deactivate FXP
|
560
|
+
note over S1
|
561
|
+
Ledger positions:
|
562
|
+
$payerFSPID has a debit of $fxpSourceAmount $payerCurrency
|
563
|
+
FDH_FX has a credit of $fxpSourceAmount $payerCurrency
|
564
|
+
FDH_FX has a debit of $fxpTargetAmount $payeeCurrency
|
565
|
+
$payeeFSPID has a credit of $targetAmount $payeeCurrency
|
566
|
+
end note
|
567
|
+
S1->D1:Transfer is complete\n**PUT /transfers/c720ae14-fc72-4acd-9113-8b601b34ba4d**
|
568
|
+
activate D1
|
569
|
+
!if ($simplified != true)
|
570
|
+
D1-->S1:200 Gotcha
|
571
|
+
!endif
|
572
|
+
deactivate S1
|
573
|
+
D1->D1:Commit the funds in my ledgers
|
574
|
+
D1->A1:Transfer was completed successfully
|
575
|
+
deactivate D1
|
576
|
+
|
577
|
+
@enduml
|