Example #1
0
        private void ProcessPayment(PaymentOrder payment)
        {
            var account = accountQueryRepository.SingleOrDefault(it => it.Id == payment.AccountId);

            if (account == null)
            {
                throw new InvalidOperationException("Account Not found");
            }

            if (payment.CVC == 12)
            {
                throw new Exception();
            }

            account.Balance  += payment.Amount;
            payment.Processed = true;

            this.paymentPersistence.Update(payment);

            this.accountPersistence.Update(account);

            if (!string.IsNullOrWhiteSpace(payment.WebHookEndpoint))
            {
                //TODO: Abstrair
                HttpClient client = new HttpClient();

                StringContent stringContent = new StringContent(payment.CorrelationId);

                client.PostAsync($"{payment.WebHookEndpoint}", stringContent).GetAwaiter().GetResult();
            }
        }
Example #2
0
 public static Task <bool> CheckPaymentPAIDAsync(PaymentOrder record, int bookingId, int superPNRId, string superPNRNo)
 {
     return(Task.Factory.StartNew(() =>
     {
         return CheckPaymentPAID(record, bookingId, superPNRId, superPNRNo);
     }));
 }
        ///<summary>
        ///  Returns a Typed PaymentOrder Entity with mock values.
        ///</summary>
        static public PaymentOrder CreateMockInstance_Generated(TransactionManager tm)
        {
            PaymentOrder mock = new PaymentOrder();

            mock.TransNum    = TestUtility.Instance.RandomString(5, false);;
            mock.Payer       = TestUtility.Instance.RandomString(99, false);;
            mock.PayerAcc    = TestUtility.Instance.RandomString(9, false);;
            mock.PayerBank   = TestUtility.Instance.RandomString(99, false);;
            mock.PayerBranch = TestUtility.Instance.RandomString(126, false);;
            mock.Benef       = TestUtility.Instance.RandomString(99, false);;
            mock.BenefAcc    = TestUtility.Instance.RandomString(9, false);;
            mock.BenefBank   = TestUtility.Instance.RandomString(99, false);;
            mock.BenefBranch = TestUtility.Instance.RandomString(99, false);;
            mock.Amount      = (decimal)TestUtility.Instance.RandomShort();


            // create a temporary collection and add the item to it
            TList <PaymentOrder> tempMockCollection = new TList <PaymentOrder>();

            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);


            return((PaymentOrder)mock);
        }
