public async Task <ServiceResultClient> TopupRequest(TopupSingleRequest model) { return(await TransactionService.TopupSingleRequestAsync(model)); }
/// <summary> /// شارژ مستقیم /// </summary> /// <param name="model"></param> /// <returns></returns> public async Task <ServiceResultClient> TopupSingleRequestAsync(TopupSingleRequest model) { try { var topupSingle = new TopupSingle(model.CustomerId); var topupCpIn = new topupCPIn() { authInfo = new authInfo() { userName = Request.AuthInfo.Username, password = Request.AuthInfo.Password } }; topupSingle.MerchantID = topupCpIn.merchantID = Request.MerchantID; topupCpIn.terminalID = Request.TerminalID; topupSingle.Date = topupCpIn.date = Request.Date; topupSingle.Time = topupCpIn.time = Request.Time; topupCpIn.localIP = Request.LocalIP; topupSingle.PAN = topupCpIn.PAN = model.PAN; topupCpIn.PINBlock = model.PINBlock; topupCpIn.serial = Request.Serial; topupSingle.STAN = topupCpIn.STAN = Request.STAN; topupCpIn.track2Ciphered = model.Track2Ciphered; topupCpIn.custMobile = Request.Mobile; topupSingle.InvoiceNo = topupCpIn.invoiceNo = Request.InvoiceNo; topupSingle.Amount = topupCpIn.amount = model.Amount; topupCpIn.profileId = model.profileId; topupCpIn.mobile = topupSingle.Mobile = model.Mobile; //topupCpIn.OrderType = 1; SoapMobileClient soapMobileClient = new SoapMobileClient(); topupOut topupMTNCpSingle = null; if (new[] { "19", "20" }.Contains(model.profileId)) { topupMTNCpSingle = soapMobileClient.topupMTNCPSingle(topupCpIn); } else if (new[] { "3", "4", "5", "6", "8", "41", "42" }.Contains(model.profileId)) { topupMTNCpSingle = soapMobileClient.topupSetavalCPSingle(topupCpIn); } var resultRequestCPMessage = TransactionMessage(topupMTNCpSingle.responseCode, topupMTNCpSingle.responseMsg); if (resultRequestCPMessage.Status != TransactionStatus.SuccessfulTransaction.ToString()) { topupSingle.Success = false; topupSingle.RefNo = topupMTNCpSingle.refNo; topupSingle.Amount = topupMTNCpSingle.responseMsg; return(resultRequestCPMessage); } else { var settleReverseIn = new settleReverseIn() { authInfo = topupCpIn.authInfo, custMobile = topupCpIn.custMobile, date = topupCpIn.date, localIP = topupCpIn.localIP, merchantID = topupCpIn.merchantID, orgRefNo = topupMTNCpSingle.refNo, terminalID = topupCpIn.terminalID, serial = topupCpIn.serial, time = topupCpIn.time, orgAmount = topupCpIn.amount, STAN = topupCpIn.STAN, version = topupCpIn.version }; if (new[] { "19", "20" }.Contains(model.profileId)) { settleReverseIn.transType = "topupmtn"; } else if (new[] { "3", "4", "5", "6", "8", "41", "42" }.Contains(model.profileId)) { settleReverseIn.transType = "topupsetaval"; } var resultSettlement = soapMobileClient.settlement(settleReverseIn); var resultSettlementMessage = TransactionMessage(resultSettlement.responseCode, resultSettlement.responseMsg); resultSettlementMessage.ClientRefNo = settleReverseIn.STAN; resultSettlementMessage.Date = settleReverseIn.date; resultSettlementMessage.RefNo = settleReverseIn.orgRefNo; resultSettlementMessage.Time = settleReverseIn.time; topupSingle.Success = true; return(resultSettlementMessage); } } catch (Exception) { return(AppGlobal.ServiceResultClientInstance(true, "عملیات نا موفق")); } }