Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/joiValidations/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const getCustomerResultSchema = joi.object().keys({
prospectClient: joi.string().allow(null, ''),
adminFee: joi.string().allow(null, ''),
udf: joi.string().allow(null, ''),
tinNumber: joi.string().allow(null, ''),
kycValue: joi.string().allow(null, ''),
stateValue: joi.string().allow(null, ''),
cbsPort: joi.string().allow(null, ''),
Expand Down
2 changes: 1 addition & 1 deletion lib/joiValidations/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ module.exports = {
const schema = joi.array().items(joi.object({
roleId: joi.number(),
name: joi.string().allow(null, ''),
isAssigned: joi.number().allow([0, 1]),
isAssigned: joi.boolean().allow(0, 1, '0', '1'),
isDefault: joi.boolean().allow(0, 1, '0', '1', null),
isEnabled: joi.boolean().allow(0, 1, '0', '1', null)
}));
Expand Down
86 changes: 43 additions & 43 deletions lib/methods/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,47 @@ const agentJoiValidation = require('./../joiValidations/agent');

module.exports = {
// network
addNetwork: function(stepname, contextStep) {
return commonFunc.createStep('agent.network.add', stepname, context => agentParams.addNetworkParams(context, contextStep),
(result, assert) => {
// console.log(result);
assert.equals(agentJoiValidation.validateAddNetwork(result.network).error, null, 'return all details after adding network');
assert.true(result.network[0].isNew, 'return isNew = true');
});
},
getNetwork: function(stepname, contextStep) {
return commonFunc.createStep('agent.network.get', stepname, context => agentParams.actorIdParams(context, contextStep),
(result, assert) => {
// console.log(result);
assert.equals(agentJoiValidation.validateGetNetwork(result.network).error, null, 'return all details after getting network');
});
},
fetchNetwork: function(stepname, contextStep) {
return commonFunc.createStep('agent.network.fetch', stepname, context => agentParams.fetchNetworkParams(context, contextStep),
(result, assert) => {
// console.log(result);
assert.equals(agentJoiValidation.validateFetchNetwork(result.network).error, null, 'return all details after fetching networks');
});
},
approveNetwork: function(stepname, contextStep) {
return commonFunc.createStep('agent.network.approve', stepname, context => agentParams.actorIdParams(context, contextStep),
(result, assert) => {
// console.log(result);
assert.same(result, [], 'return empty resultset after approve network');
});
},
rejectNetwork: function(stepname, contextStep) {
return commonFunc.createStep('agent.network.reject', stepname, context => agentParams.rejectNetworkParams(context, contextStep),
(result, assert) => {
// console.log(result);
assert.same(result, [], 'return empty resultset after reject network');
});
},
discardNetwork: function(stepname, contextStep) {
return commonFunc.createStep('agent.network.discard', stepname, context => agentParams.actorIdParams(context, contextStep),
(result, assert) => {
// console.log(result);
assert.same(result, [], 'return empty resultset after discard network');
});
}
// addNetwork: function(stepname, contextStep) {
// return commonFunc.createStep('agent.network.add', stepname, context => agentParams.addNetworkParams(context, contextStep),
// (result, assert) => {
// // console.log(result);
// assert.equals(agentJoiValidation.validateAddNetwork(result.network).error, null, 'return all details after adding network');
// assert.true(result.network[0].isNew, 'return isNew = true');
// });
// },
// getNetwork: function(stepname, contextStep) {
// return commonFunc.createStep('agent.network.get', stepname, context => agentParams.actorIdParams(context, contextStep),
// (result, assert) => {
// // console.log(result);
// assert.equals(agentJoiValidation.validateGetNetwork(result.network).error, null, 'return all details after getting network');
// });
// },
// fetchNetwork: function(stepname, contextStep) {
// return commonFunc.createStep('agent.network.fetch', stepname, context => agentParams.fetchNetworkParams(context, contextStep),
// (result, assert) => {
// // console.log(result);
// assert.equals(agentJoiValidation.validateFetchNetwork(result.network).error, null, 'return all details after fetching networks');
// });
// },
// approveNetwork: function(stepname, contextStep) {
// return commonFunc.createStep('agent.network.approve', stepname, context => agentParams.actorIdParams(context, contextStep),
// (result, assert) => {
// // console.log(result);
// assert.same(result, [], 'return empty resultset after approve network');
// });
// },
// rejectNetwork: function(stepname, contextStep) {
// return commonFunc.createStep('agent.network.reject', stepname, context => agentParams.rejectNetworkParams(context, contextStep),
// (result, assert) => {
// // console.log(result);
// assert.same(result, [], 'return empty resultset after reject network');
// });
// },
// discardNetwork: function(stepname, contextStep) {
// return commonFunc.createStep('agent.network.discard', stepname, context => agentParams.actorIdParams(context, contextStep),
// (result, assert) => {
// // console.log(result);
// assert.same(result, [], 'return empty resultset after discard network');
// });
// }
};
124 changes: 62 additions & 62 deletions lib/methods/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,68 +60,68 @@ module.exports = {
assert.equals(customerJoiValidation.validateFetchCustomerType(result.customerType).error, null, 'return customer types');
});
},
addOrganization: function(stepname, contextStep, organizationName) {
return commonFunc.createStep('customer.organization.add', stepname, context => customerParams.addOrganizationParams(context, contextStep, organizationName),
(result, assert) => {
assert.comment('actorId: ' + result['organization.info'][0].actorId);
assert.equals(customerJoiValidation.validateAddOrganization(result['organization.info'][0]).error, null, 'return all details after creating the organization');
assert.equals(result['organization.info'][0].organizationName, organizationName, 'return organizationName');
assert.equals(result['organization.info'][0].statusId, customerConstants.STATUSIDNEW, 'return status new');
});
},
fetchOrganization: function(stepname, contextStep, searchString, isEnabled) {
return commonFunc.createStep('customer.organization.fetch', stepname, context => customerParams.fetchOrganizationParams(context, contextStep, searchString, isEnabled),
(result, assert) => {
assert.equals(customerJoiValidation.validateFetchOrganization(result.organization).error, null, 'return all details after fetching organization');
});
},
getOrganization: function(stepname, contextStep) {
return commonFunc.createStep('customer.organization.get', stepname, context => customerParams.getOrganizationParams(context, contextStep),
(result, assert) => {
assert.equals(customerJoiValidation.vaidateGetOrganizationInfo(result['organization.info'][0]).error, null, 'return all details after getting organization');
if (result['organization.infoUnapproved'] !== undefined) {
assert.equals(customerJoiValidation.vaidateGetOrganizationInfo(result['organization.infoUnapproved'][0]).error, null, 'return all details after getting organization');
}
});
},
editOrganization: function(stepname, contextStep, organizationName) {
return commonFunc.createStep('customer.organization.edit', stepname, context => customerParams.editOrganizationParams(context, contextStep, organizationName),
(result, assert) => {
assert.equals(customerJoiValidation.validateEditOrganization(result.organization[0]).error, null, 'return all details after editing an organization');
assert.equals(result.organization[0].organizationName, organizationName, 'return organizationName');
assert.equals(result.organization[0].statusId, customerConstants.STATUSIDPENDING, 'return status pending');
});
},
approveOrganization: function(stepname, contextStep) {
return commonFunc.createStep('customer.organization.approve', stepname, context => customerParams.approveOrganizationParams(context, contextStep),
(result, assert) => {
assert.true(typeof result, 'object', 'return object after approve organization');
});
},
discardOrganization: function(stepname, contextStep) {
return commonFunc.createStep('customer.organization.discard', stepname, context => customerParams.discardOrganizationParams(context, contextStep),
(result, assert) => {
assert.same(result, [], 'return empty array after discard organization');
});
},
rejectOrganization: function(stepname, contextStep, rejectReason) {
return commonFunc.createStep('customer.organization.reject', stepname, context => customerParams.rejectOrganizationParams(context, contextStep, rejectReason),
(result, assert) => {
assert.same(result, [], 'return empty array after reject organization');
});
},
removeOrganization: function(stepname, contextStep) {
return commonFunc.createStep('customer.organization.delete', stepname, context => customerParams.removeOrganizationParams(context, contextStep),
(result, assert) => {
assert.same(result, [], 'return empty array after remove organization(s)');
});
},
lockOrganization: function(stepname, contextStep) {
return commonFunc.createStep('customer.organization.lock', stepname, context => customerParams.lockOrganizationParams(context, contextStep),
(result, assert) => {
assert.same(result, [], 'return empty resultset after lock/unlock organization');
});
},
// addOrganization: function(stepname, contextStep, organizationName) {
// return commonFunc.createStep('customer.organization.add', stepname, context => customerParams.addOrganizationParams(context, contextStep, organizationName),
// (result, assert) => {
// assert.comment('actorId: ' + result['organization.info'][0].actorId);
// assert.equals(customerJoiValidation.validateAddOrganization(result['organization.info'][0]).error, null, 'return all details after creating the organization');
// assert.equals(result['organization.info'][0].organizationName, organizationName, 'return organizationName');
// assert.equals(result['organization.info'][0].statusId, customerConstants.STATUSIDNEW, 'return status new');
// });
// },
// fetchOrganization: function(stepname, contextStep, searchString, isEnabled) {
// return commonFunc.createStep('customer.organization.fetch', stepname, context => customerParams.fetchOrganizationParams(context, contextStep, searchString, isEnabled),
// (result, assert) => {
// assert.equals(customerJoiValidation.validateFetchOrganization(result.organization).error, null, 'return all details after fetching organization');
// });
// },
// getOrganization: function(stepname, contextStep) {
// return commonFunc.createStep('customer.organization.get', stepname, context => customerParams.getOrganizationParams(context, contextStep),
// (result, assert) => {
// assert.equals(customerJoiValidation.vaidateGetOrganizationInfo(result['organization.info'][0]).error, null, 'return all details after getting organization');
// if (result['organization.infoUnapproved'] !== undefined) {
// assert.equals(customerJoiValidation.vaidateGetOrganizationInfo(result['organization.infoUnapproved'][0]).error, null, 'return all details after getting organization');
// }
// });
// },
// editOrganization: function(stepname, contextStep, organizationName) {
// return commonFunc.createStep('customer.organization.edit', stepname, context => customerParams.editOrganizationParams(context, contextStep, organizationName),
// (result, assert) => {
// assert.equals(customerJoiValidation.validateEditOrganization(result.organization[0]).error, null, 'return all details after editing an organization');
// assert.equals(result.organization[0].organizationName, organizationName, 'return organizationName');
// assert.equals(result.organization[0].statusId, customerConstants.STATUSIDPENDING, 'return status pending');
// });
// },
// approveOrganization: function(stepname, contextStep) {
// return commonFunc.createStep('customer.organization.approve', stepname, context => customerParams.approveOrganizationParams(context, contextStep),
// (result, assert) => {
// assert.true(typeof result, 'object', 'return object after approve organization');
// });
// },
// discardOrganization: function(stepname, contextStep) {
// return commonFunc.createStep('customer.organization.discard', stepname, context => customerParams.discardOrganizationParams(context, contextStep),
// (result, assert) => {
// assert.same(result, [], 'return empty array after discard organization');
// });
// },
// rejectOrganization: function(stepname, contextStep, rejectReason) {
// return commonFunc.createStep('customer.organization.reject', stepname, context => customerParams.rejectOrganizationParams(context, contextStep, rejectReason),
// (result, assert) => {
// assert.same(result, [], 'return empty array after reject organization');
// });
// },
// removeOrganization: function(stepname, contextStep) {
// return commonFunc.createStep('customer.organization.delete', stepname, context => customerParams.removeOrganizationParams(context, contextStep),
// (result, assert) => {
// assert.same(result, [], 'return empty array after remove organization(s)');
// });
// },
// lockOrganization: function(stepname, contextStep) {
// return commonFunc.createStep('customer.organization.lock', stepname, context => customerParams.lockOrganizationParams(context, contextStep),
// (result, assert) => {
// assert.same(result, [], 'return empty resultset after lock/unlock organization');
// });
// },
addKyc: function(stepname, contextStep, kycDescription) {
return commonFunc.createStep('customer.kyc.add', stepname, context => customerParams.addKycParams(context, contextStep, kycDescription),
(result, assert) => {
Expand Down