Example #4
0
        static void CreatePaymentOrder_whenSameTransactionIdIsGiven(Instamojo objClass)
        {
            PaymentOrder objPaymentRequest = new PaymentOrder();

            //Required POST parameters
            objPaymentRequest.name           = "ABCD";
            objPaymentRequest.email          = "*****@*****.**";
            objPaymentRequest.phone          = "9969156561";
            objPaymentRequest.amount         = 9;
            objPaymentRequest.currency       = "USD";
            objPaymentRequest.transaction_id = "test"; // duplicate Transaction Id
            objPaymentRequest.redirect_url   = "https://swaggerhub.com/api/saich/pay-with-instamojo/1.0.0";

            try
            {
                CreatePaymentOrderResponse objPaymentResponse = objClass.createNewPaymentRequest(objPaymentRequest);
                MessageBox.Show("Order Id = " + objPaymentResponse.order.id);
            }
            catch (ArgumentNullException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (WebException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (InvalidPaymentOrderException ex)
            {
                if (!ex.IsWebhookValid())
                {
                    MessageBox.Show("Webhook is invalid");
                }

                if (!ex.IsCurrencyValid())
                {
                    MessageBox.Show("Currency is Invalid");
                }

                if (!ex.IsTransactionIDValid())
                {
                    MessageBox.Show("Transaction ID is Inavlid");
                }
            }
            catch (ConnectionException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (BaseException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex.Message);
            }
        }
Example #5
0
        private PaymentOrder BuildPaymentOrder(VerifiedPaymentOrderDto verifiedPaymentOrder, decimal feeRate, string key)
        {
            var input        = verifiedPaymentOrder.PaymentOrder;
            var paymentOrder = new PaymentOrder()
            {
                TenantId        = input.TenantId,
                AppId           = input.AppId,
                Amount          = input.Amount,
                Fee             = Convert.ToInt32(input.Amount * (feeRate / 100)),
                CompanyId       = verifiedPaymentOrder.CompanyId,
                AccountId       = verifiedPaymentOrder.AccountId,
                Id              = idGenerator.NextId(),
                ExternalOrderId = input.ExternalOrderId,
                ChannelId       = verifiedPaymentOrder.ChannelId,
                BankId          = verifiedPaymentOrder.BankId,
                CreateIp        = input.CreateIp,
                AsyncCallback   = input.AsyncCallback,
                SyncCallback    = input.SyncCallback,
                CallbackStatus  = CallbackStatus.Pending,
                Expire          = Clock.Now.AddHours(2),
                ExtData         = input.ExtData,
                DeviceType      = input.DeviceType
            };

            paymentOrder.Md5 = paymentOrder.GetMd5(key);
            paymentOrder.SetNewOrder();
            return(paymentOrder);
        }
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                PaymentOrder mock   = CreateMockInstance(tm);
                bool         result = DataRepository.PaymentOrderProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                PaymentOrderQuery query = new PaymentOrderQuery();

                query.AppendEquals(PaymentOrderColumn.TransNum, mock.TransNum.ToString());
                query.AppendEquals(PaymentOrderColumn.Payer, mock.Payer.ToString());
                query.AppendEquals(PaymentOrderColumn.PayerAcc, mock.PayerAcc.ToString());
                query.AppendEquals(PaymentOrderColumn.PayerBank, mock.PayerBank.ToString());
                query.AppendEquals(PaymentOrderColumn.PayerBranch, mock.PayerBranch.ToString());
                query.AppendEquals(PaymentOrderColumn.Benef, mock.Benef.ToString());
                query.AppendEquals(PaymentOrderColumn.BenefAcc, mock.BenefAcc.ToString());
                query.AppendEquals(PaymentOrderColumn.BenefBank, mock.BenefBank.ToString());
                query.AppendEquals(PaymentOrderColumn.BenefBranch, mock.BenefBranch.ToString());
                query.AppendEquals(PaymentOrderColumn.Amount, mock.Amount.ToString());

                TList <PaymentOrder> results = DataRepository.PaymentOrderProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }
Example #7
0
 private void RecieveAmount_Click(object sender, RoutedEventArgs e)
 {
     if (PaymentDataGrid.SelectedItems.Count != 0)
     {
         List <PaymentOrder> paymentOrders = new List <PaymentOrder>();
         foreach (object t in PaymentDataGrid.SelectedItems)
         {
             DataRowView row = t as DataRowView;
             if (row != null)
             {
                 var          transactionId = (int)row[0];
                 PaymentOrder payment       = new PaymentOrder {
                     Id = transactionId
                 };
                 paymentOrders.Add(payment);
             }
         }
         new RecievePay(paymentOrders);
         PaymentDataGrid.ItemsSource = new PaymentOrder().ViewPending().AsDataView();
     }
     else
     {
         MessageBox.Show("Please Select at least one Transaction", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
 public static Task <RequeryStatus.Requery> CheckPaymentPAIDAsync(PaymentOrder record, int superPNRId, string superPNRNo)
 {
     return(Task.Factory.StartNew(() =>
     {
         return CheckPaymentPAID(record, -1, superPNRId, superPNRNo);
     }));
 }
        /// <summary>
        /// Deep load all PaymentOrder children.
        /// </summary>
        private void Step_03_DeepLoad_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                int count = -1;
                mock           = CreateMockInstance(tm);
                mockCollection = DataRepository.PaymentOrderProvider.GetPaged(tm, 0, 10, out count);

                DataRepository.PaymentOrderProvider.DeepLoading += new EntityProviderBaseCore <PaymentOrder, PaymentOrderKey> .DeepLoadingEventHandler(
                    delegate(object sender, DeepSessionEventArgs e)
                {
                    if (e.DeepSession.Count > 3)
                    {
                        e.Cancel = true;
                    }
                }
                    );

                if (mockCollection.Count > 0)
                {
                    DataRepository.PaymentOrderProvider.DeepLoad(tm, mockCollection[0]);
                    System.Console.WriteLine("PaymentOrder instance correctly deep loaded at 1 level.");

                    mockCollection.Add(mock);
                    // DataRepository.PaymentOrderProvider.DeepSave(tm, mockCollection);
                }

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
Example #10
0
        private async Task <decimal> CreditPay(PaymentOrder pay)
        {
            var openId = HttpContext.Session.GetString("OpenId");

            if (string.IsNullOrEmpty(openId))
            {
                throw new ApplicationException("Unauthorized");
            }

            var type = Int16.Parse(HttpContext.Session.GetString("IdType"));

            // 扣除余额
            var result = await _authSrv.UpdateCredit(openId, false, pay.Amount);

            // 支付完成
            _paySrv.UpdatePaymentResult(pay.Id, true);

            var order = _orderSrv.GetProductOrderById((Guid)pay.OrderId);

            _orderSrv.UpdateProductOrder(order.Id, Product.Models.Enums.OrderState.Excuting, pay.Id);

            // 发送订单消息
            await SendOrder(order);

            // 返回余额
            return(result);
        }
Example #11
0
        public static List <string> CheckMissedCapturePayment(PaymentOrder payment)
        {
            List <string> pushInfo       = null;
            var           _paymentMethod = payment.PaymentMethodCode.ToLower();

            // Check is over 7 days for process or not.
            if (payment.PaymentDate.HasValue && (_paymentMethod == "ipacc" || _paymentMethod.StartsWith("ady")) &&
                payment.PaymentStatusCode != "CAPT")
            {
                DateTime dtPayment = payment.PaymentDate.Value;
                if ((DateTime.Now - dtPayment).TotalDays > 7)
                {
                    pushInfo = pushInfo ?? new List <string>();
                    pushInfo.Add(string.Format("PaymentOrders PaymentID {0} : Passed 7 days for capture.", payment.OrderID));
                }
            }

            // Check payment order if is IPACC is it transactionID null, will cause capture request erorr.
            if (_paymentMethod == "ipacc" && string.IsNullOrWhiteSpace(payment.Ipay88TransactionID))
            {
                pushInfo = pushInfo ?? new List <string>();
                pushInfo.Add($"PaymentOrders PaymentID {payment.OrderID} : TransactionID empty.");
            }

            return(pushInfo);
        }
Example #12
0
        ///<summary>
        ///  Update the Typed PaymentOrder Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, PaymentOrder mock)
        {
            PaymentOrderTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
Example #13
0
 public void InsertPaymentOrder(PaymentOrder paymentOrder)
 {
     using (var bankContext = new BankingContext())
     {
         bankContext.PaymentOrder.Add(paymentOrder);
         bankContext.SaveChanges();
     }
 }
Example #14
0
        public ActionResult EnterAmount(DonationAmountViewModel userInput)
        {
            Instamojo objClass = InstamojoImplementation.getApi(PaymentGatewaySecrets.CLIENT_ID,
                                                                PaymentGatewaySecrets.CLIENT_SECRET, PaymentGatewaySecrets.API_ENDPOINT,
                                                                PaymentGatewaySecrets.AUTH_ENDPOINT);
            PaymentOrder objPaymentRequest = new PaymentOrder()
            {
                name           = userInput.Name,
                email          = userInput.Email,
                phone          = userInput.PhoneNumber,
                amount         = userInput.Amount,
                transaction_id = Guid.NewGuid().ToString(),
                redirect_url   = "http://localhost:59701/Donate/PaymentMade"
            };

            if (objPaymentRequest.validate())
            {
                if (objPaymentRequest.emailInvalid)
                {
                    ModelState.AddModelError("", "Email is invalid");
                }
                if (objPaymentRequest.nameInvalid)
                {
                    ModelState.AddModelError("", "Name is invalid");
                }
                if (objPaymentRequest.phoneInvalid)
                {
                    ModelState.AddModelError("", "Phone Number is invalid");
                }
                if (objPaymentRequest.amountInvalid)
                {
                    ModelState.AddModelError("", "Amount is invalid");
                }
                if (objPaymentRequest.currencyInvalid)
                {
                    ModelState.AddModelError("", "Currency is invalid");
                }
                if (objPaymentRequest.transactionIdInvalid)
                {
                    ModelState.AddModelError("", "Transaction ID is invalid");
                }
                if (objPaymentRequest.redirectUrlInvalid)
                {
                    ModelState.AddModelError("", "URL is invalid");
                }
                if (objPaymentRequest.webhookUrlInvalid)
                {
                    ModelState.AddModelError("", "Webhook is invalid");
                }
            }
            else
            {
                CreatePaymentOrderResponse objPaymentResponse = objClass.createNewPaymentRequest(objPaymentRequest);
                return(Redirect(objPaymentResponse.payment_options.payment_url));
            }

            return(View());
        }
Example #15
0
        public HttpResponseMessage Post([FromBody] PaymentOrder row)
        {
            var id = _process.Insert(row, UpdatedId);

            return(Request.CreateResponse(HttpStatusCode.OK, new
            {
                data = id
            }));
        }
Example #16
0
        static void CreatePaymentOrder_whenWebhookIsInvalid(Instamojo objClass)
        {
            PaymentOrder objPaymentRequest = new PaymentOrder();

            objPaymentRequest.email       = "*****@*****.**";
            objPaymentRequest.name        = "Test Name";
            objPaymentRequest.description = "Test Description";
            objPaymentRequest.phone       = "9334556657";
            objPaymentRequest.amount      = 100;
            objPaymentRequest.currency    = "INR";
            string randomName = Path.GetRandomFileName();

            randomName = randomName.Replace(".", string.Empty);
            objPaymentRequest.transaction_id = "test" + randomName;

            objPaymentRequest.redirect_url = "https://swaggerhub.com/api/saich/pay-with-instamojo/1.0.0";
            objPaymentRequest.webhook_url  = "invalid web hook url";
            //Extra POST parameters

            if (objPaymentRequest.validate())
            {
                if (objPaymentRequest.emailInvalid)
                {
                    MessageBox.Show("Email is not valid");
                }
                if (objPaymentRequest.nameInvalid)
                {
                    MessageBox.Show("Name is not valid");
                }
                if (objPaymentRequest.phoneInvalid)
                {
                    MessageBox.Show("Phone is not valid");
                }
                if (objPaymentRequest.amountInvalid)
                {
                    MessageBox.Show("Amount is not valid");
                }
                if (objPaymentRequest.currencyInvalid)
                {
                    MessageBox.Show("Currency is not valid");
                }
                if (objPaymentRequest.transactionIdInvalid)
                {
                    MessageBox.Show("Transaction Id is not valid");
                }
                if (objPaymentRequest.redirectUrlInvalid)
                {
                    MessageBox.Show("Redirect Url Id is not valid");
                }

                if (objPaymentRequest.webhookUrlInvalid)
                {
                    MessageBox.Show("Webhook URL is not valid");
                }
            }
        }
Example #17
0
        public void CreatePaymentOrder(PaymentOrder paymentOrder, string language)
        {
            TransactionResult transactionResult;

            transactionResult = orderServices.CreatePaymentOrder(GetCustomerId(), paymentOrder, language);
            if (transactionResult.HasError)
            {
                ReturnErrorResponse(transactionResult.Message);
            }
        }
        /// <summary>
        /// Check the foreign key dal methods.
        /// </summary>
        private void Step_10_FK_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                PaymentOrder entity = CreateMockInstance(tm);
                bool         result = DataRepository.PaymentOrderProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test FK, Insert Failed");
            }
        }
        /// <summary>
        /// Test methods exposed by the EntityHelper class.
        /// </summary>
        private void Step_20_TestEntityHelper_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);

                PaymentOrder entity = mock.Copy() as PaymentOrder;
                entity = (PaymentOrder)mock.Clone();
                Assert.IsTrue(PaymentOrder.ValueEquals(entity, mock), "Clone is not working");
            }
        }
