static void UpdateSenderExample(Configuration configuration) { // For more details on senders please check https://docs.transferzero.com/docs/transaction-flow/#sender SendersApi sendersApi = new SendersApi(configuration); Sender sender = new Sender(); sender.City = "London"; SenderRequest senderRequest = new SenderRequest(sender: sender); try { SenderResponse response = sendersApi.PatchSender(Guid.Parse("73f382d0-ffff-ffff-ffff-e78d1a133b8a"), senderRequest); System.Console.WriteLine(response); } catch (ApiException e) { if (e.IsValidationError) { SenderResponse response = e.ParseObject <SenderResponse>(); System.Console.WriteLine("Validation Error when trying to update sender!"); System.Console.WriteLine(response); System.Console.WriteLine(response.Object.Errors); } else { throw e; } } }
static Guid?CreateSenderExample(Configuration configuration) { // For more details on senders please check https://docs.transferzero.com/docs/transaction-flow/#sender SendersApi sendersApi = new SendersApi(configuration); Sender sender = new Sender( country: "UG", phoneCountry: "UG", phoneNumber: "752403639", email: "*****@*****.**", firstName: "test", lastName: "user", city: "Lagos", street: "Unknown 123", postalCode: "798983", birthDate: DateTime.Parse("1980-01-01"), ip: "127.0.0.1", addressDescription: "Description", documents: new List <Document>(), externalId: "SENDER-00001" ); SenderRequest senderRequest = new SenderRequest( sender: sender ); try { SenderResponse response = sendersApi.PostSenders(senderRequest); System.Console.WriteLine(response); return(response.Object.Id); } catch (ApiException e) { if (e.IsValidationError) { SenderResponse response = e.ParseObject <SenderResponse>(); System.Console.WriteLine("Validation Error when trying to create sender!"); System.Console.WriteLine(response); System.Console.WriteLine(response.Object.Errors); return(null); } else { throw e; } } }
static Sender GetSenderFromExternalId(Configuration configuration) { // For more details on senders and external IDs on senders // please check https://docs.transferzero.com/docs/transaction-flow/#sender SendersApi sendersApi = new SendersApi(configuration); String externalId = "SENDER-00001"; SenderListResponse senderListResponse = sendersApi.GetSenders(externalId: externalId); if (senderListResponse.Object.Count > 0) { System.Console.WriteLine("Sender found"); Sender result = senderListResponse.Object[0]; System.Console.WriteLine(result); return(result); } else { System.Console.WriteLine("Sender not found"); return(null); } }
public void Init() { instance = new SendersApi(); }