Skip to content

Commit 094daf8

Browse files
authored
Merge pull request #115 from mojaloop/dev
feat: return transaction purpose during POST /transfers
2 parents 390e8e1 + fd3cd14 commit 094daf8

File tree

7 files changed

+52
-106
lines changed

7 files changed

+52
-106
lines changed

airtel-zm-core-connector/src/domain/coreConnectorAgg.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,13 @@ export class CoreConnectorAggregate {
464464
'currency': amountType === "SEND" ? transfer.sendCurrency : transfer.receiveCurrency,
465465
'amount': transfer.sendAmount,
466466
'transactionType': transfer.transactionType,
467-
'quoteRequestExtensions': this.getOutboundTransferExtensionList(transfer),
468-
'transferRequestExtensions': this.getOutboundTransferExtensionList(transfer)
467+
'quoteRequestExtensions': this.getOutboundTransferExtensionList(transfer, amountType),
468+
'transferRequestExtensions': this.getOutboundTransferExtensionList(transfer, amountType)
469469
};
470470
}
471471

472472
// Get OutBound Transfer Extension List DTO used in getTSDKOutboundTransferRequest DTO --(5.1.1)
473-
private getOutboundTransferExtensionList(sendMoneyRequestPayload: TAirtelSendMoneyRequest): TPayerExtensionListEntry[] | undefined {
473+
private getOutboundTransferExtensionList(sendMoneyRequestPayload: TAirtelSendMoneyRequest, amountType: "SEND"| "RECEIVE"): TPayerExtensionListEntry[] | undefined {
474474
if (sendMoneyRequestPayload.payer.DateAndPlaceOfBirth) {
475475
return [
476476
{
@@ -488,6 +488,10 @@ export class CoreConnectorAggregate {
488488
{
489489
"key": "CdtTrfTxInf.Dbtr.PrvtId.DtAndPlcOfBirth.CtryOfBirth",
490490
"value": sendMoneyRequestPayload.payer.DateAndPlaceOfBirth.CtryOfBirth
491+
},
492+
{
493+
"key":"CdtTrfTxInf.Purp.Cd",
494+
"value":amountType === "SEND" ? "MP2P" : "IPAY"
491495
}
492496
];
493497
}

core-connector-template/src/api-spec/core-connector-api-spec-dfsp.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,9 @@ components:
291291
fspId:
292292
type: string
293293
example: "airtelzambia"
294-
firstName:
294+
name:
295295
type: string
296296
example: "Niza"
297-
lastName:
298-
type: string
299-
example: "Tembo"
300-
dateOfBirth:
301-
type: string
302-
example: "1997/09/04"
303-
304297
receiveAmount:
305298
type: string
306299
example: "140.00"
@@ -331,15 +324,9 @@ components:
331324
fspId:
332325
type: string
333326
example: "airtelzambia"
334-
firstName:
327+
name:
335328
type: string
336329
example: "Niza"
337-
lastName:
338-
type: string
339-
example: "Tembo"
340-
dateOfBirth:
341-
type: string
342-
example: "1997/09/04"
343330

344331
receiveAmount:
345332
type: string

core-connector-template/src/domain/CBSClient/types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ export type TCbsSendMoneyResponse = {
6363
"idType": string;
6464
"idValue": string;
6565
"fspId": string;
66-
"firstName": string;
67-
"lastName": string;
68-
"dateOfBirth": string;
66+
"name": string;
6967
},
7068
"receiveAmount": string;
7169
"receiveCurrency": string;

core-connector-template/src/domain/SDKClient/types.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,17 @@ export type TSDKOutboundTransferResponse = {
6161
currentState?: components["schemas"]["transferStatus"];
6262
quoteId?: components["schemas"]["CorrelationId"];
6363
getPartiesResponse?: {
64-
body: Record<string, never>;
64+
body: {
65+
party: {
66+
partyIdInfo: {
67+
partyIdType: string,
68+
partyIdentifier: string,
69+
fspId: string
70+
},
71+
name: string,
72+
supportedCurrencies: string[],
73+
}
74+
};
6575
headers?: Record<string, never>;
6676
};
6777
quoteResponse?: {
@@ -94,7 +104,7 @@ export type TSDKTransferContinuationRequest =
94104
| components['schemas']['transferContinuationAcceptQuoteOrConversion'];
95105

96106

97-
export type TtransferContinuationResponse = SDKSchemeAdapter.V2_0_0.Outbound.Types.transferResponse;
107+
export type TtransferContinuationResponse = TSDKOutboundTransferResponse;
98108

99109
export type TSDKClientDeps = {
100110
logger: ILogger;

core-connector-template/src/domain/coreConnectorAgg.ts

Lines changed: 16 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
TCbsCollectMoneyResponse,
3535
TCBSConfig,
3636
TCbsDisbursementRequestBody,
37-
TCbsDisbursementResponse,
3837
TCbsKycResponse,
3938
TCbsRefundMoneyRequest,
4039
TCbsSendMoneyRequest,
@@ -111,74 +110,6 @@ export class CoreConnectorAggregate implements ICoreConnectorAggregate {
111110
{
112111
"key": "Rpt.UpdtdPtyAndAcctId.Agt.FinInstnId.LEI",
113112
"value": config.get("cbs.LEI")
114-
},
115-
{
116-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.AdrTp.Cd",
117-
"value": "Not Provided by CBS"
118-
},
119-
{
120-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.Dept",
121-
"value": "Not Provided by CBS"
122-
},
123-
{
124-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.SubDept",
125-
"value": "Not Provided by CBS"
126-
},
127-
{
128-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.StrtNm",
129-
"value": "Not Provided by CBS"
130-
},
131-
{
132-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.BldgNb",
133-
"value": "Not Provided by CBS"
134-
},
135-
{
136-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.BldgNm",
137-
"value": "Not Provided by CBS"
138-
},
139-
{
140-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.Flr",
141-
"value": "Not Provided by CBS"
142-
},
143-
{
144-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.PstBx",
145-
"value": "Not Provided by CBS"
146-
},
147-
{
148-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.Room",
149-
"value": "Not Provided by CBS"
150-
},
151-
{
152-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.PstCd",
153-
"value": "Not Provided by CBS"
154-
},
155-
{
156-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.TwnNm",
157-
"value": "Not Provided by CBS"
158-
},
159-
{
160-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.TwnLctnNm",
161-
"value": "Not Provided by CBS"
162-
},
163-
{
164-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.DstrctNm",
165-
"value": "Not Provided by CBS"
166-
},
167-
{
168-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.CtrySubDvsn",
169-
"value": "Not Provided by CBS"
170-
},
171-
{
172-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.Ctry",
173-
"value": config.get("cbs.X_COUNTRY")
174-
},
175-
{
176-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.PstlAdr.AdrLine",
177-
"value": "Not Provided by CBS"
178-
},
179-
{
180-
"key": "Rpt.UpdtdPtyAndAcctId.Pty.CtryOfRes",
181-
"value": config.get("cbs.X_COUNTRY")
182113
}
183114
]
184115
}
@@ -232,7 +163,14 @@ export class CoreConnectorAggregate implements ICoreConnectorAggregate {
232163

233164
private getQuoteResponseExtensionList(quoteRequest: TQuoteRequest): TPayeeExtensionListEntry[] {
234165
return [
235-
...this.getGetPartiesExtensionList()
166+
{
167+
"key": "CdtTrfTxInf.Cdtr.PstlAdr.Ctry",
168+
"value": config.get("cbs.X_COUNTRY")
169+
},
170+
{
171+
"key": "CdtTrfTxInf.CdtrAgt.FinInstnId.LEI",
172+
"value": config.get("cbs.LEI")
173+
}
236174
]
237175
}
238176

@@ -564,9 +502,7 @@ export class CoreConnectorAggregate implements ICoreConnectorAggregate {
564502
"idType": transfer.to.idType,
565503
"idValue": transfer.to.idValue,
566504
"fspId": transfer.to.fspId !== undefined ? transfer.to.fspId : "No FSP ID Returned",
567-
"firstName": transfer.to.firstName !== undefined ? transfer.to.firstName : "No First Name Returned",
568-
"lastName": transfer.to.lastName !== undefined ? transfer.to.lastName : "No Last Name Returned",
569-
"dateOfBirth": transfer.to.dateOfBirth !== undefined ? transfer.to.dateOfBirth : "No Date of Birth Returned",
505+
"name": transfer.getPartiesResponse?.body.party.name !== undefined ? transfer.getPartiesResponse?.body.party.name: ""
570506
},
571507
"receiveAmount": transfer.quoteResponse?.body.payeeReceiveAmount?.amount !== undefined ? transfer.quoteResponse.body.payeeReceiveAmount.amount : "No payee receive amount",
572508
"receiveCurrency": transfer.fxQuoteResponse?.body.conversionTerms.targetAmount.currency !== undefined ? transfer.fxQuoteResponse?.body.conversionTerms.targetAmount.currency : "No Currency returned from Mojaloop Connector",
@@ -600,12 +536,12 @@ export class CoreConnectorAggregate implements ICoreConnectorAggregate {
600536
'currency': amountType === "SEND" ? transfer.sendCurrency : transfer.receiveCurrency,
601537
'amount': transfer.sendAmount,
602538
'transactionType': transfer.transactionType,
603-
'quoteRequestExtensions': this.getOutboundTransferExtensionList(transfer),
604-
'transferRequestExtensions': this.getOutboundTransferExtensionList(transfer)
539+
'quoteRequestExtensions': this.getOutboundTransferExtensionList(transfer,amountType),
540+
'transferRequestExtensions': this.getOutboundTransferExtensionList(transfer,amountType)
605541
};
606542
}
607543

608-
private getOutboundTransferExtensionList(sendMoneyRequestPayload: TCbsSendMoneyRequest): TPayerExtensionListEntry[] | undefined {
544+
private getOutboundTransferExtensionList(sendMoneyRequestPayload: TCbsSendMoneyRequest,amountType: "SEND"|"RECEIVE"): TPayerExtensionListEntry[] | undefined {
609545
if (sendMoneyRequestPayload.payer.DateAndPlaceOfBirth) {
610546
return [
611547
{
@@ -623,6 +559,10 @@ export class CoreConnectorAggregate implements ICoreConnectorAggregate {
623559
{
624560
"key": "CdtTrfTxInf.Dbtr.PrvtId.DtAndPlcOfBirth.CtryOfBirth",
625561
"value": sendMoneyRequestPayload.payer.DateAndPlaceOfBirth.CtryOfBirth
562+
},
563+
{
564+
"key":"CdtTrfTxInf.Purp.Cd",
565+
"value":amountType === "SEND" ? "MP2P" : "IPAY"
626566
}
627567
];
628568
}

mtn-ug-core-connector/src/domain/coreConnectorAgg.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,13 +472,13 @@ export class CoreConnectorAggregate {
472472
'currency': amountType === "SEND" ? transfer.sendCurrency : transfer.receiveCurrency,
473473
'amount': transfer.sendAmount,
474474
'transactionType': transfer.transactionType,
475-
'quoteRequestExtensions': this.getOutboundTransferExtensionList(transfer),
476-
'transferRequestExtensions': this.getOutboundTransferExtensionList(transfer)
475+
'quoteRequestExtensions': this.getOutboundTransferExtensionList(transfer, amountType),
476+
'transferRequestExtensions': this.getOutboundTransferExtensionList(transfer,amountType)
477477
};
478478
}
479479

480480

481-
private getOutboundTransferExtensionList(sendMoneyRequestPayload: TMTNSendMoneyRequest): TPayerExtensionListEntry[] | undefined {
481+
private getOutboundTransferExtensionList(sendMoneyRequestPayload: TMTNSendMoneyRequest, amountType: "SEND" | "RECEIVE"): TPayerExtensionListEntry[] | undefined {
482482
if (sendMoneyRequestPayload.payer.DateAndPlaceOfBirth) {
483483
return [
484484
{
@@ -496,6 +496,10 @@ export class CoreConnectorAggregate {
496496
{
497497
"key": "CdtTrfTxInf.Dbtr.PrvtId.DtAndPlcOfBirth.CtryOfBirth",
498498
"value": sendMoneyRequestPayload.payer.DateAndPlaceOfBirth.CtryOfBirth
499+
},
500+
{
501+
"key":"CdtTrfTxInf.Purp.Cd",
502+
"value":amountType === "SEND" ? "MP2P" : "IPAY"
499503
}
500504
];
501505
}

tnm-mw-core-connector/src/domain/coreConnectorAgg.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ export class CoreConnectorAggregate implements ICoreConnectorAggregate {
542542
"firstName": res.data.full_name,
543543
"middleName": res.data.full_name,
544544
"lastName": res.data.full_name,
545-
"extensionList": this.getOutboundTransferExtensionList(transfer),
546545
"supportedCurrencies": [this.tnmConfig.TNM_CURRENCY]
547546
},
548547
'to': {
@@ -553,12 +552,12 @@ export class CoreConnectorAggregate implements ICoreConnectorAggregate {
553552
'currency': amountType === "SEND" ? transfer.sendCurrency : transfer.receiveCurrency,
554553
'amount': transfer.sendAmount,
555554
'transactionType': transfer.transactionType,
556-
'quoteRequestExtensions': this.getOutboundTransferExtensionList(transfer),
557-
'transferRequestExtensions': this.getOutboundTransferExtensionList(transfer)
555+
'quoteRequestExtensions': this.getOutboundTransferExtensionList(transfer, amountType),
556+
'transferRequestExtensions': this.getOutboundTransferExtensionList(transfer,amountType)
558557
};
559558
}
560559

561-
private getOutboundTransferExtensionList(sendMoneyRequestPayload: TNMSendMoneyRequest): TPayerExtensionListEntry[] | undefined {
560+
private getOutboundTransferExtensionList(sendMoneyRequestPayload: TNMSendMoneyRequest, amountType: "SEND" | "RECEIVE"): TPayerExtensionListEntry[] | undefined {
562561
if (sendMoneyRequestPayload.payer.DateAndPlaceOfBirth) {
563562
return [
564563
{
@@ -576,6 +575,10 @@ export class CoreConnectorAggregate implements ICoreConnectorAggregate {
576575
{
577576
"key": "CdtTrfTxInf.Dbtr.PrvtId.DtAndPlcOfBirth.CtryOfBirth",
578577
"value": sendMoneyRequestPayload.payer.DateAndPlaceOfBirth.CtryOfBirth
578+
},
579+
{
580+
"key":"CdtTrfTxInf.Purp.Cd",
581+
"value":amountType === "SEND" ? "MP2P" : "IPAY"
579582
}
580583
];
581584
}

0 commit comments

Comments
 (0)