Browse Source

Live version

master
shakun 11 months ago
parent
commit
ec8bab7173
  1. 63
      SendMail/API/NotifierV2.cs
  2. 4
      SendMail/App.config
  3. 62
      SendMail/Business/TxnPush.cs
  4. 28
      SendMail/DAO/TxnPushDAO.cs
  5. 1
      SendMail/JMETxnPushScheduler.csproj

63
SendMail/API/NotifierV2.cs

@ -0,0 +1,63 @@
using JMETxnPushScheduler.Common;
using Newtonsoft.Json;
using Swift.API.Common.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace JMETxnPushScheduler.API
{
public static class NotifierV2
{
// private static readonly ILog Log = LogManager.GetLogger(typeof(NotifierV2));
public static JsonResponse SendNotification(SendNotificationRequestMobile request, NOTIFICATION_TYPE nOTIFICATION_TYPE = NOTIFICATION_TYPE.PUSH_NOTIFICATION)
{
using (var client = RestApiClient.CallJMEThirdParty())
{
JsonResponse jsonResponse = new JsonResponse();
var obj = JsonConvert.SerializeObject(request);
var jbdContent = new StringContent(obj.ToString(), Encoding.UTF8, "application/json");
try
{
var URL = "api/v1/TP/NotificationAPI";
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<JsonResponse>(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)
};
}
}
}
}
}

4
SendMail/App.config

@ -7,7 +7,9 @@
<!--<add name="Connections" connectionString="server=34.92.161.102;Database=FastMoneyPro_Remit;uid=remituserjme;pwd=r3M!tU5Er@jM3r3Mit#?; Max Pool Size=1000;" providerName="system.data.sqlclient" />-->
<!--<add name="Connections" connectionString="server=10.90.77.61;Database=FastMoneyPro_Remit;uid=remituserjme;pwd=r3M!tU5Er@jM3r3Mit#?; Max Pool Size=1000;" providerName="system.data.sqlclient" />-->
<!--<add name="Connections" connectionString="server=202.166.220.36,1433;Database=FastMoneyPro_Remit;uid=jmeuser;pwd=P@ssw0rd@321!" providerName="system.data.sqlclient" />-->
<add name="Connections" connectionString="server=192.168.53.21\MSSQLSERVER01,9097;Database=FastMoneyPro_Remit;uid=user_stag;pwd=P@ssw0rd; Max Pool Size=1000;" providerName="system.data.sqlclient" />
<!--<add name="Connections" connectionString="server=77.68.15.91\MSSQLSERVER01,1434;Database=FastMoneyPro_Remit;uid=user_stag;pwd=P@ssw0rd" providerName="system.data.sqlclient" />-->
<add name="Connections" connectionString="server=77.68.90.58,1433;Database=FastMoneyPro_Remit;uid=remituser;pwd=U78SclK6" providerName="system.data.sqlclient" />
</connectionStrings>
<appSettings>

62
SendMail/Business/TxnPush.cs

