public async Task <Keypay> GetUrlSendToKeypayMD5(int tenantId, string maGiaoDich, string maDonHang, long amount, string description) { var KEYPAY_MERCHANT_KEY = await SettingManager.GetSettingValueForTenantAsync(AppSettings.Payment.KEYPAY_MERCHANT_KEY, tenantId); var KEYPAY_MERCHANT_CODE = await SettingManager.GetSettingValueForTenantAsync(AppSettings.Payment.KEYPAY_MERCHANT_CODE, tenantId); if (string.IsNullOrEmpty(KEYPAY_MERCHANT_KEY) || string.IsNullOrEmpty(KEYPAY_MERCHANT_CODE)) { return(null); } Keypay pay = new Keypay(); pay.Keypayurl = Utility.KeyPaySetting.KPAY_URL(); pay.Bank_code = string.Empty; pay.Command = Utility.KeyPaySetting.COMMAND_TYPE_PAY; pay.Country_Code = Utility.KeyPaySetting.COUNTRY_CODE; pay.Current_code = Utility.KeyPaySetting.CURRENT_CODE; pay.Current_local = Utility.KeyPaySetting.CURRENT_LOCAL; pay.Desc1 = string.Empty; pay.Desc2 = string.Empty; pay.Desc3 = string.Empty; pay.Desc4 = string.Empty; pay.Desc5 = string.Empty; pay.Internal_bank = Utility.KeyPaySetting.INTERNAL_BANK; pay.Return_url = Utility.KeyPaySetting.RETURN_URL(); pay.Service_code = Utility.KeyPaySetting.SERVICE_CODE_MUA_HANG; pay.Ship_fee = "0"; pay.Tax = "0"; pay.Version = Utility.KeyPaySetting.VERSION; #region Parameter payment pay.Nest_code = amount.ToString(); pay.Merchant_trans_id = maGiaoDich; pay.Xdescription = description; pay.Good_code = maDonHang; #endregion pay.Merchant_code = KEYPAY_MERCHANT_CODE; pay.Merchant_secure_key = KEYPAY_MERCHANT_KEY; pay.Secure_hash = pay.get_Secure_Hash_MD5(); return(pay); }
public void KeyPayResultIPN() { var data = Request.RequestUri.ParseQueryString(); Keypay keypay = new Keypay(); // lấy tham số để truyền vào hàm keypay.Merchant_trans_id = data["merchant_trans_id"]; keypay.Good_code = data["good_code"]; keypay.Trans_id = data["trans_id"]; keypay.Merchant_code = data["merchant_code"]; keypay.Merchant_secure_key = string.Empty; keypay.Bank_code = data["bank_code"]; keypay.Command = data["command"]; keypay.Nest_code = data["net_cost"]; keypay.Response_code = data["response_code"]; keypay.Service_code = data["service_code"]; keypay.Ship_fee = data["ship_fee"]; keypay.Tax = data["tax"]; keypay.Current_code = data["currency_code"]; keypay.Secure_hash = data["secure_hash"]; if (!string.IsNullOrEmpty(keypay.Good_code) && keypay.Good_code.Contains(".")) { var arr = keypay.Good_code.Split('.'); var maThuTuc = arr.First(); //THU_TUC_TT-99 if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_99)) { _xuLyHoSoDoanhNghiepAppService.UpdateThanhToanKeyPay(keypay, true); } #region Thủ Tục hành Chính //THU_TUC_TT-01 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_01)) { //_xuLyHoSoDoanhNghiep01AppService.UpdateThanhToanKeyPay(keypay, true); } //THU_TUC_TT-02 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_02)) { //_xuLyHoSoDoanhNghiep02AppService.UpdateThanhToanKeyPay(keypay, true); } //THU_TUC_TT-03 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_03)) { //_xuLyHoSoDoanhNghiep03AppService.UpdateThanhToanKeyPay(keypay, true); } //THU_TUC_TT-04 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_04)) { //_xuLyHoSoDoanhNghiep04AppService.UpdateThanhToanKeyPay(keypay, true); } //THU_TUC_TT-05 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_05)) { //_xuLyHoSoDoanhNghiep05AppService.UpdateThanhToanKeyPay(keypay, true); } //THU_TUC_TT-06 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_06)) { //_xuLyHoSoDoanhNghiep06AppService.UpdateThanhToanKeyPay(keypay, true); } //THU_TUC_TT-07 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_07)) { //_xuLyHoSoDoanhNghiep07AppService.UpdateThanhToanKeyPay(keypay, true); } //THU_TUC_TT-08 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_08)) { //_xuLyHoSoDoanhNghiep08AppService.UpdateThanhToanKeyPay(keypay, true); } //THU_TUC_TT-09 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_09)) { //_xuLyHoSoDoanhNghiep09AppService.UpdateThanhToanKeyPay(keypay, true); } ////THU_TUC_TT-10 //else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_10)) //{ // _xuLyHoSoDoanhNghiep09AppService.UpdateThanhToanKeyPay(keypay, true); //} #endregion } }
public async Task <string> GetMerchantSecure_Hash_MD5_For_TennantId(int tenantId, Keypay keypay) { var hash_MD5 = ""; try { var KEYPAY_MERCHANT_KEY = await SettingManager.GetSettingValueForTenantAsync(AppSettings.Payment.KEYPAY_MERCHANT_KEY, tenantId); var KEYPAY_MERCHANT_CODE = await SettingManager.GetSettingValueForTenantAsync(AppSettings.Payment.KEYPAY_MERCHANT_CODE, tenantId); //xử lý so sánh chuối mã hóa keypay.Merchant_secure_key = KEYPAY_MERCHANT_KEY; keypay.Merchant_code = KEYPAY_MERCHANT_CODE; hash_MD5 = keypay.get_MerchantSecure_Hash_MD5(); } catch (Exception ex) { throw ex; } return(hash_MD5); }
public async Task <ActionResult> KeyPayResponse() { Keypay keypay = new Keypay(); // lấy tham số để truyền vào hàm keypay.Merchant_trans_id = Request.QueryString["merchant_trans_id"]; keypay.Good_code = Request.QueryString["good_code"]; keypay.Trans_id = Request.QueryString["trans_id"]; keypay.Merchant_code = Request.QueryString["merchant_code"]; //keypay.Merchant_secure_key = string.Empty; keypay.Bank_code = Request.QueryString["bank_code"]; keypay.Command = Request.QueryString["command"]; keypay.Nest_code = Request.QueryString["net_cost"]; keypay.Response_code = Request.QueryString["response_code"]; keypay.Service_code = Request.QueryString["service_code"]; keypay.Ship_fee = Request.QueryString["ship_fee"]; keypay.Tax = Request.QueryString["tax"]; keypay.Current_code = Request.QueryString["currency_code"]; keypay.Secure_hash = Request.QueryString["secure_hash"]; if (!string.IsNullOrEmpty(keypay.Good_code) && keypay.Good_code.Contains(".")) { var arr = keypay.Good_code.Split('.'); var maThuTuc = arr.First(); //THU_TUC_TT-99 if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_99)) { await _xuLyHoSoDoanhNghiepAppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } #region Thủ Tục hành Chính //THU_TUC_TT-01 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_01)) { //await _xuLyHoSoDoanhNghiep01AppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/tt01/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } //THU_TUC_TT-02 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_02)) { //await _xuLyHoSoDoanhNghiep02AppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/tt02/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } //THU_TUC_TT-03 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_03)) { //await _xuLyHoSoDoanhNghiep03AppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/tt03/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } //THU_TUC_TT-04 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_04)) { //await _xuLyHoSoDoanhNghiep04AppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/tt04/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } //THU_TUC_TT-05 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_05)) { //await _xuLyHoSoDoanhNghiep05AppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/tt05/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } //THU_TUC_TT-06 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_06)) { //await _xuLyHoSoDoanhNghiep06AppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/tt06/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } //THU_TUC_TT-07 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_07)) { //await _xuLyHoSoDoanhNghiep07AppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/tt07/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } //THU_TUC_TT-08 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_08)) { //await _xuLyHoSoDoanhNghiep08AppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/tt08/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } //THU_TUC_TT-09 else if (maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_09)) { //await _xuLyHoSoDoanhNghiep09AppService.UpdateThanhToanKeyPay(keypay, false); return(Redirect("/Application#!/tt09/dangkyhoso?kp_statuscode=" + keypay.Response_code)); } ////THU_TUC_TT-10 // else if(maThuTuc == CommonENum.GetEnumDescription(THU_TUC_ID.THU_TUC_10)) // { // await _xuLyHoSoDoanhNghiep10AppService.UpdateThanhToanKeyPay(keypay, false); // return Redirect("/Application#!/tt10/dangkyhoso?kp_statuscode=" + keypay.Response_code); // } #endregion Thủ Tục hành Chính } return(Redirect("/Application#!/tenant/dashboard")); }