Whether you're auditing, reporting or designing a dashboard, FPay lets you ask the system questions about all the actions that have taken place on your account. With the same simplicity, here are some of the questions you'll be able to ask FPay:
AuthAccess
object as explained on the Authentication page.AuthAccess
object, the value of the field named secretKey
must be kept absolutely secret and used only on your servers. This implies that you should never use the value of this field as a variable or constant in the source code of a mobile application, a web application or in the source code of any application whose binary may be public and visible to all. There are many tools to access strings in the source code from a binary around here.const fPay = sdk.FPayClient(sdk.Auth({token: '<token>', secretKey: '<secretKey>' }));
const fPay = sdk.FPayClient(sdk.Auth({token: '<token>', secretKey: '<secretKey>' }));
To list items corresponding to particular criteria, we need to start by considering the type of object that will be returned by our listing.
For example, if we want to list Wallet
foreignId
field of type String
and whose value may be absent, we are entitled to make the following requests: const walletsCollectionPromise =
fPay.wallet.list({
filter: "foreignId isDefined"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "foreignId !isDefined"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "foreignId = '1234'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "foreignId = '1234'",
sortBy: "foreignId"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "foreignId != '1234'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "foreignId startsWith '1234'"
});
Wallet
to be returned have a mainPocket
field and this field has a balance
field having itself an available
field of type Number
, we are entitled to make the following requests: const walletsCollectionPromise =
fPay.wallet.list({
filter: "mainPocket.balance.available = 10000"
});
const walletsCollectionPromise =
fPay.wallet.list({
sortBy: "mainPocket.balance.available:ASC"
});
const walletsCollectionPromise =
fPay.wallet.list({
sortBy: "mainPocket.balance.available:DESC"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "mainPocket.balance.available > 100000"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "mainPocket.balance.available >= 5000"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "mainPocket.balance.available != 100000"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "mainPocket.balance.available <= 100000"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "mainPocket.balance.available < 100000"
});
Wallet
to be returned have a createdTime
field of type DateTime
(ISO 8601-compliant date and time), we are entitled to make the following requests: const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime = '2024-10-01T01:30Z'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime.iso8601 = '2024-10-01T01:30Z'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime = '2024-10-01'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime.iso8601 = '2024-10-01'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime isBefore '2024-10-01T01:30Z'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime isBefore '2024-10-01'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime.timestamp.seconds <= 19817999"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime.timestamp.milliseconds <= 19817999000"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime isAfter '2024-10-01T01:30Z'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime isAfter '2024-10-01'"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime in CurrentYear"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime in CurrentMonth"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime in Today"
});
const walletsCollectionPromise =
fPay.wallet.list({
filter: "createdTime in Yesterday",
sortBy: "createdTime:ASC"
});
const walletsCollectionPromise =
fPay.wallet.list({
sortBy: "createdTime:DESC"
});
Now that we've laid the logical foundations for querying, we're going to answer the questions raised above.
Question 1
const transactionsCollectionPromise =
fPay.transaction.list({
filter: "status = 'Successful'"
+ " AND amount.value >= 500_000"
+ " AND dc = 'Debit'"
+ " AND wallet.isMain = true"
+ " AND createdTime in LastMonth",
sortBy: "amount.value:DESC"
});
Question 2
const walletsCollectionPromise =
fPay.wallet.list({
filter: "mainPocket.balance < 1_000_000"
});
Question 3
const transfersCollectionPromise =
fPay.transfer.list({
filter: "status = 'Successful'"
+ " AND destination.account.provider.key = 'OrangeMoney'"
+ " AND createdTime in Yesterday "
});
Question 4
const transactionsCollectionPromise =
fPay.transaction.list({
filter: "status = 'Successful'"
+ " AND (source.provider.key = 'MtnMoney' OR destination.provider.key = 'MtnMoney')"
+ " AND createdTime in CurrentMonth",
sortBy: "amount.value:DESC",
limit: 1
});
Question 5
const transactionsCollectionPromise =
fPay.transaction.list({
filter: "status = 'Failure'"
+ " AND dc = 'Debit'"
+ " AND destination.provider.key in {'MoovMoney', 'OrangeMoney'}"
});
const transactionsCollectionPromise =
fPay.transaction.list({
filter: "status = 'Failure'"
+ " AND dc = 'Debit'"
+ " AND (destination.provider.key = 'MoovMoney' OR destination.provider.key = OrangeMoney)"
});
Question 6
const transactionsCollectionPromise =
fPay.transaction.list({
filter: "status = 'Successful'"
+ " AND dc = 'Credit'"
+ " AND source.provider.key = 'MoovMoney'"
+ " AND createdTime isBefore Today",
sortBy: "createdTime:DESC"
});