Example #20
0
        ///<summary>
        ///  Returns a Typed PaymentOrder Entity with mock values.
        ///</summary>
        static public PaymentOrder CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            PaymentOrder mock = PaymentOrderTest.CreateMockInstance_Generated(tm);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);

            // return the modified object
            return(mock);
        }
 ///<summary>
 ///  Update the Typed PaymentOrder Entity with modified mock values.
 ///</summary>
 static public void UpdateMockInstance_Generated(TransactionManager tm, PaymentOrder mock)
 {
     mock.Payer       = TestUtility.Instance.RandomString(99, false);;
     mock.PayerAcc    = TestUtility.Instance.RandomString(9, false);;
     mock.PayerBank   = TestUtility.Instance.RandomString(99, false);;
     mock.PayerBranch = TestUtility.Instance.RandomString(126, false);;
     mock.Benef       = TestUtility.Instance.RandomString(99, false);;
     mock.BenefAcc    = TestUtility.Instance.RandomString(9, false);;
     mock.BenefBank   = TestUtility.Instance.RandomString(99, false);;
     mock.BenefBranch = TestUtility.Instance.RandomString(99, false);;
     mock.Amount      = (decimal)TestUtility.Instance.RandomShort();
 }
Example #22
0
            public static bool CheckPaymentPAID(PaymentOrder record, int bookingId, int superPNRId, string superPNRNo)
            {
                decimal amt        = Alphareds.Module.Common.Core.IsForStaging ? 1.00m : record.PaymentAmount;
                string  _payStatus = record.PaymentStatusCode.ToUpper();

                var result = PaymentServiceController.iPay88.RequeryPaymentStatus(record.Ipay88RefNo, record.CurrencyCode, amt.ToString("n2"));

                if (result.Desc == "Record not found" || result.Status == "Record not found")
                {
                    string attempRefNo = bookingId.ToString() + " - " + superPNRNo;
                    attempRefNo = attempRefNo != record.Ipay88RefNo ? attempRefNo : superPNRId.ToString() + " - " + superPNRNo;
                    result      = PaymentServiceController.iPay88.RequeryPaymentStatus(attempRefNo, record.CurrencyCode, amt.ToString("n2"));
                }
                else if (result.Desc == "Invalid parameters" || result.Desc == "Incorrect amount")
                {
                    throw new Exception("iPay88 requery result stated - " + result.Desc);
                }
                else if (result.Desc == "Payment Fail") // iPay FPX only
                {
                    record.PaymentStatusCode = "FAIL";
                    return(false);
                }
                else if (result.Desc == "Voided")
                {
                    record.PaymentStatusCode = "VOID";
                    return(false);
                }

                bool paymentAccept = result.Status == "1" && (result.Desc == "Authorised" || result.Desc == "Captured" || result.Desc == string.Empty);

                if (paymentAccept && (_payStatus != "PAID" && _payStatus != "CAPT" && _payStatus != "FAIL" && _payStatus != "VOID"))
                {
                    if (record.SuperPNROrder.BookingStatusCode == "PPA")
                    {
                        record.SuperPNROrder.BookingStatusCode = "RHI";
                    }

                    if (result.Desc == "Authorised")
                    {
                        record.PaymentStatusCode = "AUTH";
                    }
                    else if (result.Desc == "Captured")
                    {
                        record.PaymentStatusCode = "CAPT";
                    }
                    else if (result.Desc == string.Empty)
                    {
                        record.PaymentStatusCode = "PAID";
                    }
                }

                return(paymentAccept);
            }
