public String CheckPayooAccount(String username) { String result = ""; try { Credential credential = new Credential(); credential.APIUsername = ConfigurationManager.AppSettings["APIUsername"]; credential.APIPassword = ConfigurationManager.AppSettings["APIPassword"]; credential.APISignature = ConfigurationManager.AppSettings["APISignature"]; Caller caller = new Caller(); caller.InitCall(ConfigurationManager.AppSettings["PayooBusinessAPI"], credential, Server.MapPath(@"..\App_Data\Certificates\biz_pkcs12.p12"), "alpe", Server.MapPath(@"..\App_Data\Certificates\payoo_public_cert.pem")); CheckPayooAccountRequestType req = new CheckPayooAccountRequestType(); req.AccountID = username; // agentb2 ; vimp71 | [email protected] CheckPayooAccountResponseType res = (CheckPayooAccountResponseType)caller.Call("CheckPayooAccount", req); if (res.Ack == AckCodeType.Success) { result = "Valid"; } else { result = "InValid Account"; } } catch (Exception ex) { result = "False"; throw ex; } return result; }
public string RefundAll(int IdDuan) { string result = "false"; var dautu = db.EntityDauTus.Where(g => g.IdDuAn == IdDuan).ToList(); foreach (var item in dautu) { Credential credential = new Credential(); credential.APIUsername = ConfigurationManager.AppSettings["APIUsername"]; credential.APIPassword = ConfigurationManager.AppSettings["APIPassword"]; credential.APISignature = ConfigurationManager.AppSettings["APISignature"]; Caller caller = new Caller(); caller.InitCall(ConfigurationManager.AppSettings["PayooBusinessAPI"], credential, Server.MapPath(@"..\App_Data\Certificates\biz_pkcs12.p12"), "alpe", Server.MapPath(@"..\App_Data\Certificates\payoo_public_cert.pem")); UpdateOrderStatusRequestType request = new UpdateOrderStatusRequestType(); request.NewStatus = OrderStatus.Cancelled; request.ShopID = long.Parse(ConfigurationManager.AppSettings["ShopID"]); request.UpdateLog = "Dự án kết thúc thất bại."; request.OrderID = item.OrderID_Payoo; UpdateOrderStatusResponseType response = (UpdateOrderStatusResponseType)caller.Call("UpdateOrderStatus", request); if (response.Ack == AckCodeType.Success || response.Ack == AckCodeType.SuccessWithWarning) { result = "Refund success"; } else { return "Fail"; } } return result; }