account-lookup-service 15.6.0-snapshot.2 → 16.1.0-iso.0

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 (68) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE.md +3 -4
  3. package/README.md +2 -0
  4. package/audit-ci.jsonc +2 -27
  5. package/config/default.json +1 -0
  6. package/docker/mock-proxy/README.md +21 -0
  7. package/docker/mock-proxy/src/config.ts +7 -0
  8. package/docs/Proxy/Discovery.md +20 -0
  9. package/docs/Proxy/FXAPI_POC_payer_conversion_RECEIVE.plantuml +577 -0
  10. package/docs/Proxy/FXAPI_POC_payer_conversion_SEND.plantuml +1423 -0
  11. package/docs/Proxy/P2P.md +11 -0
  12. package/docs/Proxy/Proxy pattern - Happy path.plantuml +98 -0
  13. package/docs/Proxy/Proxy pattern - Lazy Discovery - No Oracles.plantuml +105 -0
  14. package/docs/Proxy/Proxy pattern - Lazy Discovery - No Oracles.png +0 -0
  15. package/docs/Proxy/Proxy pattern - Lazy Discovery - Oracles.plantuml +130 -0
  16. package/docs/Proxy/Proxy pattern - Lazy Discovery - Oracles.png +0 -0
  17. package/docs/Proxy/Proxy pattern - Lazy Discovery Identifier Cache Invalid.plantuml +72 -0
  18. package/docs/Proxy/Proxy pattern - Lazy Discovery Identifier Cache Invalid.png +0 -0
  19. package/docs/Proxy/Proxy pattern - P2P.plantuml +186 -0
  20. package/docs/Proxy/Proxy pattern - P2P.png +0 -0
  21. package/docs/Proxy/Proxy pattern - Unhappy path.plantuml +103 -0
  22. package/docs/Proxy/Proxy pattern - Unhappy path.png +0 -0
  23. package/docs/Proxy/Proxy pattern - happy path.png +0 -0
  24. package/docs/Proxy/Readme.md +39 -0
  25. package/docs/Proxy/SettingUpProxys.plantuml +31 -0
  26. package/docs/Proxy/SettingUpProxys.png +0 -0
  27. package/package.json +33 -18
  28. package/src/constants.js +2 -1
  29. package/src/domain/oracle/oracle.js +63 -4
  30. package/src/domain/participants/participants.js +246 -129
  31. package/src/domain/parties/getPartiesByTypeAndID.js +28 -7
  32. package/src/domain/parties/parties.js +43 -14
  33. package/src/domain/timeout/index.js +12 -1
  34. package/src/handlers/index.js +4 -4
  35. package/src/handlers/monitoring/index.js +1 -1
  36. package/src/interface/api-swagger-iso20022-parties.yaml +7 -6
  37. package/src/interface/api-swagger.yaml +7 -6
  38. package/src/lib/config.js +2 -1
  39. package/src/lib/db.js +2 -1
  40. package/src/models/currency/currency.js +10 -1
  41. package/src/models/endpointType/endpointType.js +10 -1
  42. package/src/models/oracle/facade.js +42 -16
  43. package/src/models/oracle/oracleEndpoint.js +65 -10
  44. package/src/models/oracle/oracleEndpointCached.js +29 -9
  45. package/src/models/participantEndpoint/facade.js +40 -4
  46. package/src/models/partyIdType/partyIdType.js +10 -1
  47. package/src/plugins.js +8 -21
  48. package/src/server.js +11 -0
  49. package/test/fixtures/index.js +30 -6
  50. package/test/unit/api/health.test.js +3 -0
  51. package/test/unit/api/participants/participants.test.js +5 -7
  52. package/test/unit/api/participants/{Type}/{ID}/{SubId}.test.js +0 -3
  53. package/test/unit/api/participants/{Type}/{ID}.test.js +0 -3
  54. package/test/unit/api/participants.test.js +36 -3
  55. package/test/unit/domain/oracle/oracle.test.js +8 -0
  56. package/test/unit/domain/participants/participants.test.js +83 -48
  57. package/test/unit/domain/parties/parties.test.js +8 -0
  58. package/test/unit/domain/timeout/index.test.js +8 -0
  59. package/test/unit/lib/config.test.js +7 -0
  60. package/test/unit/mocks.js +16 -11
  61. package/test/unit/models/oracle/oracleEndpointCached.test.js +32 -0
  62. package/test/unit/plugins.test.js +2 -2
  63. package/test/util/apiClients/BasicApiClient.js +2 -2
  64. package/src/lib/requestLogger.js +0 -54
  65. package/src/metrics/handler.js +0 -33
  66. package/src/metrics/plugin.js +0 -52
  67. package/src/metrics/routes.js +0 -43
  68. package/test/unit/lib/requestLogger.test.js +0 -115
