예제 #1
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);
     }
 }
예제 #2
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("امکان اتصال به درگاه وجود ندارد");
            }
        }