private async Task ShouldUpdateCardInstrument() { var tokenInstrument = await CreateTokenInstrument(); tokenInstrument.ShouldNotBeNull(); var updateCardInstrument = new UpdateCardInstrumentRequest { ExpiryMonth = 12, ExpiryYear = 2024, Name = "John Doe", Customer = new UpdateCustomerRequest { Id = tokenInstrument.Customer.Id, Default = true }, AccountHolder = new AccountHolder { FirstName = "John", LastName = "Doe", Phone = new Phone { CountryCode = "+1", Number = "415 555 2671" }, BillingAddress = new Address { AddressLine1 = "CheckoutSdk.com", AddressLine2 = "90 Tottenham Court Road", City = "London", State = "London", Zip = "W1T 4TJ", Country = CountryCode.GB } } }; var updateInstrumentResponse = await DefaultApi.InstrumentsClient().Update(tokenInstrument.Id, updateCardInstrument); updateInstrumentResponse.ShouldNotBeNull(); var updateCardInstrumentResponse = (UpdateCardInstrumentResponse)updateInstrumentResponse; updateCardInstrumentResponse.Fingerprint.ShouldNotBeNullOrEmpty(); var getResponse = await DefaultApi.InstrumentsClient().Get(tokenInstrument.Id); getResponse.ShouldNotBeNull(); var cardResponse = (GetCardInstrumentResponse)getResponse; cardResponse.ShouldNotBeNull(); cardResponse.Id.ShouldNotBeNull(); cardResponse.Fingerprint.ShouldNotBeNull(); cardResponse.ExpiryMonth.ShouldBe(12); cardResponse.ExpiryYear.ShouldBe(2024); cardResponse.Customer.Default.ShouldBeTrue(); cardResponse.AccountHolder.FirstName.ShouldBe("John"); cardResponse.AccountHolder.LastName.ShouldBe("Doe"); cardResponse.CardType.ShouldNotBeNull(); cardResponse.CardCategory.ShouldNotBeNull(); }
private async Task ShouldUpdateInstrument() { var updateInstrumentRequest = new UpdateCardInstrumentRequest(); var updateInstrumentResponse = new UpdateCardInstrumentResponse(); _apiClient.Setup(apiClient => apiClient.Patch <UpdateInstrumentResponse>("instruments/instrument_id", _authorization, updateInstrumentRequest, CancellationToken.None, null)) .ReturnsAsync(() => updateInstrumentResponse); IInstrumentsClient client = new InstrumentsClient(_apiClient.Object, _configuration.Object); var response = await client.Update("instrument_id", updateInstrumentRequest); response.ShouldNotBeNull(); response.ShouldBeSameAs(updateInstrumentResponse); }