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.
80 lines
2.6 KiB
80 lines
2.6 KiB
using GMEStatusSync.Common;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace GMEStatusSync.Business.CommonSyncBusiness
|
|
{
|
|
public class SyncStatusBusiness : ISyncStatusBusiness
|
|
{
|
|
GMEStatusSync.Dao.CommonDao.ISyncStatusDao _dao;
|
|
public SyncStatusBusiness()
|
|
{
|
|
_dao = new GMEStatusSync.Dao.CommonDao.SyncStatusDao();
|
|
}
|
|
|
|
public void SyncTxnStatus(string provider, string tranId, GetStatusResponseModel _syncStatusResponse, string paymentMethod)
|
|
{
|
|
string isPaid = "Unpaid";
|
|
|
|
if (provider.ToLower().Equals("mtrade"))
|
|
{
|
|
if (_syncStatusResponse.TpStatusCode.Equals("2"))
|
|
{
|
|
isPaid = "Paid";
|
|
}
|
|
}
|
|
else if (provider.ToLower().Equals("donga"))
|
|
{
|
|
if (_syncStatusResponse.TpStatus.ToLower().Equals("paid"))
|
|
{
|
|
isPaid = "Paid";
|
|
}
|
|
}
|
|
else if (provider.ToLower().Equals("wing"))
|
|
{
|
|
if (paymentMethod.ToLower() == "bank deposit" && _syncStatusResponse.TpStatusCode == "200")
|
|
{
|
|
if (_syncStatusResponse.TpStatusCode == "200")
|
|
{
|
|
isPaid = "Paid";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string status = (string.IsNullOrEmpty(_syncStatusResponse.TpStatus)) ? "" : _syncStatusResponse.TpStatus.ToLower();
|
|
if (status == "complete")
|
|
{
|
|
isPaid = "Paid";
|
|
}
|
|
}
|
|
}
|
|
else if (provider.ToLower().Equals("commercial"))
|
|
{
|
|
if (_syncStatusResponse.TpStatusCode.ToString() == "514" || _syncStatusResponse.TpStatusCode.ToString() == "515" || _syncStatusResponse.TpStatusCode.ToString() == "516")
|
|
{
|
|
isPaid = "Paid";
|
|
}
|
|
}
|
|
else if (provider.ToLower().Equals("bni"))
|
|
{
|
|
if (_syncStatusResponse.TpStatusCode.ToLower().ToString().Equals("pid"))
|
|
{
|
|
isPaid = "Paid";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
|
|
//mark paid if paid
|
|
if (!string.IsNullOrEmpty(tranId) && isPaid.ToLower().Equals("paid"))
|
|
{
|
|
_dao.SyncTxnAsPaid(provider, tranId);
|
|
}
|
|
}
|
|
}
|
|
}
|