@ -47,60 +47,18 @@ namespace JMETxnPushScheduler.Business
{
if (result.ResponseCode == "0")
{
_txnPush.UpdateTxnInstantPaid(item["ID"].ToString());
_txnPush.UpdateTxnPost(item["ID"].ToString(), result.Extra);
GetTxnDetails(item["ID"].ToString());
}
else if (result.ResponseCode == "100")//Transaction has been processed for Bank Deposit.
{
_txnPush.UpdateTxnPost(item["ID"].ToString());
_txnPush.UpdateTxnPost(item["ID"].ToString(), result.Extra);
GetTxnDetails(item["ID"].ToString());
}
else if (result.ResponseCode == "7000" && result.Msg.Contains("ALREADY USED"))
{
_txnPush.UpdateTxnPost(item["ID"].ToString());
GetTxnDetails(item["ID"].ToString());
}
}
else if (_dbRes.Msg == "394132")
{
if (result.ResponseCode == "0" || (!string.IsNullOrEmpty(result.Extra) && result.Extra.Equals("0006"))) //Duplicate records
{
_txnPush.UpdateTxnPost(item["ID"].ToString());
GetTxnDetails(item["ID"].ToString());
}
}
else if (_dbRes.Msg == "394414") //brac
{
if (result.ResponseCode == "0" || (!string.IsNullOrEmpty(result.Msg) && result.Msg.Equals("DuplicateTTNumber"))) //004- Duplicate records
{
_txnPush.UpdateTxnPost(item["ID"].ToString());
GetTxnDetails(item["ID"].ToString());
}
}
else if (_dbRes.Msg == "394428") //Cebuana
{
if (result.ResponseCode == "0" || (!string.IsNullOrEmpty(result.Extra) && result.Extra.Equals("05"))) // Control Number Already In Use
{
_txnPush.UpdateTxnPost(item["ID"].ToString());
GetTxnDetails(item["ID"].ToString());
}
else if (!string.IsNullOrEmpty(result.Extra) && result.Extra.Equals("19")) //"RTA Internal Error-Reference Number Already Exists
{
_txnPush.UpdateTxnPost(item["ID"].ToString());
GetTxnDetails(item["ID"].ToString());
}
}
else if (_dbRes.Msg == "394434") //wings
{
if (result.ResponseCode == "0")
{
_txnPush.UpdateTxnPost(item["ID"].ToString());
GetTxnDetails(item["ID"].ToString());
}
else if (!string.IsNullOrEmpty(result.Extra) && result.Extra.Equals("200")) //" Txn found in wings system.
{
_txnPush.UpdateTxnPost(item["ID"].ToString());
GetTxnDetails(item["ID"].ToString());
// GetTxnDetails(item["ID"].ToString());
}
}
else
@ -137,7 +95,7 @@ namespace JMETxnPushScheduler.Business
bodyMappings.Add(new Mapping() { SValue = "Fee", SText = cd.serviceCharge });
bodyMappings.Add(new Mapping() { SValue = "TotalAmt", SText = cd.TotalAmount });
if(cd.paymentMethod.ToUpper() == "BANK DEPOSIT")
if (cd.paymentMethod.ToUpper() == "BANK DEPOSIT")
{
SendNotificationRequestMobile request = new SendNotificationRequestMobile()
{
@ -159,8 +117,12 @@ namespace JMETxnPushScheduler.Business
}
}
};
var r = NotifierV2.SendNotification(request);
Console.Write(JsonConvert.SerializeObject(r));
}
else if(cd.paymentMethod.ToUpper() == "CASH PAYMENT")
else if (cd.paymentMethod.ToUpper() == "CASH PAYMENT")
{
SendNotificationRequestMobile request = new SendNotificationRequestMobile()
{
@ -182,6 +144,10 @@ namespace JMETxnPushScheduler.Business
}
}
};
var r1 = NotifierV2.SendNotification(request);
Console.Write(JsonConvert.SerializeObject(r1));
}
}

28
SendMail/DAO/TxnPushDAO.cs

@ -20,10 +20,11 @@ namespace JMETxnPushScheduler.DAO
return ExecuteDataTable(sql);
}
public void UpdateTxnPost(string id)
public void UpdateTxnPost(string id, string pCurrCostRate = null )
{
string sql = "EXEC PROC_TP_TXN_PUSH @FLAG = 'UPDATE-POST'";
sql += ", @TRAN_ID = " + FilterString(id);
sql += ", @pCurrCostRate = " + FilterString(pCurrCostRate);
ExecuteDataTable(sql);
}
@ -47,10 +48,31 @@ namespace JMETxnPushScheduler.DAO
public TxnDetails GetTxnDetails(string tranId)
{
string sql = "EXEC GetUserInfo @FLAG = 'txn-details'";
var sql = "EXEC GetUserInfo @flag='txn-details' ";
sql += ", @tranId = " + FilterString(tranId);
var row = ExecuteDataRow(sql);
return ParseDbResult<TxnDetails>(sql);
TxnDetails userDetails = new TxnDetails();
if (row != null)
{
userDetails.senderName = row["senderName"].ToString();
userDetails.PayoutCountry = row["pcountry"].ToString();
userDetails.BeneficiaryName = row["receiverName"].ToString();
userDetails.paymentMethod = row["paymentMethod"].ToString();
userDetails.BankName = row["pBankName"].ToString();
userDetails.BankBranch = row["pBankBranchName"].ToString();
userDetails.email = row["email"].ToString();
userDetails.AccountNo = row["accountNo"].ToString();
userDetails.PayoutAmount = row["pAmt"].ToString();
userDetails.TransferAmount = row["tamt"].ToString();
userDetails.TotalAmount = row["camt"].ToString();
userDetails.serviceCharge = row["serviceCharge"].ToString();
// userDetails.rewardPoints = row["rewardPoints"].ToString();
userDetails.TranDate = row["createdDate"].ToString();
}
return userDetails;
}
private T ParseDbResult<T>(string sql)

1
SendMail/JMETxnPushScheduler.csproj

@ -81,6 +81,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="API\NotifierV2.cs" />
<Compile Include="API\RestApiClient.cs" />
<Compile Include="API\SendTransactionServices.cs" />
<Compile Include="API\ThirdPartyAPI.cs" />

Loading…
Cancel
Save