public void UpdatePaymentByKeySetStatusInterfaceCode()
        {
            IClient commerceToolsClient = this.paymentsFixture.GetService <IClient>();
            Payment payment             = this.paymentsFixture.CreatePayment();

            Assert.True(string.IsNullOrEmpty(payment.PaymentStatus.InterfaceCode));

            var interfaceCode = "20000";

            var updateActions = new List <UpdateAction <Payment> >();
            var setStatusInterfaceCodeUpdateAction = new SetStatusInterfaceCodeUpdateAction
            {
                InterfaceCode = interfaceCode
            };

            updateActions.Add(setStatusInterfaceCodeUpdateAction);

            Payment retrievedPayment = commerceToolsClient
                                       .ExecuteAsync(new UpdateByKeyCommand <Payment>(payment.Key, payment.Version, updateActions))
                                       .Result;

            this.paymentsFixture.PaymentsToDelete.Add(retrievedPayment);

            Assert.Equal(interfaceCode, retrievedPayment.PaymentStatus.InterfaceCode);
        }
示例#2
0
        public async Task UpdatePaymentSetStatusInterfaceCode()
        {
            await WithUpdateablePayment(client, async payment =>
            {
                var interfaceCode = TestingUtility.RandomString();
                var action        = new SetStatusInterfaceCodeUpdateAction
                {
                    InterfaceCode = interfaceCode
                };

                var updatedPayment = await client
                                     .ExecuteAsync(payment.UpdateById(actions => actions.AddUpdate(action)));

                Assert.Equal(interfaceCode, updatedPayment.PaymentStatus.InterfaceCode);
                return(updatedPayment);
            });
        }