public Task <CreateInstrumentResponse> Create(CreateInstrumentRequest createInstrumentRequest, CancellationToken cancellationToken = default) { CheckoutUtils.ValidateParams("createInstrumentRequest", createInstrumentRequest); return(ApiClient.Post <CreateInstrumentResponse>( InstrumentsPath, SdkAuthorization(), createInstrumentRequest, cancellationToken)); }
private async Task ShouldGetCustomerDetailsWithInstrument() { var cardTokenResponse = await PreviousApi.TokensClient().Request(GetCardTokenRequest()); cardTokenResponse.ShouldNotBeNull(); var request = new CreateInstrumentRequest { Token = cardTokenResponse.Token, Customer = new InstrumentCustomerRequest { Email = "*****@*****.**", Name = "Instrument Customer", Default = true, Phone = new Phone { CountryCode = "+1", Number = "4155552671" } } }; var createInstrumentResponse = await PreviousApi.InstrumentsClient().Create(request); createInstrumentResponse.ShouldNotBeNull(); createInstrumentResponse.Customer.ShouldNotBeNull(); createInstrumentResponse.Customer.Id.ShouldNotBeNullOrEmpty(); CustomerDetailsResponse customerDetailsResponse = await PreviousApi.CustomersClient().Get(createInstrumentResponse.Customer.Id); customerDetailsResponse.ShouldNotBeNull(); customerDetailsResponse.Instruments.ShouldNotBeNull(); customerDetailsResponse.Instruments.Count.ShouldBe(1); InstrumentDetails instrumentDetails = customerDetailsResponse.Instruments[0]; createInstrumentResponse.Id.ShouldBe(instrumentDetails.Id); createInstrumentResponse.Type.ShouldBe(InstrumentType.Card); createInstrumentResponse.Fingerprint.ShouldBe(instrumentDetails.Fingerprint); createInstrumentResponse.ExpiryMonth.ShouldBe(instrumentDetails.ExpiryMonth); createInstrumentResponse.ExpiryYear.ShouldBe(instrumentDetails.ExpiryYear); createInstrumentResponse.Scheme.ShouldBe(instrumentDetails.Scheme); createInstrumentResponse.Last4.ShouldBe(instrumentDetails.Last4); createInstrumentResponse.Bin.ShouldBe(instrumentDetails.Bin); createInstrumentResponse.CardType.ShouldBe(CardType.Credit); createInstrumentResponse.Issuer.ShouldBe(instrumentDetails.Issuer); createInstrumentResponse.IssuerCountry.ShouldNotBeNull(); createInstrumentResponse.ProductId.ShouldBe(instrumentDetails.ProductId); createInstrumentResponse.ProductType.ShouldBe(instrumentDetails.ProductType); }