public void UpdatePaymentByKeySetInterfaceId() { IClient commerceToolsClient = this.paymentsFixture.GetService <IClient>(); Payment payment = this.paymentsFixture.CreatePayment(); Assert.True(string.IsNullOrEmpty(payment.InterfaceId)); var interfaceId = TestingUtility.RandomString(10); var updateActions = new List <UpdateAction <Payment> >(); SetInterfaceIdUpdateAction setInterfaceIdUpdateAction = new SetInterfaceIdUpdateAction() { InterfaceId = interfaceId }; updateActions.Add(setInterfaceIdUpdateAction); Payment retrievedPayment = commerceToolsClient .ExecuteAsync(new UpdateByKeyCommand <Payment>(payment.Key, payment.Version, updateActions)) .Result; this.paymentsFixture.PaymentsToDelete.Add(retrievedPayment); Assert.Equal(interfaceId, retrievedPayment.InterfaceId); }
public async Task UpdatePaymentSetInterfaceId() { await WithUpdateablePayment(client, async payment => { var interfaceId = TestingUtility.RandomString(); var action = new SetInterfaceIdUpdateAction { InterfaceId = interfaceId }; var updatedPayment = await client .ExecuteAsync(payment.UpdateById(actions => actions.AddUpdate(action))); Assert.Equal(interfaceId, updatedPayment.InterfaceId); return(updatedPayment); }); }