Example #23
0
        private PaymentMessageVm GetPaymentVerificationData(PaymentOrder payment)
        {
            var paymentMsg = new PaymentMessageVm();
            var data       = _unitOfWork.Users.Single(c => c.EmployeeId == payment.OrderId);

            if (data != null)
            {
                paymentMsg.DealerName = data.UserName;
                paymentMsg.OrderId    = payment.OrderId ?? 0;
                paymentMsg.UserId     = data.UserId;
            }
            return(paymentMsg);
        }
Example #24
0
 public PaymentOrder CreatePaymentOrder(PaymentOrder order)
 {
     try
     {
         _orderRepo.Add(order);
         _orderRepo.Save();
         return(order);
     }
     catch (Exception)
     {
         throw;
     }
 }
        /// <summary>
        /// Serialize the mock PaymentOrder entity into a temporary file.
        /// </summary>
        private void Step_06_SerializeEntity_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_PaymentOrder.xml");

                EntityHelper.SerializeXml(mock, fileName);
                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");

                System.Console.WriteLine("mock correctly serialized to a temporary file.");
            }
        }
Example #26
0
        public async Task <IActionResult> CreatePaymentOrder(Guid orderId, PayMethod method)
        {
            var openId = HttpContext.Session.GetString("OpenId");

            if (string.IsNullOrEmpty(openId))
            {
                return(Json(Url.Action("Index", "Home")));
            }
            var order = _orderSrv.GetProductOrderById(orderId);

            if (order == null)
            {
                return(Json(Url.Action("ErrorOrder", "Home", new { message = "订单不存在" })));
            }

            if (order.OrderType == OrderType.AddCredit && method == PayMethod.Credit)
            {
                return(Json(Url.Action("ErrorOrder", "Home", new { message = "该商品不支持积分购买" })));
            }

            // 创建支付订单
            var pay = new PaymentOrder();

            pay.Amount     = (decimal)order.Amount;
            pay.PayMethod  = method;
            pay.UserId     = openId;
            pay.OrderState = Payment.Models.Enums.OrderState.WaitForPayment;
            pay.OrderId    = order.Id;
            _paySrv.CreatePaymentOrder(pay);

            // 积分支付购买商品
            if (order.OrderType != OrderType.AddCredit && method == PayMethod.Credit)
            {
                var result = await CreditPay(pay);

                return(Json(Url.Action("WxPayOrder", "WxPay", new { orderid = order.Id, payid = pay.Id })));
            }
            // 微信支付
            else if (method == PayMethod.Wechat)
            {
                return(Json(Url.Action("WxPayOrder", "WxPay", new { orderid = order.Id, payid = pay.Id })));
            }
            else if (method == PayMethod.Alipay)
            {
                return(Json(Url.Action("JsApi", "Alipay", new { orderid = order.Id, payid = pay.Id })));
            }
            else
            {
                return(Json(Url.Action("ErrorOrder", "Home", new { message = "支付订单错误" })));
            }
        }
