Esempio n. 1
0
        public void GetSpecificPayment()
        {
            var nordeaApiManager = new NordeaAPIv3Manager();
            var payments         = nordeaApiManager.GetPayments();

            if (payments.Count == 0)
            {
                Creditor afsender = new Creditor {
                    Account = new Account {
                        Currency = "DKK", Value = "20301544117544", Type = "BBAN_DK"
                    }, Message = "Test2"
                };
                Debtor modtager = new Debtor {
                    Account = new Account {
                        Currency = "DKK", Value = "20301544118028", Type = "BBAN_DK"
                    }, Message = "Test"
                };
                nordeaApiManager.InitiatePayment(afsender, modtager, 10.0M, "DKK");
            }
            payments = nordeaApiManager.GetPayments();
            Assert.IsTrue(payments.Count > 0);
            if (payments.Count > 0)
            {
                var payment  = payments.ElementAt(0);
                var id       = payment.Id;
                var _payment = nordeaApiManager.GetPayment(id);
                Assert.IsTrue(PaymentEqual(payment, _payment));
            }
        }
Esempio n. 2
0
        public void InitiatePayment()
        {
            var      nordeaApiManager = new NordeaAPIv3Manager();
            Creditor afsender         = new Creditor {
                Account = new Account {
                    Currency = "DKK", Value = "20301544117544", Type = "BBAN_DK"
                }, Message = "Test2"
            };
            Debtor modtager = new Debtor {
                Account = new Account {
                    Currency = "DKK", Value = "20301544118028", Type = "BBAN_DK"
                }, Message = "Test"
            };
            var apiResult = nordeaApiManager.InitiatePayment(afsender, modtager, 10.0M, "DKK");

            Assert.IsNotNull(apiResult);
            var paymentId     = apiResult.Id;
            var confirmResult = nordeaApiManager.ConfirmPayment(paymentId);

            Assert.IsNotNull(confirmResult);
            var payments   = nordeaApiManager.GetPayments();
            var paymentIds = payments.Select(p => p.Id);

            Assert.IsTrue(payments.Count > 0);
            Assert.IsTrue(paymentIds.Contains(paymentId));
        }
        public ActionResult Payment(PaymentViewModel model)
        {
            var creditorAccount = model.Creditor.Account.Value;

            if (!UserCanAccessAccountData(creditorAccount))
            {
                throw new Exception("Not Allowed");
            }
            var apiManager = new NordeaAPIv3Manager();
            var apiResult  = apiManager.InitiatePayment(model.Creditor, model.Debtor, model.Amount, "DKK");

            SetContextCulture();
            return(View("PaymentStatus", apiResult));
        }