You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
8.5 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. using RemitInboundAPI.Common.Model.RemitModel;
  2. using RemitInboundAPI.Common.Model;
  3. using RemitInboundAPI.Common.Helper;
  4. namespace RemitInboundAPI.Business.Helper.ValidationHelper
  5. {
  6. public class SendTransactionValidationHelper
  7. {
  8. public async Task<ApiResponse> SendTransactionValidationRequest(SendRemittanceModel model)
  9. {
  10. ApiResponse _response;
  11. if (string.IsNullOrEmpty(model.RemittanceDetails.SendingCountryCode))
  12. {
  13. _response = new ApiResponse(ResponseHelper.FAILED, "SendingCountryCode can not be empty.");
  14. }
  15. else if (string.IsNullOrEmpty(model.RemittanceDetails.SendingCurrencyCode))
  16. {
  17. _response = new ApiResponse(ResponseHelper.FAILED, "SendingCurrencyCode can not be empty.");
  18. }
  19. else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutCountryCode))
  20. {
  21. _response = new ApiResponse(ResponseHelper.FAILED, "PayoutCountryCode can not be empty.");
  22. }
  23. else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutTypeCode))
  24. {
  25. _response = new ApiResponse(ResponseHelper.FAILED, "PayoutTypeCode can not be empty.");
  26. }
  27. else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutCurrencyCode))
  28. {
  29. _response = new ApiResponse(ResponseHelper.FAILED, "PayoutCurrencyCode can not be empty.");
  30. }
  31. else if (string.IsNullOrEmpty(model.RemittanceDetails.CollectionAmount))
  32. {
  33. _response = new ApiResponse(ResponseHelper.FAILED, "CollectionAmount can not be empty.");
  34. }
  35. else if (string.IsNullOrEmpty(model.RemittanceDetails.SendingCurrencyCode))
  36. {
  37. _response = new ApiResponse(ResponseHelper.FAILED, "SendingCurrencyCode can not be empty.");
  38. }
  39. else if (string.IsNullOrEmpty(model.RemittanceDetails.TransferAmount))
  40. {
  41. _response = new ApiResponse(ResponseHelper.FAILED, "TransferAmount can not be empty.");
  42. }
  43. else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutAmount))
  44. {
  45. _response = new ApiResponse(ResponseHelper.FAILED, "PayoutAmount can not be empty.");
  46. }
  47. else if (string.IsNullOrEmpty(model.RemittanceDetails.ServiceCharge))
  48. {
  49. _response = new ApiResponse(ResponseHelper.FAILED, "ServiceCharge can not be empty.");
  50. }
  51. else if (string.IsNullOrEmpty(model.RemittanceDetails.ExchangeRate))
  52. {
  53. _response = new ApiResponse(ResponseHelper.FAILED, "ExchangeRate can not be empty.");
  54. }
  55. else if (string.IsNullOrEmpty(model.RemittanceDetails.SendingCurrencyCode))
  56. {
  57. _response = new ApiResponse(ResponseHelper.FAILED, "SendingCurrencyCode can not be empty.");
  58. }
  59. else if (string.IsNullOrEmpty(model.RemittanceDetails.RemittancePurpose))
  60. {
  61. _response = new ApiResponse(ResponseHelper.FAILED, "RemittancePurpose can not be empty.");
  62. }
  63. else if (string.IsNullOrEmpty(model.RemittanceDetails.SourceOfFund))
  64. {
  65. _response = new ApiResponse(ResponseHelper.FAILED, "SourceOfFund can not be empty.");
  66. }
  67. else if (string.IsNullOrEmpty(model.RemittanceDetails.Relationship))
  68. {
  69. _response = new ApiResponse(ResponseHelper.FAILED, "Relationship can not be empty.");
  70. }
  71. else if (string.IsNullOrEmpty(model.RemittanceDetails.Occupation))
  72. {
  73. _response = new ApiResponse(ResponseHelper.FAILED, "Occupation can not be empty.");
  74. }
  75. else if (string.IsNullOrEmpty(model.RemittanceDetails.CalcBy))
  76. {
  77. _response = new ApiResponse(ResponseHelper.FAILED, "CalcBy can not be empty.");
  78. }
  79. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderFirstName))
  80. {
  81. _response = new ApiResponse(ResponseHelper.FAILED, "SenderFirstName can not be empty.");
  82. }
  83. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderDOB))
  84. {
  85. _response = new ApiResponse(ResponseHelper.FAILED, "SenderDOB can not be empty.");
  86. }
  87. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderLastName))
  88. {
  89. _response = new ApiResponse(ResponseHelper.FAILED, "SenderLastName can not be empty.");
  90. }
  91. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderIdType))
  92. {
  93. _response = new ApiResponse(ResponseHelper.FAILED, "SenderIdType can not be empty.");
  94. }
  95. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderIdNo))
  96. {
  97. _response = new ApiResponse(ResponseHelper.FAILED, "SenderIdNo can not be empty.");
  98. }
  99. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderIdIssuedDate))
  100. {
  101. _response = new ApiResponse(ResponseHelper.FAILED, "SenderIdIssuedDate can not be empty.");
  102. }
  103. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderIdValidDate))
  104. {
  105. _response = new ApiResponse(ResponseHelper.FAILED, "SenderIdValidDate can not be empty.");
  106. }
  107. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderMobile))
  108. {
  109. _response = new ApiResponse(ResponseHelper.FAILED, "SenderMobile can not be empty.");
  110. }
  111. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderAddress))
  112. {
  113. _response = new ApiResponse(ResponseHelper.FAILED, "SenderAddress can not be empty.");
  114. }
  115. else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderGender))
  116. {
  117. _response = new ApiResponse(ResponseHelper.FAILED, "SenderGender can not be empty.");
  118. }
  119. else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverFirstName))
  120. {
  121. _response = new ApiResponse(ResponseHelper.FAILED, "ReceiverFirstName can not be empty.");
  122. }
  123. else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverLastName))
  124. {
  125. _response = new ApiResponse(ResponseHelper.FAILED, "ReceiverLastName can not be empty.");
  126. }
  127. else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverMobile))
  128. {
  129. _response = new ApiResponse(ResponseHelper.FAILED, "ReceiverMobile can not be empty.");
  130. }
  131. else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverCity))
  132. {
  133. _response = new ApiResponse(ResponseHelper.FAILED, "ReceiverCity can not be empty.");
  134. }
  135. else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverAddress))
  136. {
  137. _response = new ApiResponse(ResponseHelper.FAILED, "ReceiverAddress can not be empty.");
  138. }
  139. else
  140. {
  141. _response = new ApiResponse(ResponseHelper.SUCCESS, ResponseMessageHelper.SUCCESS);
  142. }
  143. //conditional
  144. if (_response.ResponseCode == ResponseHelper.SUCCESS)
  145. {
  146. if (model.RemittanceDetails.PayoutTypeCode.ToLower() == "bd")
  147. {
  148. if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutBankCode))
  149. {
  150. _response = new ApiResponse(ResponseHelper.FAILED, "PayoutBankCode can not be empty for payment type Bank Deposit.");
  151. }
  152. else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutBankBranchCode))
  153. {
  154. _response = new ApiResponse(ResponseHelper.FAILED, "PayoutBankBranchCode can not be empty for payment type Bank Deposit.");
  155. }
  156. else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverAccountNo))
  157. {
  158. _response = new ApiResponse(ResponseHelper.FAILED, "ReceiverAccountNo can not be empty for payment type Bank Deposit.");
  159. }
  160. else
  161. {
  162. _response = new ApiResponse(ResponseHelper.SUCCESS, ResponseMessageHelper.SUCCESS);
  163. }
  164. }
  165. }
  166. return _response;
  167. }
  168. }
  169. }