Example #27
0
        public CreatePaymentOrderResponse CreateNewPaymentRequest(PaymentOrder objPaymentRequest)
        {
            if (objPaymentRequest == null)
            {
                throw new ArgumentNullException(typeof(PaymentOrder).Name, "PaymentOrder Object Can not be Null ");
            }

            bool isInValid = objPaymentRequest.validate();

            if (isInValid)
            {
                throw new InvalidPaymentOrderException();
            }

            try
            {
                string stream = api_call("POST", "gateway/orders/", objPaymentRequest);
                CreatePaymentOrderResponse objPaymentCreateResponse = JsonConvert.DeserializeObject <CreatePaymentOrderResponse>(stream);

                return(objPaymentCreateResponse);
            }
            catch (IOException ex)
            {
                throw new IOException(ex.Message, ex.InnerException);
            }
            catch (BaseException ex)
            {
                throw new BaseException(ex.Message, ex.InnerException);
            }
            catch (UriFormatException ex)
            {
                throw new UriFormatException(ex.Message, ex.InnerException);
            }
            catch (WebException ex)
            {
                if (ex.Status == WebExceptionStatus.ProtocolError)
                {
                    HttpWebResponse err = ex.Response as HttpWebResponse;
                    if (err != null)
                    {
                        string htmlResponse = new StreamReader(err.GetResponseStream()).ReadToEnd();
                        throw new InvalidPaymentOrderException(htmlResponse);
                    }
                }
                throw new WebException(ex.Message, ex.InnerException);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
Example #28
0
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(poNumber.Text) || string.IsNullOrEmpty(beneficiary.Text) || string.IsNullOrEmpty(payee.Text) || string.IsNullOrEmpty(phone.Text) || string.IsNullOrEmpty(amount.Text) || string.IsNullOrEmpty(interest.Text) || string.IsNullOrEmpty(school.SelectedItem.ToString()))
     {
         MessageBox.Show("All Feild Are Required", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         PaymentOrder payment = new PaymentOrder(poNumber.Text, beneficiary.Text, payee.Text, phone.Text,
                                                 Convert.ToDouble(amount.Text), Convert.ToDouble(interest.Text), paytoschoolchool.Id, LoginUser.UserId, null);
         payment.Save(payment);
         PendingDataGrid.ItemsSource = new PaymentOrder().ViewPending().AsDataView();
     }
 }
        /// <summary>
        /// Inserts a mock PaymentOrder entity into the database.
        /// </summary>
        private void Step_01_Insert_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                Assert.IsTrue(DataRepository.PaymentOrderProvider.Insert(tm, mock), "Insert failed");

                System.Console.WriteLine("DataRepository.PaymentOrderProvider.Insert(mock):");
                System.Console.WriteLine(mock);

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
        public void Update(Guid id, PaymentOrder item, Guid UpdatedId)
        {
            var Q = db.Get(id);

            Check.IsNotNull(Q, $"No Existen Registro para este item {item.SaleOrder.Number}.");
            // Q.SaleOrder_Id = item.SaleOrder_Id;
            Q.Payment      = item.Payment;
            Q.PricePayment = item.PricePayment;
            Q.PricePending = item.PricePending;
            Q.Observation  = item.Observation;
            Q.VoucherCard  = item.VoucherCard;
            Q.State        = ObjectState.Modified;
            Q.UpdatedId    = UpdatedId;
            db.Save(Q);
        }
Example #31
0
 /// <summary>
 /// 获得支付请求的Form表单
 /// </summary>
 /// <param name="order"></param>
 /// <returns></returns>
 public override string GetPaymentForm(PaymentOrder order)
 {
     throw new NotImplementedException();
 }
Example #32
0
 /// <summary>
 /// 发送支付请求到支付网关
 /// </summary>
 /// <param name="PaymentOrder">支付订单信息</param>
 /// <returns></returns>
 public override void SendRequest(PaymentOrder order)
 {
     throw new NotImplementedException();
 }