Esempio n. 1
0
        public static int ZarinpalPaymentVerification(string MerchantID, string Authority, int Amount, out long RefID)
        {
            ZarinPalService.PaymentGatewayImplementationServicePortTypeClient zp = new ZarinPalService.PaymentGatewayImplementationServicePortTypeClient();
            var Status = zp.PaymentVerification(MerchantID, Authority, Amount, out RefID);

            return(Status);
        }
Esempio n. 2
0
 public static int ZarinpalPayment(string MerchantID, int Amount, string Description, string Email, string Mobile, string CallbackURL, out string Authority)
 {
     Authority = string.Empty;
     try
     {
         ZarinPalService.PaymentGatewayImplementationServicePortTypeClient client = new ZarinPalService.PaymentGatewayImplementationServicePortTypeClient();
         var Status = client.PaymentRequest(MerchantID, Amount, Description, Email, Mobile, CallbackURL, out Authority);
         return(Status);
     }
     catch
     {
         return(-1000);
     }
 }
Esempio n. 3
0
        internal Transaction ZarinPalCallBackPayRequest(Guid transId, string status, string authority)
        {
            var transaction = PaymentComponenets.Instance.TransactionFacade.Get(transId);

            if (transaction == null)
            {
                return(null);
            }

            string value   = transaction.AdditionalData;
            string deValue = StringUtils.Decrypt(value);
            var    data    = deValue.Split('#');

            if (status.Equals("OK"))
            {
                int    Amount = ((int)transaction.Amount) / 10;
                long   RefID;
                string merchantId = data[0];
                System.Net.ServicePointManager.Expect100Continue = false;
                ZarinPalService.PaymentGatewayImplementationServicePortTypeClient zarinPalService = new ZarinPalService.PaymentGatewayImplementationServicePortTypeClient();

                int Status = zarinPalService.PaymentVerification(merchantId, authority, Amount, out RefID);

                transaction.RefId  = RefID.ToString();
                transaction.Status = Status;
                if (Status == 100)
                {
                    transaction.Done = true;
                }

                if (!PaymentComponenets.Instance.TransactionFacade.Update(transaction))
                {
                    return(null);
                }
                return(transaction);
            }
            else
            {
                //انصراف توسط کاربر یا عدم موفقیت پرداخت
                transaction.Status = 404;
                if (!PaymentComponenets.Instance.TransactionFacade.Update(transaction))
                {
                    return(null);
                }
                return(transaction);
            }
        }
Esempio n. 4
0
        public string ZarinPalCallPayRequest(Transaction transaction, string merchantId, string requestAuthority)
        {
            System.Net.ServicePointManager.Expect100Continue = false;

            //تقسم بر ده برای تبدیل زیال به تومان
            int newAmount = ((int)transaction.Amount) / 10;

            ZarinPalService.PaymentGatewayImplementationServicePortTypeClient zarinPalService = new ZarinPalService.PaymentGatewayImplementationServicePortTypeClient();
            string authority = "";
            int    status    = zarinPalService.PaymentRequest(merchantId, newAmount, transaction.Description, "", "", Enums.Bank.ZarinPal.AfterCallBackUrl(transaction.Id, requestAuthority), out authority);

            if (status == 100)
            {
                var data = $"{merchantId}#{transaction.InvoiceId}#{Enums.Bank.ZarinPal.AfterCallBackUrl(transaction.Id, requestAuthority)}#{authority}";
                transaction.AdditionalData = StringUtils.Encrypt(data);
                var radynCallPayRequestInRadyn = Enums.Bank.ZarinPal.CallBankUrl(transaction.Id, requestAuthority);
                return(!PaymentComponenets.Instance.TransactionFacade.Update(transaction) ? string.Empty : radynCallPayRequestInRadyn);
            }
            else
            {
                throw new Exception("امکان اتصال به درگاه وجود ندارد");
            }
        }