Ejemplo n.º 1
0
        /// <summary>
        /// Gets the Md5 key refund.
        /// </summary>
        /// <param name="paymentConfiguration">The DIBS payment configuration.</param>
        /// <param name="merchant">The merchant.</param>
        /// <param name="orderId">The order id.</param>
        /// <param name="transact">The transact.</param>
        /// <param name="amount">The amount.</param>
        public static string GetMD5RefundKey(EpayConfiguration paymentConfiguration, string merchant, string orderId, string transact, string amount)
        {
            //todo: not implemented
            var hashString = $"merchant={merchant}&orderid={orderId}&transact={transact}&amount={amount}"; //todo: fix

            return(GetMD5Key(paymentConfiguration, hashString));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the key used to verify response from epay when payment is approved.
        /// </summary>
        /// <param name="paymentConfiguration">The epay payment configuration.</param>
        /// <param name="requestForm">The NameValueCollection from epay</param>
        public static string GetMd5ResponseKey(EpayConfiguration paymentConfiguration, NameValueCollection requestForm)
        {
            var hashString = "";

            for (int i = 0; i < requestForm.Count; i++)
            {
                if (requestForm.GetKey(i) != "hash")
                {
                    hashString += requestForm[i];
                }
            }
            return(GetMD5Key(paymentConfiguration, hashString));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the MD5 key used to send to epay in authorization step.
        /// </summary>
        /// <param name="paymentConfiguration">The epay payment configuration.</param>
        /// <param name="requestPaymentData">The request parameters.</param>
        /// <remarks>http://epay.bambora.com/en/hash-md5-check</remarks>
        /// <returns>MD5Key</returns>
        public static string GetMd5RequestKey(EpayConfiguration paymentConfiguration, Dictionary <string, object> requestPaymentData)
        {
            var hashString = "";

            foreach (var data in requestPaymentData)
            {
                if (data.Key != "md5key")
                {
                    hashString += data.Value;
                }
            }

            return(GetMD5Key(paymentConfiguration, hashString));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// http://epay.bambora.com/en/hash-md5-check
 /// The hash you send to (and receive from) Bambora must be the value of all parameters in the order they are sent + the MD5 key.
 /// </summary>
 /// <param name="paymentConfiguration"></param>
 /// <param name="hashString"></param>
 /// <returns></returns>
 private static string GetMD5Key(EpayConfiguration paymentConfiguration, string hashString)
 {
     return(GetMD5value(hashString + paymentConfiguration.MD5Key));
 }
 public EpayRequestHelper(IOrderNumberGenerator orderNumberGenerator, SiteContext siteContext, EpayConfiguration epayConfiguration)
 {
     _orderNumberGenerator = orderNumberGenerator;
     _siteContext          = siteContext;
     EpayConfiguration     = epayConfiguration;
 }