This object is used to deposit money from a mobile money account to an FPay wallet. When initiated, a Deposit immediately triggers a request to a mobile money account to retrieve the specified amount.
Because the owner of the mobile money account must absolutely validate the cash outflow, there exists an attempt.id field which represents the identifier of theMulti Factor Authentication Attempt. With this identifier, you can retrieve an Attempt object, which will tell you which instructions the customer must execute to authenticate the deposit, as well as the time remaining before it expires.
Any instance of this object passes through several states, which can be tracked by observing the status field: At the beginning it will be Starting, and at the end, the state will be either Successful or Failure.
Once the deposit is complete, a Transaction object will be created to materialize the entry of money into the FPay wallet. The title of this Transaction object can be controlled from the Deposit object by specifying the h1. field. If you omit this field, a default title will be added when the Transaction object is created, visible by accessing the h1 field of the Transaction object.
get Returns an object Deposit found by an identifier.
You can use a unique ID specific to your system. To use your own ID instead of the one generated by FPay, you need to specify the foreignId field when creating the object. This will enable you to retrieve the object via the foreignId field, which must be unique for all Deposit objects. Here are all the fields whose values can be used as identifiers for this operation:
idforeignIdattempt.idconst depositPromise = fPay.deposit.get("identifier");initiate Initiate a new Deposit operation and return the newly created instance.
This operation takes the following parameters as input:
InitiateDepositFormamountAmountFormcurrencystringvaluestringsourceSourceFormSourceForm.MultipleSourceFormMultipleSourceFormSourceForm.SingleSourceFormSingleSourceFormaccountMoneyAccountFormcountrystringidentifierstringproviderKeystringdescriptionstring | undefineddestinationDestinationForm | undefinedDestinationForm.MultipleDestinationFormMultipleDestinationFormDestinationForm.SingleDestinationFormSingleDestinationFormaccountMoneyAccountFormcountrystringidentifierstringid identifierproviderKeystringfeesFeesForm | undefinedpayerstringforeignDatastring | undefinedforeignIdstring | undefinedh1H1DescriptorForm | undefinedenstring | undefinedfrstring | undefinedHere's an example of code for initiate a Deposit object:
const depositPromise =
fPay.deposit.initiate({
amount: {
currency: "XOF",
value: "10_000"
},
source: {
_type: "Single",
account: {
country: "CI",
identifier: "+2250500000000",
providerKey: "MtnMoney"
}
},
description: "My description",
destination: {
_type: "Single",
account: {
country: "CI",
identifier: "123456789",
providerKey: "FPay"
}
},
fees: {
payer: "CounterPart"
},
foreignData: "{\"myKey\": 19, \"myOtherKey\": \"myOtherValue\"}",
foreignId: "123456789",
h1: {
en: "Payment description",
fr: "Description du paiement"
}
});list Returns a collection of Deposit objects, possibly filtered and/or sorted. Here are the parameters supported by this operation.
| NAME | TYPE | DESCRIPTION | DEFAULT VALUE |
|---|---|---|---|
filter | string | undefined | Condition to be met by any object returned in this collection | |
sortBy | string | undefined | Specify the field and the order (ascending or descending) by which returned objects will be sorted | |
limit | number | undefined | Total number of results to return in this collection | |
Here are a few examples of code to execute a listing to return a collection of Deposit objects:
const depositsCollectionPromise = fPay.deposit.listAll();const depositsCollectionPromise =
fPay.deposit.list({
sortBy: "id:ASC"
});const depositsCollectionPromise =
fPay.deposit.list({
limit: 5
});const depositsCollectionPromise =
fPay.deposit.list({
filter: "id in {'31234', '5678', '9990'}"
});const depositsCollectionPromise =
fPay.deposit.list({
filter: "createdTime isBefore Yesterday",
sortBy: "foreignId:DESC"
});const depositsCollectionPromise =
fPay.deposit.list({
filter: "id startsWith abcd",
sortBy: "createdTime:ASC",
limit: 25
});fetchPage When you fetch a list of Deposit, the results returned by the server can be paginated, i.e. they will be arranged on several pages. This fetchPage function allows you to navigate from page to page, iterating over all the elements. Consequently, this function returns a collection of Deposit.
Let's say you've retrieved a collection of Deposit with the following code:
const depositsCollectionPromise = fPay.deposit.listAll();If the result is spread over several pages, to go to the next page, you should do:
depositsCollectionPromise.then(depositCollection => {
if(depositCollection.hasNextPage()) {
const nextDepositPromise = fPay.deposit.fetchPage(depositCollection.pagination.nextPage);
}
});update Modify a Deposit object and return the modified version.
Here are all the fields whose values can be used as identifiers for this operation:
idforeignIdattempt.idDeposit objects:| NAME | TYPE | DESCRIPTION |
|---|---|---|
description | string | undefined | Can be updated Can be Deleted |
foreignData | string | undefined | Can be updated Can be Deleted |
Here are a few examples of code to execute an update:
depositPromise =
fPay.deposit.update({
id: "<id | foreignId>",
change: {
description: "<new value>",
foreignData: "<new value>"
}
});depositPromise =
fPay.deposit.update({
id: "<id | foreignId>",
change: {
description: "<new value>"
},
'remove': ['foreignData']
});depositPromise =
fPay.deposit.update({
id: "<id | foreignId>",
'remove': ['description', 'foreignData']
});When you retrieve a list, here are the fields you can use for filtering and sorting. as well as sorting.
| NAME | TYPE | DESCRIPTION |
|---|---|---|
amount.currency.code | string | |
amount.value | number | |
attempt.id | string | |
completedTime | string | |
completedTime.iso8601 | string | |
completedTime.timestamp.milliseconds | number | |
completedTime.timestamp.seconds | number | |
createdTime | string | |
createdTime.iso8601 | string | |
createdTime.timestamp.milliseconds | number | |
createdTime.timestamp.seconds | number | |
creator | string | |
creator._type | string | |
creator.accountId | string | |
creator.authAccessId | string | |
creator.personId | string | |
description | string | |
destination | string | |
destination._type | string | |
destination.account.balanceType | string | |
destination.account.identifier._type | string | |
destination.account.identifier.value | string | |
destination.account.provider.country.iso3166.alpha2 | string | |
destination.account.provider.country.iso3166.alpha3 | string | |
destination.account.provider.country.name | string | |
destination.account.provider.key | string | |
destination.account.provider.name | string | |
destination.amount.currency.code | string | |
destination.amount.value | number | |
fees.amount.currency.code | string | |
fees.amount.value | number | |
fees.payer | string | |
fees.value.fixe | number | |
fees.value.percent | number | |
foreignId | string | |
h1Descriptor.en | string | |
h1Descriptor.fr | string | |
id | string | |
sending | string | |
source | string | |
source._type | string | |
source.account.balanceType | string | |
source.account.identifier._type | string | |
source.account.identifier.value | string | |
source.account.provider.country.iso3166.alpha2 | string | |
source.account.provider.country.iso3166.alpha3 | string | |
source.account.provider.country.name | string | |
source.account.provider.key | string | |
source.account.provider.name | string | |
source.amount.currency.code | string | |
source.amount.value | number | |
status | string |
Code examples are available on the Audit & Dashboard page
DepositamountAmountcurrencyAmountCurrencycodestringunitstringvaluenumberattemptLightAttemptidstringcompletedTimeUTCDateTime | undefinediso8601stringtimestampTimestampmillisecondsnumbersecondsDoublecreatedTimeUTCDateTimeiso8601stringtimestampTimestampmillisecondsnumbersecondsDoublecreatorCreatorCreator.ApiApi_typestringaccountIdstringauthAccessIdstringCreator.UiUi_typestringaccountIdstringpersonIdstringdescriptionstring | undefineddestinationDestinationDestination.MultipleMultiple_typestringDestination.SingleSingle_typestringaccountMoneyAccountbalanceTypestringidentifierMoneyAccountIdentifier_typestringvaluestringproviderMoneyAccountProvidercountryCountryiso3166Iso3166Countryalpha2stringalpha3stringnamestringkeystringnamestringamountAmountcurrencyAmountCurrencycodestringunitstringvaluenumberfeesFeesamountAmountcurrencyAmountCurrencycodestringunitstringvaluenumberpayerstring | undefinedvalueFeesValuefixenumberpercentnumberforeignDatastring | undefinedforeignIdstring | undefinedh1DescriptorH1Descriptor | undefinedenstring | undefinedfrstring | undefinedidstringsendingstringsourceSourceSource.MultipleMultiple_typestringSource.SingleSingle_typestringaccountMoneyAccountbalanceTypestringidentifierMoneyAccountIdentifier_typestringvaluestringproviderMoneyAccountProvidercountryCountryiso3166Iso3166Countryalpha2stringalpha3stringnamestringkeystringnamestringamountAmountcurrencyAmountCurrencycodestringunitstringvaluenumberstatusDepositStatusDepositStatus.CompletingCompleting_typestringDepositStatus.FailureFailure_typestringcancelledCancelled | undefinedafterTimeoutbooleanreasonLocalizedTextenstringfrstringDepositStatus.ProcessingProcessing_typestringreasonLocalizedTextenstringfrstringDepositStatus.StartedStarted_typestringDepositStatus.StartingStarting_typestringDepositStatus.SuccessfulSuccessful_typestringDepositStatus.WaitingToStartWaitingToStart_typestringurlstring