Пример #1
0
        //[ODataRoute("Accounts({accountId})/PayinPIs({piId})/Microsoft.Test.E2E.AspNet.OData.Containment.Duplicate")]
        public ITestActionResult DuplicatePayinPI(int accountId, int piId)
        {
            var       account           = _dataSource.Accounts.Single(a => a.AccountID == accountId);
            var       paymentInstrument = account.PayinPIs.Single(pi => pi.PaymentInstrumentID == piId);
            Statement newStatement      = null;

            if (paymentInstrument.Statement != null)
            {
                newStatement = new Statement()
                {
                    StatementID            = 1,
                    TransactionDescription = (string)paymentInstrument.Statement.TransactionDescription.Clone(),
                    Amount = paymentInstrument.Statement.Amount,
                };
            }
            var newPI = new PaymentInstrument()
            {
                PaymentInstrumentID = account.PayinPIs.Max(pi => pi.PaymentInstrumentID) + 1,
                FriendlyName        = paymentInstrument.FriendlyName + " - Copy",
                Statement           = newStatement,
            };

            account.PayinPIs.Add(newPI);

            return(Ok(newPI));
        }
Пример #2
0
        public ITestActionResult PutToPayoutPIFromAccount(int accountId, [FromBody] PaymentInstrument paymentInstrument)
        {
            var account = _dataSource.Accounts.Single(a => a.AccountID == accountId);

            account.PayoutPI = paymentInstrument;
            return(Ok(paymentInstrument));
        }
Пример #3
0
        // POST ~/Accounts(100)/PayinPIs
        public ITestActionResult PostToPayinPIsFromAccount(int key, [FromBody] PaymentInstrument pi)
        {
            var account = _dataSource.Accounts.Single(a => a.AccountID == key);

            pi.PaymentInstrumentID = account.PayinPIs.Max(p => p.PaymentInstrumentID) + 1;
            account.PayinPIs.Add(pi);
            return(Created(pi));
        }
Пример #4
0
        public ITestActionResult PutToPayinPI(int accountId, int paymentInstrumentId, [FromBody] PaymentInstrument paymentInstrument)
        {
            var account    = _dataSource.Accounts.Single(a => a.AccountID == accountId);
            var originalPi = account.PayinPIs.Single(p => p.PaymentInstrumentID == paymentInstrumentId);

            originalPi.FriendlyName = paymentInstrument.FriendlyName;
            originalPi.Statement    = paymentInstrument.Statement;
            return(Ok(paymentInstrument));
        }