Exemplo n.º 1
0
        public void VerifyResult(int orderId, string SaleReferenceId)
        {
            try
            {
                BypassCertificateError();
                MellatWebService.PaymentGatewayClient bp = new MellatWebService.PaymentGatewayClient();
                var result = bp.bpVerifyRequestAsync(
                    this.terminalId,
                    this.userName,
                    this.password,
                    orderId,
                    orderId,
                    long.Parse(SaleReferenceId)).Result;

                string VerifyResult = result.Body.@return;

                if (VerifyResult != "0")
                {
                    throw new Exception(TranslateMessage(VerifyResult));
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 2
0
        public void SettleRequest(int orderId, string orderBankReference)
        {
            try
            {
                MellatWebService.PaymentGatewayClient bp = new MellatWebService.PaymentGatewayClient();
                var result = bp.bpSettleRequestAsync(
                    this.terminalId,
                    this.userName,
                    this.password,
                    orderId,
                    orderId,
                    long.Parse(orderBankReference)).Result;

                string SettleResult = result.Body.@return;

                if (SettleResult != "0")
                {
                    throw new Exception(TranslateMessage(SettleResult));
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 3
0
        public string PayRequest(int orderId, int orderPrice, string CallBackUrl)
        {
            try
            {
                BypassCertificateError();

                MellatWebService.PaymentGatewayClient bp = new MellatWebService.PaymentGatewayClient();
                var result = bp.bpPayRequestAsync(
                    this.terminalId,
                    this.userName,
                    this.password,
                    orderId,
                    //order.id,
                    orderPrice,
                    //order.price * 10,
                    DateTime.Now.ToString("yyyyMMdd"),
                    DateTime.Now.ToString("HHMMSS"),
                    "",
                    CallBackUrl,
                    0).Result;
                ;
                string[] res = [email protected](',');
                if (res[0] == "0")
                {
                    //refid
                    return(res[1]);
                }
                else
                {
                    return("-1");
                    //return "nok" + res[0];
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }