Great! You want to exclude the wallet check in two cases:
- When it's not a withdrawal (
!isWithdrawal) — already handled.
- But if it is a deposit, and the source channel is "FS", then skip the wallet check too.
So, assuming you have a variable like sourceChannel (or whatever name you use for the channel), you can update your condition to:
if (!isWithdrawal && !(isDeposit && sourceChannel == "FS"))
{
var transaction = await _gateForceServiceProvider.WalletService.GetWalletTransactionByReference(transferTo.TransactionReference!);
if (transaction is null || transaction.TransactionStatus != AgentTransactionStatus.Successful)
{
return (false, InstatfinErrorMsg.GateforceWalletTransactionNotExistOrSuccessful);
}
}
Or, if isDeposit is not available:
If you don’t have a bool isDeposit, and you determine deposit by checking if isWithdrawal == false, then you can adjust it like this:
if (!isWithdrawal)
{
// Check if this is a deposit from channel FS
if (sourceChannel == "FS")
{
// Skip wallet check
}
else
{
var transaction = await _gateForceServiceProvider.WalletService.GetWalletTransactionByReference(transferTo.TransactionReference!);
if (transaction is null || transaction.TransactionStatus != AgentTransactionStatus.Successful)
{
return (false, InstatfinErrorMsg.GateforceWalletTransactionNotExistOrSuccessful);
}
}
}
Alternatively, in a single condition:
if (!isWithdrawal && (sourceChannel != "FS"))
{
var transaction = await _gateForceServiceProvider.WalletService.GetWalletTransactionByReference(transferTo.TransactionReference!);
if (transaction is null || transaction.TransactionStatus != AgentTransactionStatus.Successful)
{
return (false, InstatfinErrorMsg.GateforceWalletTransactionNotExistOrSuccessful);
}
}
This version assumes that if it's a deposit (!isWithdrawal) and the channel is not "FS", then run the wallet check.
Summary:
- ✅ You're already handling non-withdrawals.
- 🚫 You want to exclude the check when it's a deposit from channel FS.
- ✅ Updated logic reflects that.
Let me know how your isDeposit, isWithdrawal, and sourceChannel are structured, and I can tailor it more precisely if needed.