Skip to content

Commit 06cb6d8

Browse files
committed
Nodev3 library updates
1 parent f65c8fe commit 06cb6d8

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
# Changelog
22

3-
## 1.1.7 | 2023-07-21
4-
This release includes the addition of Fawrypay and Tanzania mobilemoney, updates to NG (mono), UK & EU bank charge, googlepay, applepay, enaira and Hotfix to add required parameters for the update payment plan method.
3+
## 1.1.7 | 2023-10-18
4+
This release includes the addition of Fawrypay and Tanzania mobilemoney, updates to NG (mono), UK & EU bank charge, googlepay, applepay, enaira and Hotfix to add and update parameters for the update payment plan method, bulk transfers, and single transfers.
55
### Version changes.
66
- [ADDED] Support for Tanzania mobilemoney and tests for TZS mobilemoney.
77
- [ADDED] Support for Fawzy pay charge.
88
- [ADDED] Unit tests for Fawry pay, googlepay, applepay and eNaira charge.
99
- [ADDED] "beneficiary_name" as a required body parameter and "currency" & "bank_name" as optional body parameters in the beneficiarySchema.
10+
- [ADDED] createBulkTransferSchema to accept both "title" and "bulk_data" to create bulk transfers.
1011
- [ADDED] "expires" as an optional body parameters for PWBT(pay with bank transfer).
1112
- [ADDED] tests for the payment plan, Charge NG Bank Account (mono), Charge with Bank Transfer (PWBT), and Change UK & EU Bank Account.
1213
- [ADDED] schema for the USSD charge (ussdChargeSchema).
1314
- [ADDED] "status" as a body parameter in the updatePlanSchema.
1415
- [FIXED] updated the transaction tests to stub response.
16+
- [FIXED] "id" in the fetchSchema to accept only integer values.
17+
- [FIXED] updated the length of "account_bank" values in the transferSchema.
1518
- [FIXED] updated the UK & USSD bank charge.
1619
- [FIXED] updated the README.md file and documentation wikis.
1720
- [FIXED] updated the NG bank charge(mono).

services/schema/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const joi = require('joi');
22

33
// fetch information with single id. enforce id in payload
44
const fetchSchema = joi.object({
5-
id: joi.string().required(),
5+
id: joi.number().integer().required(),
66
});
77

88
// retrieve information with different query parameter. add enforceRequired to enforce query params and validate the request

services/schema/create.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ const transferSchema = joi.object({
416416
currency: joi.string().uppercase().length(3).default('NGN').required(),
417417
account_bank: joi.when('currency', {
418418
is: joi.valid('EUR', 'GBP', 'USD', 'KES'),
419-
then: joi.string().length(3).optional(),
420-
otherwise: joi.string().length(3).required(),
419+
then: joi.string().optional(),
420+
otherwise: joi.string().required(),
421421
}),
422422
account_number: joi.when('currency', {
423423
is: joi.valid('EUR', 'GBP', 'USD', 'KES'),
@@ -578,6 +578,25 @@ const transferSchema = joi.object({
578578
}),
579579
});
580580

581+
// to create a modified version of your original transferSchema to include bank_code.
582+
const modifiedTransferSchema = transferSchema.keys({
583+
bank_code: joi.when('currency', {
584+
is: joi.valid('EUR', 'GBP', 'USD', 'KES'),
585+
then: joi.string().optional(),
586+
otherwise: joi.string().required(),
587+
}),
588+
});
589+
590+
// create a bulk transfer
591+
const createBulkTransferSchema = joi.object({
592+
title: joi.string(),
593+
bulk_data: joi.array().items(
594+
modifiedTransferSchema.keys({
595+
account_bank: joi.forbidden(), // Remove account_bank
596+
}).rename('account_bank', 'bank_code')
597+
).required(),
598+
});
599+
581600
// create a tokenized charge
582601
const tokenSchema = joi.object({
583602
token: joi.string().required(),
@@ -649,6 +668,7 @@ module.exports = {
649668
cardSchema,
650669
cardChargeSchema,
651670
chargeSchema,
671+
createBulkTransferSchema,
652672
eNairaChargeSchema,
653673
momoSchema,
654674
planSchema,

services/transfers/rave.bulk.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const { logger } = require('../../utils/logger');
22
const { validator } = require('../../utils/validator');
3-
const { transferSchema } = require('../schema/create');
3+
const { createBulkTransferSchema } = require('../schema/create');
44

55
async function service(data, _rave) {
6-
validator(transferSchema, data);
6+
validator(createBulkTransferSchema, data);
77
const { body: response } = await _rave.request(`v3/bulk-transfers`, data);
88
logger(`Initiate bulk ${data.bulk_data.currency} transfers`, _rave);
99
return response;

0 commit comments

Comments
 (0)