impl msg mock

This commit is contained in:
D065023
2019-12-06 14:35:02 +01:00
parent a191ecf88d
commit e6d5183cce
4 changed files with 27 additions and 8 deletions

View File

@@ -0,0 +1,6 @@
PATCH http://localhost:4004/api-business-partner/A_BusinessPartnerAddress(BusinessPartner='ANONYMOUS',AddressID='62640')
Content-Type: application/json
{
"PostalCode": "123456"
}

View File

@@ -14,7 +14,7 @@ const bupaSrv = cds.connect.to('API_BUSINESS_PARTNER')
const messagingSrv = cds.connect.to('messaging')
messagingSrv.on('sap/messaging/ccf/BO/BusinessPartner/Changed', async msg => {
console.log('>> MSG', msg.data)
console.log('>> Message:', msg.data)
const BusinessPartner = msg.data.KEY[0].BUSINESSPARTNER
// TODO: Remove toLower hack.
// Every BusinessPartner from S/4HANA is UPPERCASE.

View File

@@ -0,0 +1,13 @@
module.exports = srv => {
srv.on('UPDATE', req => {
const payload = {
KEY: [{ BUSINESSPARTNER: req.user.id }]
}
console.log('<< Message:', payload)
srv.emit('sap/messaging/ccf/BO/BusinessPartner/Changed', payload)
})
}

View File

@@ -10,7 +10,7 @@ module.exports = db => {
AddressID: '62640',
CityName: 'Walldorf',
PostalCode: '69190',
Country: 'Germany',
Country: 'GER',
StreetName: 'Dietmar-Hopp-Allee',
HouseNumber: '16'
},
@@ -19,7 +19,7 @@ module.exports = db => {
AddressID: '22222',
CityName: 'St. Leon-Rot',
PostalCode: '68789',
Country: 'Germany',
Country: 'GER',
StreetName: 'SAP-Allee',
HouseNumber: '25'
},
@@ -28,7 +28,7 @@ module.exports = db => {
AddressID: '62640',
CityName: 'Walldorf',
PostalCode: '69190',
Country: 'Germany',
Country: 'GER',
StreetName: 'Dietmar-Hopp-Allee',
HouseNumber: '16'
},
@@ -37,7 +37,7 @@ module.exports = db => {
AddressID: '22222',
CityName: 'St. Leon-Rot',
PostalCode: '68789',
Country: 'Germany',
Country: 'GER',
StreetName: 'SAP-Allee',
HouseNumber: '25'
},
@@ -46,7 +46,7 @@ module.exports = db => {
AddressID: '28241',
CityName: 'Palo Alto',
PostalCode: '94306',
Country: 'United States',
Country: 'USA',
StreetName: 'Hillview Avenue',
HouseNumber: '26'
},
@@ -55,7 +55,7 @@ module.exports = db => {
AddressID: '28244',
CityName: 'Hallbergmoos',
PostalCode: '85396',
Country: 'Germany',
Country: 'GER',
StreetName: 'Zeppelinstraße',
HouseNumber: '93'
},
@@ -64,7 +64,7 @@ module.exports = db => {
AddressID: '28247',
CityName: 'Potsdam',
PostalCode: '14467',
Country: 'Germany',
Country: 'GER',
StreetName: 'Konrad-Zuse-Ring',
HouseNumber: '29'
}