@@ -0,0 +1,1423 @@
1
+ @startuml
2
+
3
+ !$simplified = false
4
+ !$shortCutSingleFXP = false
5
+ !$hideSwitchDetail = false
6
+ !$advancedCoreConnectorFlow = true
7
+ !$senderLastName = ""
8
+ !$senderDOB = "1966-06-16"
9
+ !$receiverName = "Yaro"
10
+ !$receiverFirstName = "Yaro"
11
+ !$receiverMiddleName = ""
12
+ !$receiverLastName = ""
13
+ !$receiverDOB = "1966-06-16"
14
+ !$payerCurrency = "BWP"
15
+ !$payeeCurrency = "TZS"
16
+ !$payerFSPID = "PayerFSP"
17
+ !$payeeFSPID = "PayeeFSP"
18
+ !$fxpID = "FDH_FX"
19
+ !$payerMSISDN = "26787654321"
20
+ !$payeeMSISDN = "2551234567890"
21
+ !$payeeReceiveAmount = "44000"
22
+ !$payerSendAmount = "300"
23
+ !$payeeFee = "4000"
24
+ !$targetAmount = "48000"
25
+ !$fxpChargesSource = "33"
26
+ !$fxpChargesTarget = "6000"
27
+ !$fxpSourceAmount = "300"
28
+ !$fxpTargetAmount = "48000"
29
+ !$totalChargesSourceCurrency = "55"
30
+ !$totalChargesTargetCurrency = "10000"
31
+ !$conversionRequestId = "828cc75f-1654-415e-8fcd-df76cc9329b9"
32
+ !$conversionId = "581f68ef-b54f-416f-9161-ac34e889a84b"
33
+ !$homeTransactionId = "string"
34
+ !$quoteId = "382987a8-75ce-4037-b500-c475e08c1727"
35
+ !$transactionId = "d9ce59d4-3598-4396-8630-581bb0551451"
36
+ !$quotePayerExpiration = "2021-08-25T14:17:09.663+01:00"
37
+ !$quotePayeeExpiration = "2021-08-25T14:17:09.663+01:00"
38
+ !$commitRequestId = "77c9d78d-c26a-4474-8b3c-99b96a814bfc"
39
+ !$determiningTransferId = "d9ce59d4-3598-4396-8630-581bb0551451"
40
+ !$transferId = "d9ce59d4-3598-4396-8630-581bb0551451"
41
+ !$fxCondition = "GRzLaTP7DJ9t4P-a_BA0WA9wzzlsugf00-Tn6kESAfM"
42
+ !$condition = "HOr22-H3AfTDHrSkPjJtVPRdKouuMkDXTR4ejlQa8Ks"
43
+
44
+ title Remittance Transfer using Mojaloop FX APIs POC\nPayer DFSP requests conversion with SEND amount
45
+ actor "$senderName" as A1
46
+ box "Payer DFSP" #LightBlue
47
+ participant "Payer CBS" as PayerCBS
48
+ participant "Core Connector" as PayerCC
49
+ participant "Payer\nMojaloop\nConnector" as D1
50
+ end box
51
+
52
+ participant "Mojaloop Switch" as S1
53
+
54
+ box "Discovery Service" #LightYellow
55
+ participant "ALS Oracle" as ALS
56
+ end box
57
+
58
+ box "FX provider"
59
+ participant "FXP\nConnector" as FXP
60
+ participant "Backend FX API" as FXPBackend
61
+ end box
62
+
63
+ box "Payee DFSP" #LightBlue
64
+ participant "Payee\nMojaloop\nConnector" as D2
65
+ participant "Core Connector" as PayeeCC
66
+ end box
67
+
68
+ actor "$receiverName" as A2
69
+ autonumber
70
+
71
+ A1->PayerCBS:I'd like to pay $receiverName\n$payerSendAmount $payerCurrency, please
72
+ PayerCBS->PayerCC: Initiate remittance transfer
73
+ !if ($advancedCoreConnectorFlow != true)
74
+ PayerCC->D1: **POST /transfers**
75
+ !if ($simplified != true)
76
+ note right of PayerCC
77
+ {
78
+ "homeTransactionId": "$homeTransactionId",
79
+ "from": {
80
+ "dateOfBirth": "$senderDOB",
81
+ "displayName": "$senderName",
82
+ "firstName": "$senderFirstName",
83
+ "middleName": "$senderMiddleName",
84
+ "lastName": "$senderLastName"
85
+ "fspId": "$payerFSPID",
86
+ "idType": "MSISDN",
87
+ "idValue": "$payerMSISDN"
88
+ },
89
+ "to": {
90
+ "idType": "MSISDN",
91
+ "idValue": "$payeeMSISDN"
92
+ },
93
+ "amountType": "SEND",
94
+ "currency": "$payerCurrency",
95
+ "amount": "$payerSendAmount"
96
+ }
97
+ end note
98
+ !endif
99
+ !else
100
+ PayerCC->D1: **GET /parties/MSISDN/$payeeMSISDN**
101
+ !endif
102
+
103
+ == Discovery Phase ==
104
+ activate D1
105
+ D1->>S1:I want to send to MSISDN $payeeMSISDN\n**GET /parties/MSISDN/$payeeMSISDN**
106
+ activate S1
107
+ !if ($simplified != true)
108
+ S1-->>D1:202 I'll get back to you
109
+ !endif
110
+ deactivate D1
111
+ S1->ALS:Who owns MSISDN $payeeMSISDN?
112
+ activate ALS
113
+ ALS-->S1:It's $payeeFSPID
114
+ deactivate ALS
115
+ S1->>D2:Do you own MSISDN $payeeMSISDN?
116
+ activate D2
117
+ !if ($simplified != true)
118
+ D2-->>S1:202 I'll get back to you
119
+ !endif
120
+ D2->D2: Check Sanction list status & trigger a refresh of the status
121
+ D2->PayeeCC: Check account and get currency type
122
+ !if ($simplified != true)
123
+ PayeeCC-->D2: Result
124
+ !endif
125
+ deactivate S1
126
+ D2->>S1:Yes, it's $receiverName. He can receive in $payeeCurrency\n**PUT /parties/MSISDN/$payeeMSISDN**
127
+ !if ($simplified != true)
128
+ note left of D2
129
+ PUT /parties
130
+ {
131
+ "partyIdInfo": {
132
+ "partyIdType": "MSISDN",
133
+ "partyIdentifier": "$payeeMSISDN",
134
+ "fspId": "$payeeFSPID"
135
+ },
136
+ "merchantClassificationCode": "string",
137
+ "name": "$receiverName",
138
+ "personalInfo": {
139
+ "complexName": {
140
+ "firstName": "$receiverFirstName",
141
+ "middleName": "$receiverMiddleName",
142
+ "lastName": "$receiverLastName"
143
+ },
144
+ "dateOfBirth": "$receiverDOB",
145
+ "kycInformation": "<Encrypted KYC Data>"
146
+ },
147
+ "supportedCurrencies": [ "$payeeCurrency" ]
148
+ }
149
+ end note
150
+ !else
151
+ note over D2
152
+ Payee Info with Encrypted KYC Data
153
+ end note
154
+ !endif
155
+ activate S1
156
+ !if ($simplified != true)
157
+ S1-->>D2:200 Gotcha
158
+ !endif
159
+ deactivate D2
160
+ S1->>D1:Yes, it's $receiverName. He can receive in $payeeCurrency\n**PUT /parties/MSISDN/$payeeMSISDN**
161
+ activate D1
162
+ !if ($simplified != true)
163
+ D1-->>S1:200 Gotcha
164
+ !endif
165
+ deactivate S1
166
+
167
+ !if ($advancedCoreConnectorFlow != true)
168
+ D1->PayerCC: Here is the party information\nand supported currencies
169
+ note right of PayerCC
170
+ {
171
+ "transferId": "$transferId",
172
+ "homeTransactionId": "$homeTransactionId",
173
+ "from": {
174
+ "dateOfBirth": "$senderDOB",
175
+ "displayName": "$senderName",
176
+ "firstName": "$senderFirstName",
177
+ "middleName": "$senderMiddleName",
178
+ "lastName": "$senderLastName"
179
+ "fspId": "$payerFSPID",
180
+ "idType": "MSISDN",
181
+ "idValue": "$payerMSISDN"
182
+ },
183
+ "to": {
184
+ "type": "CONSUMER",
185
+ "idType": "MSISDN",
186
+ "idValue": "$payeeMSISDN",
187
+ "displayName": "$receiverName",
188
+ "firstName": "$receiverFirstName",
189
+ "middleName": "$receiverMiddleName",
190
+ "lastName": "$receiverLastName"
191
+ "dateOfBirth": "$receiverDOB",
192
+
193
+ "fspId": "$payeeFSPID"
194
+ "supportedCurrencies": [ "$payeeCurrency" ]
195
+ "kycInformation": "<Encrypted KYC Data>"
196
+ },
197
+ "amountType": "SEND",
198
+ "currency": "$payerCurrency",
199
+ "amount": "$payerSendAmount"
200
+ "currentState": "**WAITING_FOR_PARTY_ACCEPTANCE**",
201
+ "getPartiesResponse": {
202
+ "body": {
203
+ "partyIdInfo": {
204
+ "partyIdType": "MSISDN",
205
+ "partyIdentifier": "$payeeMSISDN",
206
+ "fspId": "$payeeFSPID"
207
+ },
208
+ "merchantClassificationCode": "string",
209
+ "name": "$receiverName",
210
+ "personalInfo": {
211
+ "complexName": {
212
+ "firstName": "$receiverFirstName",
213
+ "middleName": "$receiverMiddleName",
214
+ "lastName": "$receiverLastName"
215
+ },
216
+ "dateOfBirth": "$receiverDOB",
217
+ "kycInformation": "<Encrypted KYC Data>"
218
+ },
219
+ "supportedCurrencies": [ "$payeeCurrency" ]
220
+ },
221
+ "headers": {}
222
+ }
223
+ }
224
+ end note
225
+ !else
226
+ D1->PayerCC: Here is the party information\nand supported currencies
227
+ !if ($simplified != true)
228
+ note right of PayerCC
229
+ {
230
+ "party": {
231
+ "body": {
232
+ "partyIdInfo": {
233
+ "partyIdType": "MSISDN",
234
+ "partyIdentifier": "$payeeMSISDN",
235
+ "fspId": "$payeeFSPID"
236
+ },
237
+ "merchantClassificationCode": "string",
238
+ "name": "$receiverName",
239
+ "personalInfo": {
240
+ "complexName": {
241
+ "firstName": "$receiverFirstName",
242
+ "middleName": "$receiverMiddleName",
243
+ "lastName": "$receiverLastName"
244
+ },
245
+ "dateOfBirth": "$receiverDOB",
246
+ "kycInformation": "<Encrypted KYC Data>"
247
+ },
248
+ "supportedCurrencies": [ "$payeeCurrency" ]
249
+ },
250
+ "headers": {}
251
+ },
252
+ "currentState": "COMPLETED"
253
+ }
254
+ end note
255
+ !endif
256
+ !endif
257
+
258
+ PayerCC->PayerCBS:Here's are the receiver details
259
+ PayerCBS->A1:Hi, $senderName: The number belongs to $receiverName \nLet me know if you want to go ahead
260
+ A1->PayerCBS:Yes please, go ahead
261
+
262
+ PayerCBS->PayerCC: Payer has accepted the party information
263
+
264
+ !if ($shortCutSingleFXP != true)
265
+ == Currency conversion ==
266
+
267
+ !if ($advancedCoreConnectorFlow != true)
268
+ PayerCC->>D1:Get quotation\n**PUT /transfers/$transferId**
269
+ note right of PayerCC
270
+ {
271
+ "acceptParty": true
272
+ }
273
+ end note
274
+ D1->D1:Hmmm. I can only send in $payerCurrency.\nI need to get some currency conversion
275
+ !else
276
+ PayerCC->PayerCC:Hmmm. I can only send in $payerCurrency.\nI need to get some currency conversion
277
+ PayerCC->>D1:What FXPs do you know about?\n**GET /services/FXP**
278
+ !endif
279
+
280
+ D1->>S1:What FXPs do you know about?\n**GET /services/FXP**
281
+ activate S1
282
+ !if ($simplified != true)
283
+ S1-->>D1:202 I'll get back to you
284
+ !endif
285
+ deactivate D1
286
+ S1->ALS:What FXPs do you know about?
287
+ activate ALS
288
+ ALS-->S1:FDH FX
289
+ deactivate ALS
290
+ S1->>D1:Here are the available FXPs:FDH FX
291
+ note left of S1
292
+ PUT /services/FXP
293
+ {
294
+ "providers": [
295
+ "$fxpID"
296
+ ]
297
+ }
298
+ end note
299
+ activate D1
300
+ !if ($simplified != true)
301
+ D1-->>S1:200 Gotcha
302
+ !endif
303
+
304
+ !if ($advancedCoreConnectorFlow != true)
305
+ ' TODO: We can pause the execution here if required to allow the core connector to select the FXP
306
+ D1->D1:I'll ask FDH FX to perform my conversion
307
+ !else
308
+ D1->>PayerCC:Here are the available FXPs
309
+ note right of PayerCC
310
+ {
311
+ "providers": [
312
+ "$fxpID"
313
+ ]
314
+ }
315
+ end note
316
+
317
+ PayerCC->PayerCC:I'll ask FDH FX to perform my conversion
318
+ PayerCC->D1: I want to get a quote from this FXP\n**POST /fxQuotes**
319
+ !if ($simplified != true)
320
+ note right of PayerCC
321
+ {
322
+ "homeTransactionId": "$homeTransactionId",
323
+ "conversionRequestId": "$conversionRequestId",
324
+ "conversionTerms": {
325
+ "conversionId": "$conversionId",
326
+ "initiatingFsp": "$payerFSPID",
327
+ "counterPartyFsp": "$fxpID",
328
+ "amountType": "SEND",
329
+ "sourceAmount": {
330
+ "currency": "$payerCurrency",
331
+ "amount": "$payerSendAmount"
332
+ },
333
+ "targetAmount": {
334
+ "currency": "$payeeCurrency"
335
+ },
336
+ "expiration": "2021-08-25T14:17:09.663+01:00"
337
+ }
338
+ }
339
+ end note
340
+ !endif
341
+ !endif
342
+
343
+
344
+ !endif
345
+
346
+
347
+
348
+ deactivate S1
349
+
350
+
351
+ !if ($shortCutSingleFXP != true)
352
+ D1->>S1:Here is the initial version of the transfer.\nPlease quote me for the currency conversion.
353
+ !else
354
+ D1->>FXP:Here is the initial version of the transfer.\nPlease quote me for the currency conversion.
355
+ !endif
356
+ note right of D1
357
+ **post /fxQuotes**
358
+ {
359
+ "conversionRequestId": "$conversionRequestId",
360
+ "conversionTerms": {
361
+ "conversionId": "$conversionId",
362
+ "initiatingFsp": "$payerFSPID",
363
+ "counterPartyFsp": "$fxpID",
364
+ "amountType": "SEND",
365
+ "sourceAmount": {
366
+ "currency": "$payerCurrency",
367
+ "amount": "$payerSendAmount"
368
+ },
369
+ "targetAmount": {
370
+ "currency": "$payeeCurrency"
371
+ },
372
+ "expiration": "2021-08-25T14:17:09.663+01:00"
373
+ }
374
+ }
375
+ end note
376
+ !if ($shortCutSingleFXP != true)
377
+ activate S1
378
+ !if ($simplified != true)
379
+ S1-->>D1:202 I'll get back to you
380
+ !endif
381
+ deactivate D1
382
+ S1->>FXP:Here is the initial version of the transfer.\nPlease quote me for the currency conversion.\n**POST /fxQuote**
383
+ activate FXP
384
+ !if ($simplified != true)
385
+ FXP-->>S1:202 I'll get back to you
386
+ !endif
387
+ deactivate S1
388
+ !else
389
+ !if ($simplified != true)
390
+ FXP-->>D1:202 I'll get back to you
391
+ !endif
392
+ !endif
393
+ FXP->FXPBackend:Lookup FX rate
394
+ !if ($simplified != true)
395
+ note right of FXP
396
+ **post /fxQuotes**
397
+ {
398
+ "conversionRequestId": "$conversionRequestId",
399
+ "conversionTerms": {
400
+ "conversionId": "$conversionId",
401
+ "initiatingFsp": "$payerFSPID",
402
+ "counterPartyFsp": "$fxpID",
403
+ "amountType": "SEND",
404
+ "sourceAmount": {
405
+ "currency": "$payerCurrency",
406
+ "amount": "$payerSendAmount"
407
+ },
408
+ "targetAmount": {
409
+ "currency": "$payeeCurrency"
410
+ },
411
+ "expiration": "2021-08-25T14:17:09.663+01:00"
412
+ }
413
+ }
414
+ end note
415
+ !endif
416
+ FXPBackend-->FXP:Return FX rate
417
+ note over FXPBackend
418
+ I will add a $fxpChargesSource $payerCurrency fee for undertaking the conversion.
419
+ Now I'll set an expiry time, sign the quotation object,
420
+ end note
421
+ !if ($simplified != true)
422
+ note right of FXP
423
+ {
424
+ "conversionTerms": {
425
+ "conversionId": "$conversionId",
426
+ "initiatingFsp": "$payerFSPID",
427
+ "counterPartyFsp": "$fxpID",
428
+ "amountType": "SEND",
429
+ "sourceAmount": {
430
+ "currency": "$payerCurrency",
431
+ "amount": "$fxpSourceAmount"
432
+ },
433
+ "targetAmount": {
434
+ "currency": "$payeeCurrency",
435
+ "amount": "$fxpTargetAmount"
436
+ },
437
+ "expiration": "2021-08-25T14:17:09.663+01:00"
438
+ "charges": [
439
+ {
440
+ "chargeType": "string",
441
+ "sourceAmount": {
442
+ "currency": "$payerCurrency",
443
+ "amount": "$fxpChargesSource"
444
+ },
445
+ "targetAmount": {
446
+ "currency": "$payeeCurrency",
447
+ "amount": "$fxpChargesTarget"
448
+ }
449
+ }
450
+ ]
451
+ }
452
+ }
453
+ end note
454
+ !endif
455
+
456
+ note over FXP
457
+ Now I'll sign the quotation object,
458
+ create an ILP prepare packet and return it in the intermediary object.
459
+
460
+ NOTE: the ILP prepare packet contains the following items, all encoded:
461
+ - The amount being sent (i.e. in the source currency)
462
+ - An expiry time
463
+ - The condition
464
+ - The name of the FXP
465
+ - The content of the conversion terms
466
+ end note
467
+
468
+ note left of FXP
469
+ **PUT /fxQuotes/$conversionRequestId**
470
+ {
471
+ "condition": "$fxCondition",
472
+ "conversionTerms": {
473
+ "conversionId": "$conversionId",
474
+ "initiatingFsp": "$payerFSPID",
475
+ "counterPartyFsp": "$fxpID",
476
+ "amountType": "SEND",
477
+ "sourceAmount": {
478
+ "currency": "$payerCurrency",
479
+ "amount": "$fxpSourceAmount"
480
+ },
481
+ "targetAmount": {
482
+ "currency": "$payeeCurrency",
483
+ "amount": "$fxpTargetAmount"
484
+ },
485
+ "expiration": "2021-08-25T14:17:09.663+01:00"
486
+ "charges": [
487
+ {
488
+ "chargeType": "string",
489
+ "sourceAmount": {
490
+ "currency": "$payerCurrency",
491
+ "amount": "$fxpChargesSource"
492
+ },
493
+ "targetAmount": {
494
+ "currency": "$payeeCurrency",
495
+ "amount": "$fxpChargesTarget"
496
+ }
497
+ }
498
+ ]
499
+ }
500
+ }
501
+ end note
502
+ !if ($shortCutSingleFXP != true)
503
+ FXP->>S1:Here's the signed conversion object
504
+ activate S1
505
+ !if ($simplified != true)
506
+ S1-->>FXP:200 Gotcha
507
+ !endif
508
+ deactivate FXP
509
+ S1->>D1:Here's the signed conversion object\n**PUT /fxQuotes/$conversionRequestId**
510
+ activate D1
511
+ !if ($simplified != true)
512
+ D1-->>S1:Gotcha
513
+ !endif
514
+ deactivate S1
515
+ !else
516
+ FXP-->>D1:Here's the signed conversion object\n**PUT /fxQuotes/$conversionRequestId**
517
+ !if ($simplified != true)
518
+ D1-->>FXP:202 I'll get back to you
519
+ !endif
520
+ activate D1
521
+ !endif
522
+
523
+
524
+ !if ($advancedCoreConnectorFlow != true)
525
+ D1-->PayerCC: Here are the conversion terms
526
+ note right of PayerCC
527
+ {
528
+ "transferId": "$transferId",
529
+ "homeTransactionId": "$homeTransactionId",
530
+ "from": {
531
+ "dateOfBirth": "$senderDOB",
532
+ "displayName": "$senderName",
533
+ "firstName": "$senderFirstName",
534
+ "middleName": "$senderMiddleName",
535
+ "lastName": "$senderLastName"
536
+ "fspId": "$payerFSPID",
537
+ "idType": "MSISDN",
538
+ "idValue": "$payerMSISDN"
539
+ },
540
+ "to": {
541
+ "type": "CONSUMER",
542
+ "idType": "MSISDN",
543
+ "idValue": "$payeeMSISDN",
544
+ "displayName": "$receiverName",
545
+ "firstName": "$receiverFirstName",
546
+ "middleName": "$receiverMiddleName",
547
+ "lastName": "$receiverLastName"
548
+ "dateOfBirth": "$receiverDOB",
549
+
550
+ "fspId": "$payeeFSPID"
551
+ "supportedCurrencies": [ "$payeeCurrency" ]
552
+ "kycInformation": "<Encrypted KYC Data>"
553
+ },
554
+ "amountType": "SEND",
555
+ "currency": "$payerCurrency",
556
+ "amount": "$payerSendAmount"
557
+ "currentState": "**WAITING_FOR_CONVERSION_ACCEPTANCE**",
558
+ "getPartiesResponse": {
559
+ <Same as the previous responses>
560
+ },
561
+ "conversionRequestId": "$conversionRequestId",
562
+ "fxQuotesResponse": {
563
+ "body": {
564
+ "condition": "$fxCondition",
565
+ "conversionTerms": {
566
+ "conversionId": "$conversionId",
567
+ "initiatingFsp": "$payerFSPID",
568
+ "counterPartyFsp": "$fxpID",
569
+ "amountType": "SEND",
570
+ "sourceAmount": {
571
+ "currency": "$payerCurrency",
572
+ "amount": "$fxpSourceAmount"
573
+ },
574
+ "targetAmount": {
575
+ "currency": "$payeeCurrency",
576
+ "amount": "$fxpTargetAmount"
577
+ },
578
+ "expiration": "2021-08-25T14:17:09.663+01:00"
579
+ "charges": [
580
+ {
581
+ "chargeType": "string",
582
+ "sourceAmount": {
583
+ "currency": "$payerCurrency",
584
+ "amount": "$fxpChargesSource"
585
+ },
586
+ "targetAmount": {
587
+ "currency": "$payeeCurrency",
588
+ "amount": "$fxpChargesTarget"
589
+ }
590
+ }
591
+ ]
592
+ }
593
+ },
594
+ "headers": {}
595
+ },
596
+ "fxQuotesResponseSource": "$payeeFSPID",
597
+ }
598
+ end note
599
+ !else
600
+ D1->PayerCC: Here are the conversion terms
601
+ !if ($simplified != true)
602
+ note right of PayerCC
603
+ {
604
+ "homeTransactionId": "$homeTransactionId",
605
+ "condition": "$fxCondition",
606
+ "conversionTerms": {
607
+ "conversionId": "$conversionId",
608
+ "initiatingFsp": "$payerFSPID",
609
+ "counterPartyFsp": "$fxpID",
610
+ "amountType": "SEND",
611
+ "sourceAmount": {
612
+ "currency": "$payerCurrency",
613
+ "amount": "$fxpSourceAmount"
614
+ },
615
+ "targetAmount": {
616
+ "currency": "$payeeCurrency",
617
+ "amount": "$fxpTargetAmount"
618
+ },
619
+ "expiration": "2021-08-25T14:17:09.663+01:00"
620
+ "charges": [
621
+ {
622
+ "chargeType": "string",
623
+ "sourceAmount": {
624
+ "currency": "$payerCurrency",
625
+ "amount": "$fxpChargesSource"
626
+ },
627
+ "targetAmount": {
628
+ "currency": "$payeeCurrency",
629
+ "amount": "$fxpChargesTarget"
630
+ }
631
+ }
632
+ ]
633
+ }
634
+ }
635
+ end note
636
+ !endif
637
+ !endif
638
+
639
+
640
+ == Agreement Phase ==
641
+
642
+
643
+ !if ($advancedCoreConnectorFlow != true)
644
+ PayerCC->D1: I want to get a quote from the FSP\nPUT /transfers
645
+ note right of PayerCC
646
+ {
647
+ "acceptConversion": true
648
+ }
649
+ end note
650
+ !else
651
+ PayerCC->D1: I want to get a quote from the FSP\n**POST /quotes**
652
+ !if ($simplified != true)
653
+ note right of PayerCC
654
+ {
655
+ "fspId": "$payeeFSPID",
656
+ "quotesPostRequest": {
657
+ "quoteId": "$quoteId",
658
+ "transactionId": "$transactionId",
659
+ "payee": {
660
+ "partyIdInfo": {
661
+ "partyIdType": "MSISDN",
662
+ "partyIdentifier": "$payeeMSISDN",
663
+ "fspId": "$payeeFSPID"
664
+ },
665
+ "name": "$receiverName",
666
+ "personalInfo": {
667
+ "complexName": {
668
+ "firstName": "$receiverFirstName",
669
+ "middleName": "$receiverMiddleName",
670
+ "lastName": "$receiverLastName"
671
+ },
672
+ "dateOfBirth": "$receiverDOB",
673
+ "kycInformation": "<Encrypted KYC Data>"
674
+ },
675
+ "supportedCurrencies": [ "$payeeCurrency" ]
676
+ },
677
+ "payer": {
678
+ "partyIdInfo": {
679
+ "partyIdType": "MSISDN",
680
+ "partyIdentifier": "$payerMSISDN",
681
+ "fspId": "$payerFSPID"
682
+ },
683
+ "name": "$senderName",
684
+ "personalInfo": {
685
+ "complexName": {
686
+ "firstName": "$senderFirstName",
687
+ "middleName": "$senderMiddleName",
688
+ "lastName": "$senderLastName"
689
+ },
690
+ "dateOfBirth": "$senderDOB"
691
+ }
692
+ },
693
+ "amountType": "SEND",
694
+ "amount": {
695
+ "currency": "$payeeCurrency",
696
+ "amount": "$fxpTargetAmount"
697
+ },
698
+ "converter": "PAYER",
699
+ "expiration": "$quotePayerExpiration"
700
+ }
701
+ }
702
+ end note
703
+ !endif
704
+ !endif
705
+
706
+
707
+ D1->>S1:Please quote for a transfer which sends $fxpTargetAmount $payeeCurrency.\n**POST /quotes**
708
+ !if ($simplified != true)
709
+ note right of D1
710
+ POST /quotes
711
+
712
+ {
713
+ "quoteId": "$quoteId",
714
+ "transactionId": "$transactionId",
715
+ "payee": {
716
+ "partyIdInfo": {
717
+ "partyIdType": "MSISDN",
718
+ "partyIdentifier": "$payeeMSISDN",
719
+ "fspId": "$payeeFSPID"
720
+ },
721
+ "name": "$receiverName",
722
+ "personalInfo": {
723
+ "complexName": {
724
+ "firstName": "$receiverFirstName",
725
+ "middleName": "$receiverMiddleName",
726
+ "lastName": "$receiverLastName"
727
+ },
728
+ "dateOfBirth": "$receiverDOB",
729
+ "kycInformation": "<Encrypted KYC Data>"
730
+ },
731
+ "supportedCurrencies": [ "$payeeCurrency" ]
732
+ },
733
+ "payer": {
734
+ "partyIdInfo": {
735
+ "partyIdType": "MSISDN",
736
+ "partyIdentifier": "$payerMSISDN",
737
+ "fspId": "$payerFSPID"
738
+ },
739
+ "name": "$senderName",
740
+ "personalInfo": {
741
+ "complexName": {
742
+ "firstName": "$senderFirstName",
743
+ "middleName": "$senderMiddleName",
744
+ "lastName": "$senderLastName"
745
+ },
746
+ "dateOfBirth": "$senderDOB"
747
+ }
748
+ },
749
+ "amountType": "SEND",
750
+ "amount": {
751
+ "currency": "$payeeCurrency",
752
+ "amount": "$fxpTargetAmount"
753
+ },
754
+ "converter": "PAYER",
755
+ "expiration": "$quotePayerExpiration"
756
+ }
757
+ end note
758
+ !endif
759
+ activate S1
760
+ !if ($simplified != true)
761
+ S1-->>D1:202 I'll get back to you
762
+ !endif
763
+
764
+ S1->>D2:**POST /quotes**
765
+ activate D2
766
+ !if ($simplified != true)
767
+ D2-->>S1:202 I'll get back to you
768
+ !endif
769
+ deactivate S1
770
+ D2->PayeeCC:**POST /quoterequests**
771
+ !if ($simplified != true)
772
+ note right of D2
773
+ {
774
+ "quoteId": "$quoteId",
775
+ "transactionId": "$transactionId",
776
+ "payee": {
777
+ "partyIdInfo": {
778
+ "partyIdType": "MSISDN",
779
+ "partyIdentifier": "$payeeMSISDN",
780
+ "fspId": "$payeeFSPID"
781
+ },
782
+ "name": "$receiverName",
783
+ "personalInfo": {
784
+ "complexName": {
785
+ "firstName": "$receiverFirstName",
786
+ "middleName": "$receiverMiddleName",
787
+ "lastName": "$receiverLastName"
788
+ },
789
+ "dateOfBirth": "$receiverDOB",
790
+ "kycInformation": "<Encrypted KYC Data>"
791
+ },
792
+ "supportedCurrencies": [ "$payeeCurrency" ]
793
+ },
794
+ "payer": {
795
+ "partyIdInfo": {
796
+ "partyIdType": "MSISDN",
797
+ "partyIdentifier": "$payerMSISDN",
798
+ "fspId": "$payerFSPID"
799
+ },
800
+ "name": "$senderName",
801
+ "personalInfo": {
802
+ "complexName": {
803
+ "firstName": "$senderFirstName",
804
+ "middleName": "$senderMiddleName",
805
+ "lastName": "$senderLastName"
806
+ },
807
+ "dateOfBirth": "$senderDOB"
808
+ }
809
+ },
810
+ "amountType": "SEND",
811
+ "amount": {
812
+ "currency": "$payeeCurrency",
813
+ "amount": "$fxpTargetAmount"
814
+ },
815
+ "converter": "PAYER",
816
+ "expiration": "$quotePayerExpiration"
817
+ }
818
+ end note
819
+ !endif
820
+ PayeeCC->PayeeCC:OK, so I will charge $payeeFee $payeeCurrency for this.\nNow I create terms of the transfer
821
+ PayeeCC-->D2:Here are the terms
822
+ !if ($simplified != true)
823
+ note right of D2
824
+ {
825
+ "quoteId": "$quoteId",
826
+ "transactionId": "$transactionId",
827
+ "payeeFspFeeAmount": "$payeeFee",
828
+ "payeeFspFeeAmountCurrency": "$payeeCurrency",
829
+ "payeeReceiveAmount": "$payeeReceiveAmount",
830
+ "payeeReceiveAmountCurrency": "$payeeCurrency",
831
+ "transferAmount": "$targetAmount",
832
+ "transferAmountCurrency": "$payeeCurrency"
833
+ "expiration": "$quotePayerExpiration"
834
+ }
835
+ end note
836
+ !endif
837
+ D2->D2:Now I will sign the transaction object
838
+ D2->>S1:Here's the signed quote
839
+ note left of D2
840
+ **put /quotes/$quoteId**
841
+
842
+ {
843
+ "transferAmount": {
844
+ "currency": "$payeeCurrency",
845
+ "amount": "$targetAmount"
846
+ },
847
+ "payeeReceiveAmount": {
848
+ "currency": "$payeeCurrency",
849
+ "amount": "$payeeReceiveAmount"
850
+ },
851
+ "payeeFspFee": {
852
+ "currency": "$payeeCurrency",
853
+ "amount": "$payeeFee"
854
+ },
855
+ "expiration": "$payeeQuoteExpiration",
856
+ "ilpPacket": "
857
+ <This is encoded transaction object. It contains data from quote request and response.>
858
+ ",
859
+ "condition": "$condition"
860
+ }
861
+
862
+ end note
863
+ activate S1
864
+ !if ($simplified != true)
865
+ S1-->>D2:200 Gotcha
866
+ !endif
867
+ deactivate D2
868
+ S1->>D1:Here's the signed quote\n**PUT /quotes/382987a8-75ce-4037-b500-c475e08c1727**
869
+ activate D1
870
+ !if ($simplified != true)
871
+ D1-->>S1:200 Gotcha
872
+ !endif
873
+ deactivate S1
874
+ D1->D1:OK, I can see that there are going to be $payeeFee $payeeCurrency in charges.
875
+
876
+ == Sender Confirmation ==
877
+
878
+ !if ($advancedCoreConnectorFlow != true)
879
+ D1-->PayerCC:Here's the quote for the transfer\nIt expires at $quotePayeeExpiration
880
+ note right of PayerCC
881
+ {
882
+ "transferId": "$transferId",
883
+ "homeTransactionId": "$homeTransactionId",
884
+ "from": {
885
+ "dateOfBirth": "$senderDOB",
886
+ "displayName": "$senderName",
887
+ "firstName": "$senderFirstName",
888
+ "middleName": "$senderMiddleName",
889
+ "lastName": "$senderLastName"
890
+ "fspId": "$payerFSPID",
891
+ "idType": "MSISDN",
892
+ "idValue": "$payerMSISDN"
893
+ },
894
+ "to": {
895
+ "type": "CONSUMER",
896
+ "idType": "MSISDN",
897
+ "idValue": "$payeeMSISDN",
898
+ "displayName": "$receiverName",
899
+ "firstName": "$receiverFirstName",
900
+ "middleName": "$receiverMiddleName",
901
+ "lastName": "$receiverLastName"
902
+ "dateOfBirth": "$receiverDOB",
903
+
904
+ "fspId": "$payeeFSPID"
905
+ "supportedCurrencies": [ "$payeeCurrency" ]
906
+ "kycInformation": "<Encrypted KYC Data>"
907
+ },
908
+ "amountType": "SEND",
909
+ "currency": "$payerCurrency",
910
+ "amount": "$payerSendAmount"
911
+ "currentState": "**WAITING_FOR_QUOTE_ACCEPTANCE**",
912
+ "getPartiesResponse": {
913
+ <Same as the previous responses>
914
+ },
915
+ "conversionRequestId": "$conversionRequestId",
916
+ "fxQuotesResponse": {
917
+ <Same as the previous responses>
918
+ },
919
+ "fxQuotesResponseSource": "$payeeFSPID",
920
+ "quoteId": "$quoteId",
921
+ "quoteResponse": {
922
+ "body": {
923
+ "transferAmount": {
924
+ "currency": "$payeeCurrency",
925
+ "amount": "$targetAmount"
926
+ },
927
+ "payeeReceiveAmount": {
928
+ "currency": "$payeeCurrency",
929
+ "amount": "$payeeReceiveAmount"
930
+ },
931
+ "payeeFspFee": {
932
+ "currency": "$payeeCurrency",
933
+ "amount": "$payeeFee"
934
+ },
935
+ "expiration": "$payeeQuoteExpiration",
936
+ "ilpPacket": "
937
+ <This is encoded transaction object. It contains data from quote request and response.>
938
+ ",
939
+ "condition": "$condition"
940
+ },
941
+ "headers": {}
942
+ },
943
+ "quoteResponseSource": "$payeeFSPID",
944
+ }
945
+ end note
946
+ !else
947
+ D1-->PayerCC:Here's the quote for the transfer\nIt expires at $quotePayeeExpiration
948
+ !if ($simplified != true)
949
+ note right of PayerCC
950
+ {
951
+ "quotes": {
952
+ "body": {
953
+ "transferAmount": {
954
+ "currency": "$payeeCurrency",
955
+ "amount": "$targetAmount"
956
+ },
957
+ "payeeReceiveAmount": {
958
+ "currency": "$payeeCurrency",
959
+ "amount": "$payeeReceiveAmount"
960
+ },
961
+ "payeeFspFee": {
962
+ "currency": "$payeeCurrency",
963
+ "amount": "$payeeFee"
964
+ },
965
+ "expiration": "$payeeQuoteExpiration",
966
+ "ilpPacket": "
967
+ <This is encoded transaction object. It contains data from quote request and response.>
968
+ ",
969
+ "condition": "$condition"
970
+ },
971
+ "headers": {}
972
+ },
973
+ "currentState": "COMPLETED"
974
+ }
975
+ end note
976
+ !endif
977
+ !endif
978
+ PayerCC->PayerCBS:Here's the quote
979
+ PayerCBS->A1:Hi, $senderName: I can do the transfer.\nIt'll cost you $totalChargesSourceCurrency $payerCurrency($totalChargesTargetCurrency $payeeCurrency) in fees\nand $receiverName will receive\n$payeeReceiveAmount $payeeCurrency.\nLet me know if you want to go ahead
980
+ A1->PayerCBS:Great! Yes please, go ahead
981
+
982
+ PayerCBS->PayerCC: Payer has accepted the terms please proceed
983
+
984
+ == Transfer Phase ==
985
+
986
+ !if ($advancedCoreConnectorFlow != true)
987
+ PayerCC->D1: Proceed with the transfer\nPUT /transfers
988
+ note right of PayerCC
989
+ {
990
+ "acceptQuote": true
991
+ }
992
+ end note
993
+ !else
994
+ PayerCC->D1: Proceed with the transfer\n**POST /fxTransfers**
995
+ !if ($simplified != true)
996
+ note right of PayerCC
997
+ {
998
+ "homeTransactionId": "$homeTransactionId",
999
+ "commitRequestId": "$commitRequestId",
1000
+ "determiningTransferId": "$determiningTransferId",
1001
+ "initiatingFsp": "$payerFSPID",
1002
+ "counterPartyFsp": "$fxpID",
1003
+ "amountType": "SEND",
1004
+ "sourceAmount": {
1005
+ "currency": "$payerCurrency",
1006
+ "amount": "$fxpSourceAmount"
1007
+ },
1008
+ "targetAmount": {
1009
+ "currency": "$payeeCurrency",
1010
+ "amount": "$fxpTargetAmount"
1011
+ },
1012
+ "condition": "$fxCondition"
1013
+ }
1014
+ end note
1015
+ !endif
1016
+ !endif
1017
+
1018
+ !if ($advancedCoreConnectorFlow != true)
1019
+ D1->D1:First, activate the conversion
1020
+ !endif
1021
+ D1->>S1:Please confirm your part of the transfer
1022
+ note right of D1
1023
+ **POST /fxTransfers**
1024
+ {
1025
+ "commitRequestId": "$commitRequestId",
1026
+ "determiningTransferId": "$determiningTransferId",
1027
+ "initiatingFsp": "$payerFSPID",
1028
+ "counterPartyFsp": "$fxpID",
1029
+ "amountType": "SEND",
1030
+ "sourceAmount": {
1031
+ "currency": "$payerCurrency",
1032
+ "amount": "$fxpSourceAmount"
1033
+ },
1034
+ "targetAmount": {
1035
+ "currency": "$payeeCurrency",
1036
+ "amount": "$fxpTargetAmount"
1037
+ },
1038
+ "condition": "$fxCondition"
1039
+ }
1040
+ end note
1041
+ activate S1
1042
+ !if ($simplified != true)
1043
+ S1-->>D1:202 I'll get back to you
1044
+ !endif
1045
+ deactivate D2
1046
+ !if ($hideSwitchDetail != true)
1047
+ S1->S1:OK, so this is an FX confirmation.
1048
+ S1->S1: Is there any transfer with determiningTransactionId?\nNo, it does'nt.
1049
+ !endif
1050
+ S1->S1: Liquidity check and reserve on Payer DFSP's account
1051
+ !if ($hideSwitchDetail != true)
1052
+ note over S1
1053
+ Reservations:
1054
+
1055
+ **$payerFSPID has a reservation of $fxpSourceAmount $payerCurrency**
1056
+ end note
1057
+ !endif
1058
+ S1->>FXP:Please confirm the currency conversion part of the transfer\n** POST /fxTransfers**
1059
+ activate FXP
1060
+ !if ($simplified != true)
1061
+ FXP-->>S1:202 I'll get back to you
1062
+ !endif
1063
+ deactivate S1
1064
+ FXP->FXPBackend:Reserve funds for FX conversion
1065
+ note right of FXP
1066
+ **POST /fxTransfers**
1067
+ {
1068
+ "homeTransactionId": "$homeTransactionId",
1069
+ "commitRequestId": "$commitRequestId",
1070
+ "determiningTransferId": "$determiningTransferId",
1071
+ "initiatingFsp": "$payerFSPID",
1072
+ "counterPartyFsp": "$fxpID",
1073
+ "amountType": "SEND",
1074
+ "sourceAmount": {
1075
+ "currency": "$payerCurrency",
1076
+ "amount": "$fxpSourceAmount"
1077
+ },
1078
+ "targetAmount": {
1079
+ "currency": "$payeeCurrency",
1080
+ "amount": "$fxpTargetAmount"
1081
+ },
1082
+ "condition": "$fxCondition"
1083
+ }
1084
+ end note
1085
+ FXPBackend-->FXP:Success
1086
+ note right of FXP
1087
+ {
1088
+ "homeTransactionId": "$homeTransactionId",
1089
+ "completedTimestamp": "2021-08-25T14:17:08.175+01:00",
1090
+ "conversionState": "RESERVED"
1091
+ }
1092
+ end note
1093
+ FXP->>S1:Confirmed. Here's the fulfilment
1094
+ note left of FXP
1095
+ **PUT /fxTransfers/$commitRequestId**
1096
+ {
1097
+ "fulfilment": "188909ceb6cd5c35d5c6b394f0a9e5a0571199c332fbd013dc1e6b8a2d5fff42",
1098
+ "completedTimestamp": "2021-08-25T14:17:08.175+01:00",
1099
+ "conversionState": "RESERVED"
1100
+ }
1101
+ end note
1102
+ activate S1
1103
+ !if ($simplified != true)
1104
+ S1-->>FXP:200 Gotcha
1105
+ !endif
1106
+ deactivate FXP
1107
+ !if ($simplified != true)
1108
+ S1->S1:Check fulfilment matches and cancel if not.
1109
+ alt Conversion failed
1110
+ S1->FXP:Sorry. Conversion failed
1111
+ note over FXP
1112
+ **PATCH /fxTransfers/$commitRequestId**
1113
+ {
1114
+ "completedTimestamp": "2021-08-25T14:17:08.175+01:00",
1115
+ "conversionState": "ABORTED"
1116
+ }
1117
+ end note
1118
+ activate FXP
1119
+ FXP-->S1:Acknowledged
1120
+ FXP->FXPBackend:Remove any reservations or obligations
1121
+ note right of FXP
1122
+ **PUT /fxTransfers/$commitRequestId**
1123
+ {
1124
+ "completedTimestamp": "2021-08-25T14:17:08.175+01:00",
1125
+ "conversionState": "ABORTED"
1126
+ }
1127
+ end note
1128
+ FXPBackend-->FXP:Ok
1129
+ deactivate FXP
1130
+
1131
+ S1->>D1:Sorry. Conversion failed
1132
+ note over S1
1133
+ **PUT /fxTransfers/$commitRequestId/error**
1134
+ {
1135
+ "errorCode": "9999"
1136
+ , "errorDescription": "Whatever the error was"
1137
+ }
1138
+ end note
1139
+ else Conversion succeeded
1140
+ S1->D1:Conversion succeeded subject to transfer success\n**PUT /fxTransfers/77c9d78d-c26a-4474-8b3c-99b96a814bfc**
1141
+
1142
+ end
1143
+ !else
1144
+ S1->D1:Conversion succeeded subject to transfer success\n**PUT /fxTransfers/77c9d78d-c26a-4474-8b3c-99b96a814bfc**
1145
+ !endif
1146
+ activate D1
1147
+ !if ($simplified != true)
1148
+ D1-->S1:200 Gotcha
1149
+ !endif
1150
+ deactivate S1
1151
+
1152
+ !if ($advancedCoreConnectorFlow != true)
1153
+ D1->D1:OK, so that's all right\nNow I can send the transfer itself
1154
+ ' TODO: Need to add PUT /transfers response here
1155
+ !else
1156
+ D1-->PayerCC:Confirmed. You can proceed with the transfer.
1157
+ note right of PayerCC
1158
+ **PUT /fxTransfers/$commitRequestId**
1159
+ {
1160
+ "fulfilment": "188909ceb6cd5c35d5c6b394f0a9e5a0571199c332fbd013dc1e6b8a2d5fff42",
1161
+ "completedTimestamp": "2021-08-25T14:17:08.175+01:00",
1162
+ "conversionState": "RESERVED"
1163
+ }
1164
+ end note
1165
+
1166
+ PayerCC-->D1:Please do the transfer **POST /simpleTransfers**
1167
+ !if ($simplified != true)
1168
+ note right of PayerCC
1169
+ {
1170
+ "fspId": "$payeeFSPID",
1171
+ "transfersPostRequest": {
1172
+ "transferId": "$transferId",
1173
+ "payeeFsp": "$payeeFSPID",
1174
+ "payerFsp": "$payerFSPID",
1175
+ "amount": {
1176
+ "currency": "$payeeCurrency",
1177
+ "amount": "$targetAmount"
1178
+ },
1179
+ "ilpPacket": "<Encoded transaction object>",
1180
+ "condition": "$condition",
1181
+ "expiration": "2016-05-24T08:38:08.699-04:00"
1182
+ }
1183
+ }
1184
+ end note
1185
+ !endif
1186
+ !endif
1187
+
1188
+ D1->S1:Please do the transfer **POST /transfers**
1189
+ !if ($simplified != true)
1190
+ note over D1
1191
+ POST /transfers
1192
+ {
1193
+ "transferId": "$transferId",
1194
+ "payeeFsp": "$payeeFSPID",
1195
+ "payerFsp": "$payerFSPID",
1196
+ "amount": {
1197
+ "currency": "$payeeCurrency",
1198
+ "amount": "$targetAmount"
1199
+ },
1200
+ "ilpPacket": "<Encoded transaction object>",
1201
+ "condition": "$condition",
1202
+ "expiration": "2016-05-24T08:38:08.699-04:00"
1203
+ }
1204
+ end note
1205
+ !endif
1206
+ activate S1
1207
+ !if ($simplified != true)
1208
+ S1-->D1:202 I'll get back to you
1209
+ !endif
1210
+ deactivate D1
1211
+ !if ($hideSwitchDetail != true)
1212
+ S1->S1:Is there a dependent transfer? Yes
1213
+ !endif
1214
+ S1->S1:Perform liquidity check and reserve funds\nagainst creditor party to dependent transfer
1215
+ note over S1
1216
+ Reservations:
1217
+
1218
+ $payerFSPID has a reservation of $fxpSourceAmount $payerCurrency
1219
+ **$fxpID has a reservation of $targetAmount $payeeCurrency**
1220
+ end note
1221
+
1222
+ S1->D2:Please do the transfer\n**POST /transfers**
1223
+ activate D2
1224
+ !if ($simplified != true)
1225
+ D2-->S1:202 I'll get back to you
1226
+ !endif
1227
+ deactivate S1
1228
+ 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
1229
+
1230
+ D2->PayeeCC:Please credit $receiverName's account with $payeeReceiveAmount $payeeCurrency
1231
+ !if ($simplified != true)
1232
+ note right of D2
1233
+ **POST /transfers**
1234
+ {
1235
+ "transferId": "$transferId",
1236
+ "amount": "$targetAmount",
1237
+ "currency": "$payeeCurrency",
1238
+ "amountType": "SEND",
1239
+ "from": {
1240
+ "dateOfBirth": "$senderDOB",
1241
+ "displayName": "$senderName",
1242
+ "firstName": "$senderFirstName",
1243
+ "middleName": "$senderMiddleName",
1244
+ "lastName": "$senderLastName"
1245
+ "fspId": "$payerFSPID",
1246
+ "idType": "MSISDN",
1247
+ "idValue": "$payerMSISDN"
1248
+ },
1249
+ "to": {
1250
+ "dateOfBirth": "$receiverDOB",
1251
+ "displayName": "$receiverName",
1252
+ "firstName": "$receiverFirstName",
1253
+ "middleName": "$receiverMiddleName",
1254
+ "lastName": "$receiverLastName",
1255
+ "fspId": "$payeeFSPID",
1256
+ "idType": "MSISDN",
1257
+ "idValue": "$payeeMSISDN"
1258
+ },
1259
+ "note": "string",
1260
+ "quote": {
1261
+ "quoteId": "$quoteId",
1262
+ "transactionId": "$transactionId",
1263
+ "payeeFspFeeAmount": "$payeeFee",
1264
+ "payeeFspFeeAmountCurrency": "$payeeCurrency",
1265
+ "payeeReceiveAmount": "$payeeReceiveAmount",
1266
+ "payeeReceiveAmountCurrency": "$payeeCurrency",
1267
+ "transferAmount": "$targetAmount",
1268
+ "transferAmountCurrency": "$payeeCurrency"
1269
+ "expiration": "$quotePayeeExpiration"
1270
+ },
1271
+ "transactionType": "TRANSFER",
1272
+ "ilpPacket": {
1273
+ "data": <decoded ilpPacket>
1274
+ }
1275
+ }
1276
+ end note
1277
+ !endif
1278
+
1279
+ PayeeCC-->D2:Done
1280
+ !if ($simplified != true)
1281
+ note right of D2
1282
+ {
1283
+ "homeTransactionId": "string",
1284
+ "completedTimestamp": "2021-08-25T14:17:08.227+01:00",
1285
+ "fulfilment": "mhPUT9ZAwd-BXLfeSd7-YPh46rBWRNBiTCSWjpku90s",
1286
+ **Note: fulfilment is optional: SDK will create if not found**
1287
+ "transferState": "COMMITTED"
1288
+ }
1289
+ end note
1290
+ !endif
1291
+
1292
+ D2->>S1:Transfer is confirmed, here's the fulfilment
1293
+ note over D2
1294
+ **PUT /transfers/$commitRequestId**
1295
+ {
1296
+ "completedTimestamp": "2021-08-25T14:17:08.227+01:00",
1297
+ "fulfilment": "mhPUT9ZAwd-BXLfeSd7-YPh46rBWRNBiTCSWjpku90s",
1298
+ "transferState": "COMMITTED"
1299
+ }
1300
+ end note
1301
+ activate S1
1302
+ !if ($simplified != true)
1303
+ S1-->>D2:200 Gotcha
1304
+ !endif
1305
+ deactivate D2
1306
+ !if ($hideSwitchDetail != true)
1307
+ S1->S1:Is there a dependent transfer?\nYes, there is.
1308
+ S1->S1:Is this dependency against the debtor party to the transfer?\nYes, it is.
1309
+ S1->S1:Create an obligation from the debtor party to the party named in the dependency (the FXP)
1310
+ S1->S1:Is the transfer denominated in the currency of the payee receive amount?\nYes, it is.
1311
+ S1->S1:Create an obligation from the party named in the dependency\nto the creditor party for the transfer
1312
+ !else
1313
+ S1->S1:Create obligations from the payer to the FXP and from FXP to the payee
1314
+ !endif
1315
+ S1->>FXP:The transfer succeeded.\nYou can clear it in your ledgers
1316
+ note over S1
1317
+ **PATCH /fxTransfers/$commitRequestId**
1318
+ {
1319
+ "completedTimestamp": "2021-08-25T14:17:08.227+01:00",
1320
+ "fulfilment": "mhPUT9ZAwd-BXLfeSd7-YPh46rBWRNBiTCSWjpku90s",
1321
+ "transferState": "COMMITTED"
1322
+ }
1323
+ end note
1324
+ activate FXP
1325
+ FXP->FXP:Let's just check: does this match the stuff I sent?
1326
+ FXP->FXP:It does. Great. I'll clear the conversion
1327
+ FXP-->>S1:200 Gotcha
1328
+ deactivate FXP
1329
+ note over S1
1330
+ Ledger positions:
1331
+ $payerFSPID has a debit of $fxpSourceAmount $payerCurrency
1332
+ $fxpID has a credit of $fxpSourceAmount $payerCurrency
1333
+ $fxpID has a debit of $fxpTargetAmount $payeeCurrency
1334
+ $payeeFSPID has a credit of $targetAmount $payeeCurrency
1335
+ end note
1336
+ S1->>D1:Transfer is complete\n**PUT /transfers/$commitRequestId**
1337
+ activate D1
1338
+ !if ($simplified != true)
1339
+ D1-->S1:200 Gotcha
1340
+ !endif
1341
+ deactivate S1
1342
+ !if ($advancedCoreConnectorFlow != true)
1343
+ D1-->PayerCC:Transfer was completed successfully
1344
+ note right of PayerCC
1345
+ {
1346
+ "transferId": "$transferId",
1347
+ "homeTransactionId": "$homeTransactionId",
1348
+ "from": {
1349
+ "dateOfBirth": "$senderDOB",
1350
+ "displayName": "$senderName",
1351
+ "firstName": "$senderFirstName",
1352
+ "middleName": "$senderMiddleName",
1353
+ "lastName": "$senderLastName"
1354
+ "fspId": "$payerFSPID",
1355
+ "idType": "MSISDN",
1356
+ "idValue": "$payerMSISDN"
1357
+ },
1358
+ "to": {
1359
+ "type": "CONSUMER",
1360
+ "idType": "MSISDN",
1361
+ "idValue": "$payeeMSISDN",
1362
+ "displayName": "$receiverName",
1363
+ "firstName": "$receiverFirstName",
1364
+ "middleName": "$receiverMiddleName",
1365
+ "lastName": "$receiverLastName"
1366
+ "dateOfBirth": "$receiverDOB",
1367
+
1368
+ "fspId": "$payeeFSPID"
1369
+ "supportedCurrencies": [ "$payeeCurrency" ]
1370
+ "kycInformation": "<Encrypted KYC Data>"
1371
+ },
1372
+ "amountType": "SEND",
1373
+ "currency": "$payerCurrency",
1374
+ "amount": "$payerSendAmount"
1375
+ "currentState": "**COMPLETED**",
1376
+ "getPartiesResponse": {
1377
+ <Same as the previous responses>
1378
+ },
1379
+ "conversionRequestId": "$conversionRequestId",
1380
+ "fxQuotesResponse": {
1381
+ <Same as the previous responses>
1382
+ },
1383
+ "fxQuotesResponseSource": "$payeeFSPID",
1384
+ "quoteId": "$quoteId",
1385
+ "quoteResponse": {
1386
+ <Same as the previous responses>
1387
+ },
1388
+ "quoteResponseSource": "$payeeFSPID",
1389
+ "fulfil": {
1390
+ "body": {
1391
+ "completedTimestamp": "2021-08-25T14:17:08.227+01:00",
1392
+ "fulfilment": "mhPUT9ZAwd-BXLfeSd7-YPh46rBWRNBiTCSWjpku90s",
1393
+ "transferState": "COMMITTED"
1394
+ },
1395
+ "headers": {}
1396
+ },
1397
+ }
1398
+ end note
1399
+ !else
1400
+ D1-->PayerCC:Transfer was completed successfully
1401
+ !if ($simplified != true)
1402
+ note right of PayerCC
1403
+ {
1404
+ "transfer": {
1405
+ "body": {
1406
+ "completedTimestamp": "2021-08-25T14:17:08.227+01:00",
1407
+ "fulfilment": "mhPUT9ZAwd-BXLfeSd7-YPh46rBWRNBiTCSWjpku90s",
1408
+ "transferState": "COMMITTED"
1409
+ },
1410
+ "headers": {}
1411
+ },
1412
+ "currentState": "COMPLETED"
1413
+ }
1414
+ end note
1415
+ !endif
1416
+ !endif
1417
+
1418
+ PayerCC->PayerCBS:Transfer was completed successfully
1419
+ PayerCBS->PayerCBS:Commit the funds in my ledgers
1420
+ PayerCBS->A1:Your transfer is successful
1421
+ deactivate D1
1422
+
1423
+ @enduml