private List <string> GenerateHash(string vPOSPublicKey, string herbalifePrivateKey, string acquirerId, string storeId, string orderNumber, string vectorId, string amount, string returnUrl) { var cipheredDataList = new List <string>(); string R1; string R2; if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat") || RootUrl.Contains("10.36.158.182") || RootUrl.Contains("10.36.173.61")) { R1 = ResolveUrl("\\App_data\\PaymentsKeysVpaymentVisa\\paymentGatewayVpaymentVisaCRYPTOPublicKey.txt"); R2 = ResolveUrl("\\App_data\\PaymentsKeysVpaymentVisa\\paymentGatewayHerbalifeSignaturePrivateKey.txt"); } else { R1 = ResolveUrl("\\App_data\\PaymentsKeysVpaymentVisa\\BetapaymentGatewayVpaymentVisaCRYPTOPublicKey.txt"); R2 = ResolveUrl("\\App_data\\PaymentsKeysVpaymentVisa\\BetapaymentGatewayHerbalifeSignaturePrivateKey.txt"); } var srVposLlaveCifradoPublica = new StreamReader(R1); var srComercioLlaveFirmaPrivada = new StreamReader(R2); SessionInfo myCart = SessionInfo.GetSessionInfo(this._distributorId, this._locale); OrderTotals_V01 totals = myCart.ShoppingCart.Totals as OrderTotals_V01; var hasDiscount = OrderProvider.HasVATDiscount(totals); var oVposBean = new VPOSBean { acquirerId = acquirerId, commerceId = storeId, purchaseCurrencyCode = "858", purchaseAmount = amount, purchaseOperationNumber = orderNumber, reserved10 = hasDiscount ? "6" : "0", reserved11 = hasDiscount ? orderNumber.Substring(3): string.Empty, reserved12 = hasDiscount ? (string.Format( this.getPriceFormat((null != totals ? totals.TaxableAmountTotal : 0)), (null != totals ? totals.TaxableAmountTotal : 0)).Replace(".", "")) .Replace(",", "") : string.Empty }; VPOSTax oVPOSTax; var aTaxes = new ArrayList(); oVPOSTax = new VPOSTax { Name = "IVA", Amount = (string.Format( this.getPriceFormat((null != totals ? totals.TaxAmount : 0)), (null != totals ? totals.TaxAmount : 0)).Replace(".", "")).Replace( ",", "") }; aTaxes.Add(oVPOSTax); oVPOSTax = new VPOSTax { Name = "Servicio", Amount = "0" }; aTaxes.Add(oVPOSTax); oVPOSTax = new VPOSTax { Name = "Monto Grava IVA", Amount = (string.Format( this.getPriceFormat((null != totals ? totals.TaxableAmountTotal : 0)), (null != totals ? totals.TaxableAmountTotal : 0)).Replace(".", "")) .Replace(",", "") }; //oVPOSTax.Amount = totalplustax; aTaxes.Add(oVPOSTax); oVPOSTax = new VPOSTax { Name = "Monto No Grava IVA", Amount = "0" }; aTaxes.Add(oVPOSTax); oVposBean.taxes = aTaxes; var oVposSend = new VPOSSend(srVposLlaveCifradoPublica, srComercioLlaveFirmaPrivada, vectorId); oVposSend.execute(ref oVposBean); cipheredDataList.Add(oVposBean.cipheredSessionKey); cipheredDataList.Add(oVposBean.cipheredXML); cipheredDataList.Add(oVposBean.cipheredSignature); return(cipheredDataList); }
private List <string> GenerateHash(string vPOSPublicKey, string herbalifePrivateKey, string acquirerId, string storeId, string orderNumber, string vectorId, string amount, string returnUrl) { var cipheredDataList = new List <string>(); string R1; // = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\paymentGatewayVPOSCRYPTOPublicKey.txt"); string R2; // = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\paymentGatewayHerbalifeSignaturePrivateKey.txt"); if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat")) { R1 = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\paymentGatewayVPOSCRYPTOPublicKey.txt"); R2 = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\paymentGatewayHerbalifeSignaturePrivateKey.txt"); } else { R1 = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\BetapaymentGatewayVPOSCRYPTOPublicKey.txt"); R2 = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\BetapaymentGatewayHerbalifeSignaturePrivateKey.txt"); } var srVPOSLlaveCifradoPublica = new StreamReader(R1); var srComercioLlaveFirmaPrivada = new StreamReader(R2); MyHLShoppingCart myCart; SessionInfo sessionInfoMyCart = SessionInfo.GetSessionInfo(this._distributorId, this._locale); myCart = sessionInfoMyCart.ShoppingCart ?? ShoppingCartProvider.GetShoppingCart(this._distributorId, this._locale); var oVPOSBean = new VPOSBean(); oVPOSBean.acquirerId = acquirerId; oVPOSBean.commerceId = storeId; oVPOSBean.purchaseCurrencyCode = "840"; oVPOSBean.purchaseAmount = amount; oVPOSBean.purchaseOperationNumber = orderNumber; OrderTotals_V01 totals = myCart.Totals as OrderTotals_V01; VPOSTax oVPOSTax; var aTaxes = new ArrayList(); oVPOSTax = new VPOSTax(); oVPOSTax.Name = "IVA"; oVPOSTax.Amount = (string.Format(getPriceFormat((null != totals ? totals.TaxAmount : 0)), (null != totals ? totals.TaxAmount : 0)).Replace(".", "")).Replace(",", ""); // Only positive values are accepted.Value without formatting.Two last digits are cents. Eg. 1234 = 12.34. aTaxes.Add(oVPOSTax); oVPOSTax = new VPOSTax(); oVPOSTax.Name = "Servicio"; oVPOSTax.Amount = "0"; //string totalplustax = string.Empty; //totalplustax = (string.Format(getPriceFormat((null != myCart.Totals ? myCart.Totals.DiscountedItemsTotal + ((null != pHCharge ? pHCharge.Amount : 0) + (null != freightCharge ? freightCharge.Amount : 0)) : 0)), (null != myCart.Totals ? myCart.Totals.DiscountedItemsTotal + ((null != pHCharge ? pHCharge.Amount : 0) + (null != freightCharge ? freightCharge.Amount : 0)) : 0)).ToString().Replace(".", "")).Replace(",", ""); // Only positive values are accepted.Value without formatting.Two last digits are cents. Eg. 1234 = 12.34. aTaxes.Add(oVPOSTax); oVPOSTax = new VPOSTax(); oVPOSTax.Name = "Monto Grava IVA"; //oVPOSTax.Amount = totalplustax; oVPOSTax.Amount = (string.Format(getPriceFormat((null != totals ? totals.TaxableAmountTotal : 0)), (null != totals ? totals.TaxableAmountTotal : 0)).Replace(".", "")).Replace (",", ""); // Only positive values are accepted.Value without formatting.Two last digits are cents. Eg. 1234 = 12.34. aTaxes.Add(oVPOSTax); oVPOSTax = new VPOSTax(); oVPOSTax.Name = "Monto No Grava IVA"; oVPOSTax.Amount = (string.Format(getPriceFormat((null != totals ? totals.AmountDue - totals.TaxAmount - totals.TaxableAmountTotal : 0)), (null != totals ? totals.AmountDue - totals.TaxAmount - totals.TaxableAmountTotal : 0)).Replace(".", "")).Replace(",", ""); aTaxes.Add(oVPOSTax); oVPOSBean.taxes = aTaxes; var oVPOSSend = new VPOSSend(srVPOSLlaveCifradoPublica, srComercioLlaveFirmaPrivada, vectorId); oVPOSSend.execute(ref oVPOSBean); cipheredDataList.Add(oVPOSBean.cipheredSessionKey); cipheredDataList.Add(oVPOSBean.cipheredXML); cipheredDataList.Add(oVPOSBean.cipheredSignature); return(cipheredDataList); }