public static void BalanceInquiry(ReqBalanceInquiry0100 requestModel, RespBalanceInquiry0110 responseModel) { try { //It should be queried from database responseModel.TransactionAmount = 82000000m; responseModel.AdditionalData = "ID010Balance OK"; if (responseModel.TransactionAmount > 0) { responseModel.AdditionalAmount = responseModel.TransactionAmount; } else { responseModel.AdditionalAmount = 0; } } catch { responseModel.ResponseCode = ResponseCode.SYSTEM_ERROR; //Or another error code } }
public Response0110 Execute(Request0100 request) { if (request == null) { if (ProcessErrorNotification != null) { ProcessErrorNotification(); } return(null); } DateTime now = DateTime.Now; Response0110 response = new Response0110(); switch (request.ProcessingCode.TransactionType) { case TransactionTypeCodeBytes.BALANCE_INQUIRY: response = new RespBalanceInquiry0110(); break; case TransactionTypeCodeBytes.PIN_CHANGE: response = new RespPinChange0110(); break; case TransactionTypeCodeBytes.PAYMENT_INQUIRY: response = new RespPaymentInquiry0110(); break; case TransactionTypeCodeBytes.TRANSFER_INQUIRY: response = new RespTransferInquiry0110(); break; } response.TransactionDate = now; response.TransactionTime = now; response.RetrievalReferenceNumber = MessageUtility.HexToString(request.SystemAuditTraceNumber); response.ResponseCode = ResponseCode.COMPLETED_SUCCESSFULLY; response.MessageAuthenticationCode = new byte[8]; if (request.TransferData != null) { response.TransferData = request.TransferData; //It's just default value, it must be queried from db in the delegates defined above response.TransferData.BeneficiaryName = "BENEFICIARY NAME GENERATED"; response.TransferData.IssuerInstitutionId = "4442"; response.TransferData.CardholderAccountNumber = "1234567890123456"; response.TransferData.CardholderName = "CARD HOLDER NAME GENERATED"; } switch (request.ProcessingCode.TransactionType) { case TransactionTypeCodeBytes.BALANCE_INQUIRY: if (ProcessBalanceInquiry != null) { ProcessBalanceInquiry(new ReqBalanceInquiry0100(request), (RespBalanceInquiry0110)response); } break; case TransactionTypeCodeBytes.PIN_CHANGE: if (ProcessPinChange != null) { ProcessPinChange(new ReqPinChange0100(request), (RespPinChange0110)response); } break; case TransactionTypeCodeBytes.PAYMENT_INQUIRY: if (ProcessPaymentInquiry != null) { ProcessPaymentInquiry(new ReqPaymentInquiry0100(request), (RespPaymentInquiry0110)response); } break; case TransactionTypeCodeBytes.TRANSFER_INQUIRY: if (ProcessTransferInquiry != null) { ProcessTransferInquiry(new ReqTransferInquiry0100(request), (RespTransferInquiry0110)response); } break; } //ProcessBalanceInquiry = null; //ProcessPinChange = null; //ProcessPaymentInquiry = null; //ProcessTransferInquiry = null; return(response); }