forked from mojaloop/ml-api-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/Bulk Transfers POC - Bulk prepare (mojaloop#116)
* package-lock.json * Fix issues with object store usage * Additional changes to Object Store and Kafka config * Add MONGODB.URI config * Updated package.json * Add license info * Updated integration tests run config * Init BulkProcessingHandler * WIP #1 * message.id=uuid() during Transfer Prepare * Removed kafkaConf.key Switched to message.id=UUID for fulfil and get 28 unit tests fail * Fixed unit tests * Unifying mongo schema definitions * Finilize ml-api-adapter, but unit tests hang * Fix mongoose unique index issue * Fixed integration tests: uriParams added * Changes as per PR review comments * Putting central-object-store library - wip * Re-factored objStore lib to be re-usable between both ml-api and central-ledger * Fixing issue with unit tests * Fix standard issues * Add mdebarros as contributor and remove unused code * Removing local objectStoreLib * updated objectstore connection server setup to handle bad connection
- Loading branch information
Showing
21 changed files
with
378 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
- Name Surname <[email protected]> | ||
* Georgi Georgiev <[email protected]> | ||
* Miguel de Barros <[email protected]> | ||
* Valentin Genev <[email protected]> | ||
-------------- | ||
******/ | ||
|
@@ -31,8 +32,9 @@ | |
const TransferService = require('../../domain/transfer') | ||
const Logger = require('@mojaloop/central-services-shared').Logger | ||
const Boom = require('boom') | ||
const { BulkTransferModel } = require('../models/bulkTransfers/bulkModels') | ||
const BulkTransferModels = require('@mojaloop/central-object-store').Models.BulkTransfer | ||
const Util = require('../../lib/util') | ||
const Uuid = require('uuid4') | ||
|
||
/** | ||
* Operations on /bulkTransfers | ||
|
@@ -48,12 +50,14 @@ module.exports = { | |
post: async function postBulkTransfers (request, h) { | ||
try { | ||
Logger.debug('create::payload(%s)', JSON.stringify(request.payload)) | ||
let { bulkTransferId, bulkQuoteId, payerFsp, payeeFsp, expiration, extensionList } = request.payload | ||
let hash = Util.createHash(JSON.stringify(request.payload)) | ||
let newBulk = new BulkTransferModel(Object.assign({}, { headers: request.headers }, request.payload)) | ||
const { bulkTransferId, bulkQuoteId, payerFsp, payeeFsp, expiration, extensionList } = request.payload | ||
const hash = Util.createHash(JSON.stringify(request.payload)) | ||
const messageId = Uuid() | ||
let BulkTransferModel = BulkTransferModels.getBulkTransferModel() | ||
const newBulk = new BulkTransferModel(Object.assign({}, { messageId, headers: request.headers }, request.payload)) | ||
await newBulk.save() | ||
let message = { bulkTransferId, bulkQuoteId, payerFsp, payeeFsp, expiration, extensionList, hash } | ||
await TransferService.bulkPrepare(request.headers, message) | ||
const message = { bulkTransferId, bulkQuoteId, payerFsp, payeeFsp, expiration, extensionList, hash } | ||
await TransferService.bulkPrepare(messageId, request.headers, message) | ||
return h.response().code(202) | ||
} catch (err) { | ||
Logger.error(err) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,13 +22,14 @@ | |
* Gates Foundation | ||
- Name Surname <[email protected]> | ||
* Georgi Georgiev <[email protected]> | ||
* Valentin Genev <[email protected]> | ||
-------------- | ||
******/ | ||
'use strict' | ||
|
||
const Boom = require('boom') | ||
const { IndividualTransferModel } = require('../../models/bulkTransfers/bulkModels') | ||
const BulkTransferModels = require('@mojaloop/central-object-store').Models.BulkTransfer | ||
|
||
/** | ||
* Operations on /bulkTransfers/{id} | ||
|
@@ -43,10 +44,11 @@ module.exports = { | |
*/ | ||
get: async function getBulkTransfersId (request, h) { | ||
let { id } = request.params | ||
let IndividualTransferModel = BulkTransferModels.getIndividualTransferModel() | ||
try { | ||
let indvidualTransfers = await IndividualTransferModel | ||
.find({ bulkTransferId: id }, '-dataUri -_id') | ||
.populate('bulkDocument', 'headers -_id') // TODO in bulk-handler first get only headers, then compose each individual transfer without population | ||
.populate('_id_bulkTransfers', 'headers -_id') // TODO in bulk-handler first get only headers, then compose each individual transfer without population | ||
return h.response(indvidualTransfers) | ||
} catch (e) { | ||
throw e | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.