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.
421 lines
20 KiB
421 lines
20 KiB
using Common;
|
|
using Newtonsoft.Json;
|
|
using Swift.API.Common;
|
|
using Swift.API.Common.ExRate;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
|
|
namespace Repository.ThirdPartyApiServices
|
|
{
|
|
public class ExchangeRateAPIService
|
|
{
|
|
public JsonResponse GetExchangeRate(ExRateRequest model)
|
|
{
|
|
//Log.Debug("Calculate | Calling third party api to fetch the ex-rate details " + JsonConvert.SerializeObject(model));
|
|
using (var client = RestApiClient.CallJMEThirdParty())
|
|
{
|
|
JsonResponse jsonResponse = new JsonResponse();
|
|
var obj = JsonConvert.SerializeObject(model);
|
|
var jbdContent = new StringContent(obj.ToString(), Encoding.UTF8, "application/json");
|
|
try
|
|
{
|
|
var URL = "api/v1/TP/ExRate";
|
|
|
|
HttpResponseMessage resp = client.PostAsync(URL, jbdContent).Result;
|
|
string resultData = resp.Content.ReadAsStringAsync().Result;
|
|
if (resp.IsSuccessStatusCode)
|
|
{
|
|
jsonResponse = JsonConvert.DeserializeObject<JsonResponse>(resultData);
|
|
var a = (jsonResponse.Data != null ? JsonConvert.DeserializeObject<ExRateResponse>(jsonResponse.Data.ToString()) : null);
|
|
jsonResponse.Data = a;
|
|
|
|
return jsonResponse;
|
|
}
|
|
else
|
|
{
|
|
var errorJson = JsonConvert.DeserializeObject<ErrorJosn>(resultData);
|
|
var jsonResponseData = JsonConvert.DeserializeObject<JsonResponse>(errorJson.Message);
|
|
var data = JsonConvert.DeserializeObject<List<Data>>(jsonResponseData.Data.ToString());
|
|
jsonResponse.Id = jsonResponseData.Id;
|
|
jsonResponse.ResponseCode = jsonResponseData.ResponseCode;
|
|
jsonResponse.Msg = jsonResponseData.Msg;
|
|
jsonResponse.Data = data;
|
|
jsonResponse.Extra = jsonResponseData.Extra;
|
|
jsonResponse.Extra1 = jsonResponseData.Extra1;
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new JsonResponse()
|
|
{
|
|
ResponseCode = "1",
|
|
Msg = (ex.InnerException == null ? ex.Message : ex.InnerException.Message)
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
public JsonResponse GetTxnStatus(dynamic model)
|
|
{
|
|
//Log.Debug("Calculate | Calling third party api to fetch the ex-rate details " + JsonConvert.SerializeObject(model));
|
|
using (var client = RestApiClient.CallJMEThirdParty())
|
|
{
|
|
JsonResponse jsonResponse = new JsonResponse();
|
|
var obj = JsonConvert.SerializeObject(model);
|
|
var jbdContent = new StringContent(obj.ToString(), Encoding.UTF8, "application/json");
|
|
try
|
|
{
|
|
var URL = "api/v1/TP/GetStatus";
|
|
|
|
HttpResponseMessage resp = client.PostAsync(URL, jbdContent).Result;
|
|
string resultData = resp.Content.ReadAsStringAsync().Result;
|
|
if (resp.IsSuccessStatusCode)
|
|
{
|
|
jsonResponse = JsonConvert.DeserializeObject<JsonResponse>(resultData);
|
|
if (jsonResponse.ResponseCode.Equals("104"))
|
|
{
|
|
var datas = JsonConvert.DeserializeObject<List<Data>>(jsonResponse.Data.ToString());
|
|
string msg = "";
|
|
foreach (var item in datas)
|
|
{
|
|
msg += " " + item.Message;
|
|
}
|
|
jsonResponse.Msg += msg;
|
|
}
|
|
return jsonResponse;
|
|
}
|
|
else
|
|
{
|
|
var errorJson = JsonConvert.DeserializeObject<ErrorJosn>(resultData);
|
|
var jsonResponseData = JsonConvert.DeserializeObject<JsonResponse>(errorJson.Message);
|
|
var data = JsonConvert.DeserializeObject<List<Data>>(jsonResponseData.Data.ToString());
|
|
jsonResponse.Id = jsonResponseData.Id;
|
|
jsonResponse.ResponseCode = jsonResponseData.ResponseCode;
|
|
jsonResponse.Msg = jsonResponseData.Msg;
|
|
//jsonResponse.Data = data;
|
|
jsonResponse.Extra = jsonResponseData.Extra;
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new JsonResponse()
|
|
{
|
|
ResponseCode = "1",
|
|
Msg = (ex.InnerException == null ? ex.Message : ex.InnerException.Message)
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
public List<TransactionResponse> DownloadInficareTransaction(string url)
|
|
{
|
|
//Log.Debug("Calculate | Calling third party api to fetch the ex-rate details " + JsonConvert.SerializeObject(model));
|
|
using (var client = RestApiClient.CallJMEThirdParty())
|
|
{
|
|
List<TransactionResponse> jsonResponse = new List<TransactionResponse>();
|
|
try
|
|
{
|
|
HttpResponseMessage resp = client.GetAsync(url).Result;
|
|
string resultData = resp.Content.ReadAsStringAsync().Result;
|
|
if (resp.IsSuccessStatusCode)
|
|
{
|
|
//jsonResponse = JsonConvert.DeserializeObject<List<RetrieveMultipleResponse>>(resultData);
|
|
jsonResponse = JsonConvert.DeserializeObject<List<TransactionResponse>>(resultData);
|
|
jsonResponse[0].errorCode = "0";
|
|
jsonResponse[0].errorMsg = "Success";
|
|
return jsonResponse;
|
|
}
|
|
else
|
|
{
|
|
jsonResponse[0].errorCode = "1";
|
|
jsonResponse[0].errorMsg = "Success";
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
jsonResponse[0].errorCode = "1";
|
|
jsonResponse[0].errorMsg = (ex.InnerException == null ? ex.Message : ex.InnerException.Message);
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
}
|
|
|
|
public List<CustomerData> DownloadInficareCustomer(string url)
|
|
{
|
|
//Log.Debug("Calculate | Calling third party api to fetch the ex-rate details " + JsonConvert.SerializeObject(model));
|
|
using (var client = RestApiClient.CallJMEThirdParty())
|
|
{
|
|
List<CustomerData> jsonResponse = new List<CustomerData>();
|
|
try
|
|
{
|
|
HttpResponseMessage resp = client.GetAsync(url).Result;
|
|
string resultData = resp.Content.ReadAsStringAsync().Result;
|
|
if (resp.IsSuccessStatusCode)
|
|
{
|
|
//jsonResponse = JsonConvert.DeserializeObject<List<RetrieveMultipleResponse>>(resultData);
|
|
jsonResponse = JsonConvert.DeserializeObject<List<CustomerData>>(resultData);
|
|
jsonResponse[0].errorCode = "0";
|
|
jsonResponse[0].errorMsg = "Success";
|
|
return jsonResponse;
|
|
}
|
|
else
|
|
{
|
|
jsonResponse[0].errorCode = "1";
|
|
jsonResponse[0].errorMsg = "Success";
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
jsonResponse[0].errorCode = "1";
|
|
jsonResponse[0].errorMsg = (ex.InnerException == null ? ex.Message : ex.InnerException.Message);
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
}
|
|
|
|
public List<ReceiverData> DownloadInficareReceiver(string url)
|
|
{
|
|
//Log.Debug("Calculate | Calling third party api to fetch the ex-rate details " + JsonConvert.SerializeObject(model));
|
|
using (var client = RestApiClient.CallJMEThirdParty())
|
|
{
|
|
List<ReceiverData> jsonResponse = new List<ReceiverData>();
|
|
try
|
|
{
|
|
HttpResponseMessage resp = client.GetAsync(url).Result;
|
|
string resultData = resp.Content.ReadAsStringAsync().Result;
|
|
if (resp.IsSuccessStatusCode)
|
|
{
|
|
//jsonResponse = JsonConvert.DeserializeObject<List<RetrieveMultipleResponse>>(resultData);
|
|
jsonResponse = JsonConvert.DeserializeObject<List<ReceiverData>>(resultData);
|
|
jsonResponse[0].errorCode = "0";
|
|
jsonResponse[0].errorMsg = "Success";
|
|
return jsonResponse;
|
|
}
|
|
else
|
|
{
|
|
jsonResponse[0].errorCode = "1";
|
|
jsonResponse[0].errorMsg = "Success";
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
jsonResponse[0].errorCode = "1";
|
|
jsonResponse[0].errorMsg = (ex.InnerException == null ? ex.Message : ex.InnerException.Message);
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
}
|
|
|
|
public List<TransactionSync> DownloadInficareTransactionForSync(string url)
|
|
{
|
|
//Log.Debug("Calculate | Calling third party api to fetch the ex-rate details " + JsonConvert.SerializeObject(model));
|
|
using (var client = RestApiClient.CallJMEThirdParty())
|
|
{
|
|
List<TransactionSync> jsonResponse = new List<TransactionSync>();
|
|
try
|
|
{
|
|
HttpResponseMessage resp = client.GetAsync(url).Result;
|
|
string resultData = resp.Content.ReadAsStringAsync().Result;
|
|
if (resp.IsSuccessStatusCode)
|
|
{
|
|
//jsonResponse = JsonConvert.DeserializeObject<List<RetrieveMultipleResponse>>(resultData);
|
|
jsonResponse = JsonConvert.DeserializeObject<List<TransactionSync>>(resultData);
|
|
jsonResponse[0].errorCode = "0";
|
|
jsonResponse[0].errorMsg = "Success";
|
|
return jsonResponse;
|
|
}
|
|
else
|
|
{
|
|
jsonResponse[0].errorCode = "1";
|
|
jsonResponse[0].errorMsg = "Success";
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
jsonResponse[0].errorCode = "1";
|
|
jsonResponse[0].errorMsg = (ex.InnerException == null ? ex.Message : ex.InnerException.Message);
|
|
return jsonResponse;
|
|
}
|
|
}
|
|
}
|
|
|
|
public class TransactionSync
|
|
{
|
|
public string errorCode { get; set; }
|
|
public string errorMsg { get; set; }
|
|
public string transtatus { get; set; }
|
|
public string status { get; set; }
|
|
public string paiddate { get; set; }
|
|
public string cancel_date { get; set; }
|
|
public string tranno { get; set; }
|
|
}
|
|
|
|
public class ReceiverData
|
|
{
|
|
public string errorCode { get; set; }
|
|
public string errorMsg { get; set; }
|
|
public string Col1 { get; set; }
|
|
public string Sender_SNo { get; set; }
|
|
public string ReceiverName { get; set; }
|
|
public string ReceiverMiddleName { get; set; }
|
|
public string ReceiverLastName { get; set; }
|
|
public string ReceiverCountry { get; set; }
|
|
public string ReceiverAddress { get; set; }
|
|
public string Col2 { get; set; }
|
|
public string Col3 { get; set; }
|
|
public string ReceiverCity { get; set; }
|
|
public string ReceiverEmail { get; set; }
|
|
public string Col4 { get; set; }
|
|
public string ReceiverFax { get; set; }
|
|
public string ReceiverMobile { get; set; }
|
|
public string Relation { get; set; }
|
|
public string CustomerbenificiarType { get; set; }
|
|
public string ReceiverIdDescription { get; set; }
|
|
public string ReceiverId { get; set; }
|
|
public string PaymentType { get; set; }
|
|
public string Commercial_bank_Id { get; set; }
|
|
public string PayOutPartner { get; set; }
|
|
public string Api_partnet_bank_name { get; set; }
|
|
public string AccountNo { get; set; }
|
|
public string CustomerRemarks { get; set; }
|
|
public string Reason_for_remittance { get; set; }
|
|
public string CreateBy { get; set; }
|
|
public string Create_TS { get; set; }
|
|
public string Col5 { get; set; }
|
|
public string Col6 { get; set; }
|
|
public string Col7 { get; set; }
|
|
public string SNo { get; set; }
|
|
}
|
|
|
|
public class CustomerData
|
|
{
|
|
public string errorCode { get; set; }
|
|
public string errorMsg { get; set; }
|
|
public string SenderName { get; set; }
|
|
public string SenderMiddleName { get; set; }
|
|
public string SenderLastName { get; set; }
|
|
public string Country { get; set; }
|
|
public string SenderZipCode { get; set; }
|
|
public string SenderCity { get; set; }
|
|
public string SenderState { get; set; }
|
|
public string SenderEmail { get; set; }
|
|
public string SenderMobile2 { get; set; }
|
|
public string SenderMobile { get; set; }
|
|
public string SenderNativeCountry { get; set; }
|
|
public string Date_of_birth { get; set; }
|
|
public string Sender_Occupation { get; set; }
|
|
public string Gender { get; set; }
|
|
public string FullName { get; set; }
|
|
public string Create_by { get; set; }
|
|
public string create_ts { get; set; }
|
|
public string id_issue_DATE { get; set; }
|
|
public string SENDERVISA { get; set; }
|
|
public string SenderFax { get; set; }
|
|
public string SenderPassport { get; set; }
|
|
public string Is_ACT { get; set; }
|
|
public string approve_by { get; set; }
|
|
public string approve_ts { get; set; }
|
|
public string cust_type { get; set; }
|
|
public string is_enable { get; set; }
|
|
public string Force_Change_Pwd { get; set; }
|
|
public string Source_Of_income { get; set; }
|
|
public string SenderAddress { get; set; }
|
|
public string CustomerType { get; set; }
|
|
public string EmploymentType { get; set; }
|
|
public string NameOfEmp { get; set; }
|
|
public string SSN_cardId { get; set; }
|
|
public string Is_Active { get; set; }
|
|
public string Customer_remarks { get; set; }
|
|
public string sendercompany { get; set; }
|
|
public string RegdNo { get; set; }
|
|
public string Org_Type { get; set; }
|
|
public string Date_OfInc { get; set; }
|
|
public string Nature_OD_Company { get; set; }
|
|
public string Position { get; set; }
|
|
public string NameOfAuthorizedPerson { get; set; }
|
|
public string Income { get; set; }
|
|
public string SNo { get; set; }
|
|
public string CustomerId { get; set; }
|
|
}
|
|
|
|
public class TransactionResponse
|
|
{
|
|
public string errorCode { get; set; }
|
|
public string errorMsg { get; set; }
|
|
public string RefNo { get; set; }
|
|
public string pCurrCostRate { get; set; }
|
|
public string PCurrMargin { get; set; }
|
|
public string custRate { get; set; }
|
|
public string SCharge { get; set; }
|
|
public string senderCommission { get; set; }
|
|
public string pAgentComm { get; set; }
|
|
public string pAgentCommCurr { get; set; }
|
|
public string AgentCode { get; set; }
|
|
public string Branch1 { get; set; }
|
|
public string Branch_Code { get; set; }
|
|
public string Branch { get; set; }
|
|
public string ReceiverCountry { get; set; }
|
|
public string paymentType { get; set; }
|
|
public string ben_bank_id_BANK { get; set; }
|
|
public string ben_bank_name_BANK { get; set; }
|
|
public string ben_bank_id { get; set; }
|
|
public string ben_bank_name { get; set; }
|
|
public string rBankAcNo { get; set; }
|
|
public string collMode { get; set; }
|
|
public string paidAmt { get; set; }
|
|
public string receiveAmt { get; set; }
|
|
public string TotalRountAmt { get; set; }
|
|
public string receiveCType { get; set; }
|
|
public string ReceiverRelation { get; set; }
|
|
public string reason_for_remittance { get; set; }
|
|
public string source_of_income { get; set; }
|
|
public string TranStatus { get; set; }
|
|
public string PayStatus { get; set; }
|
|
public string sTime { get; set; }
|
|
public string sempid { get; set; }
|
|
public string confirmdate { get; set; }
|
|
public string sendername { get; set; }
|
|
public string receivername { get; set; }
|
|
public string TranNo { get; set; }
|
|
public string firstName { get; set; }
|
|
public string fullName { get; set; }
|
|
public string senderstate { get; set; }
|
|
public string sendercity { get; set; }
|
|
public string senderAddress { get; set; }
|
|
public string senderemail { get; set; }
|
|
public string sender_mobile { get; set; }
|
|
public string senderPhoneNo { get; set; }
|
|
public string senderNativeCountry { get; set; }
|
|
public string senderFax { get; set; }
|
|
public string senderPassport { get; set; }
|
|
public string ID_issue_Date { get; set; }
|
|
public string senderVisa { get; set; }
|
|
public string ip_address { get; set; }
|
|
public string dateofbirth { get; set; }
|
|
public string senderzipcode { get; set; }
|
|
public string customer_sno { get; set; }
|
|
public string rfirstName { get; set; }
|
|
public string rFullName { get; set; }
|
|
public string rCountry { get; set; }
|
|
public string receiverAddress { get; set; }
|
|
public string receiver_mobile { get; set; }
|
|
public string ReceiverIdDescription { get; set; }
|
|
public string ReceiverId { get; set; }
|
|
public string rRel { get; set; }
|
|
public string receiver_sno { get; set; }
|
|
public string paidBy { get; set; }
|
|
public string paidDate { get; set; }
|
|
public string cancel_date { get; set; }
|
|
}
|
|
}
|
|
}
|