Releases: trolley/dotnet-sdk
v2.2.3
Changelog
Support for adding payment related fields while creating a new InvoicePayment.
Old way of creating InvoicePayment
InvoicePayment invoicePayment = gateway.invoicePayment.Create(null, invoicePaymentPartRequest);
New way of creating InvoicePayment
InvoicePaymentRequest invoicePaymentRequest = new InvoicePaymentRequest(
new InvoicePaymentPart[]{invoicePaymentPartRequest},
null,
false,
"payment-memo",
"external-id-"+uuid,
new string[]{"tag1", "tag2"});
InvoicePayment invPayment = gateway.invoicePayment.Create(invoicePaymentRequest);
The InvoicePayment.Create(string, InvoicePaymentPart)
method has been marked as deprecated, and will be removed in early 2025.
v2.1.3
Release Notes
- Changed
Payment.routeMinimum
from double to string - Added test to demonstrate
Payment.routeMinimum
usage - Bumped up the version number and added README
BREAKING CHANGE
The Payment.routeMinimum
variable type is now string
. Previously it was double
.
This change has been made to conform to how our API responds and to be consistent with Recipient.routeMinimum
variable.
The PaymentTest.cs
test class has been updated to include an example of how to use the new variable: https://github.com/trolley/dotnet-sdk/blob/main/tests/PaymentTest.cs#L90C1-L94C14
Usage Before
Assert.IsTrue(payment.routeMinimum>0);
Usage After
if(payment.routeMinimum != null){
Assert.IsTrue(Convert.ToDouble(payment.routeMinimum)>0);
}else{
Assert.IsNull(payment.routeMinimum);
}
We hope this change makes your development experience better. Please reach out to us on [email protected] if you have any questions.
2.0.2
Release Notes
- Fix taxReportable handling
- Make it easy to set
paypal
account as primary via aRecipientAccount.Update
request.
2.0.1
v2.0.1
- Add
bankAccountType
field to RecipientAccount object - Fixed a response-parsing error when a Batch is created with Payment, to better reflect the response fields
v2.0.0
Trolley .Net SDK Major Update (Nov 20, 2023)
With this update we're making some important changes to our C# .Net SDK.
This update covers all the API endpoints our SDK didn't cover before, and makes some important updates to how our packages are organized.
To mark this milestone we're bumping up the MAJOR version 2.0.0
.
Please read this Update Guide to understand what changed and how to adopt these changes.
Breaking Changes
1. PaymentRails renamed to Trolley
We have completed our rebranding and now all instances of PaymentRails
have been replaced with Trolley
accordingly and wherever needed.
This means the classes have been renamed too.
You'll need to optimize imports in your project to adopt to this change.
Here's an example of how it used to be before vs how it is now:
Old Package | New Installation |
---|---|
using PaymentRails.Types; |
using Trolley.Types; |
PaymentRails.Gateway gateway = ...; |
Trolley.Gateway gateway = ...; |
2. Package reorganization
We have completed our rebranding and now all instances of PaymentRails
have been replaced with Trolley
accordingly and wherever needed.
This means the classes have been renamed too.
You'll need to optimize imports in your project to adopt to this change.
Here's an example of how it used to be before vs how it is now:
Old Package | New Installation |
---|---|
using PaymentRails.Types; |
using Trolley.Types; |
PaymentRails.Gateway gateway = ...; |
Trolley.Gateway gateway = ...; |
3. Methods renamed
To comply with .NET naming conventions, all Gateway methods have been renamed, wherever required.
Here's an example:
Old Name | New Name |
---|---|
Recipient.create() |
Recipient.Create() |
Batch.delete() |
Batch.Delete() |
In most of the cases, you'll just need to rename the methods and reference them by the new names.
There are other specific breaking changes born out of renaming that are discussed below:
1. Method RecipientGateway.all()
renamed
This method has been renamed to RecipientGateway.ListAllRecipients()
. This method also allows you to provide a search term.
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
int page = 1;
int pageSize = 10;
// Get all recipients with an optional search term and manual pagination
Recipients allRecipients = gateway.recipient.ListAllRecipients("<search_term>", page, pageSize);
List<Recipient> recipients = allRecipients.recipients;
Meta meta = allRecipients.meta;
int nextPage = page < meta.pages ? (meta.page + 1) : -1;
// Or, with auto-pagination with an IEnumerable object
var recipients = gateway.recipient.ListAllRecipients("<search_term>");
foreach(Recipient recipient in recipients){
Console.WriteLine(recipient.id);
}
...
2. Method RecipientGateway.update(Recipient)
updated
This method has been updated to RecipientGateway.Update(string, Recipient)
. You now have to provide the recipientId
separately as a string.
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
Recipient recipient = getUpdateRecipientBody();
string recipientId = getRecipientIdToUpdate();
bool response = gateway.recipient.Update(recipientId, recipient);
...
3. Method variants of RecipientGateway.Search()
deleted
All instances of RecipientGateway.Search()
method have been deleted, RecipientGateway.ListAllRecipients()
has been introduced instead in its place.
This new method works the same way but also is in line with the name of the API it uses, along with allowing you to search.
For more information, refer to our documentation, or the test found at tests/RecipientTest.cs
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
int page = 1;
int pageSize = 10;
// Get all recipients with an optional search term and manual pagination
Recipients allRecipients = gateway.recipient.ListAllRecipients("<search_term>", page, pageSize);
List<Recipient> recipients = allRecipients.recipients;
Meta meta = allRecipients.meta;
int nextPage = page < meta.pages ? (meta.page + 1) : -1;
// Or, with auto-pagination with an IEnumerable object
var recipients = gateway.recipient.ListAllRecipients("<search_term>");
foreach(Recipient recipient in recipients){
Console.WriteLine(recipient.id);
}
...
4. Method variants of RecipientGateway.findLogs()
renamed
The method earlier named RecipientGateway.findLogs()
has been renamed to RecipientGateway.GetAllLogs()
.
This method lets you access all recipient logs, with either manual or auto-pagination:
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
int page = 1;
int pageSize = 10;
string recipientId = getRecipientId();
// Get all recipients logs with manual pagination
Logs allLogs = gateway.recipient.GetAllLogs(recipientId, page, pageSize).logs;
List<Log> logs = allRecipients.logs;
Meta meta = allLogs.meta;
int nextPage = page < meta.pages ? (meta.page + 1) : -1;
// Or, with auto-pagination with an IEnumerable object
var logs = gateway.recipient.GetAllLogs(recipientId);
foreach(Recipient recipient in recipients){
Console.WriteLine(recipient.id);
}
...
5. Variable Recipient.TimeZone
removed
The variable Recipient.TimeZone
has been removed since it doesn't correspond to our APIs and attributes.
6. Method PaymentGateway.find()
renamed
This method has been renamed to PaymentGateway.Get()
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
string recipientId = getRecipientIdToFetch();
Recipient recipient = gateway.recipient.Get(recipientId);
Console.WriteLine(recipient.id);
...
7. Method PaymentGateway.query()
replaced
The method PaymentGateway.query()
has been replaced by PaymentGateway.Search()
. It returns a Payments
object.
This Payments
object helps you manually paginate better by providing you with a List<Payment>
object along with a Meta
object for pagination information.
For more information, refer to our documentation, or the test found at tests/PaymentTest.cs
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
int page = 1;
int pageSize = 10;
string recipientId = getRecipientId();
// Search payments with optional search term and batch id, with manual pagination
Payments allPayments = trolley.payment.Search("<search_term>", page, pageSize, "<batch_id>");
List<Payment> payments = allPayments.payments;
foreach (Payment payment in payments){
Console.WriteLine(payment.id);
}
Meta meta = allPayments.meta;
int nextPage = page < meta.pages ? (meta.page + 1) : -1;
...
8. Method BatchGateway.Delete(Batch)
deleted
Now, in order to delete a batch, you'll have to use the BatchGateway.Delete(string)
or its variant BatchGateway.Delete(string[])
to delete multiple batches at once, providing batchId
as the parameter.
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
string batchId = getBatchIdToDelete();
string[] batchIds = getMultipleBatchIdsToDelete();
// Delete a single batch
bool deleteResult = gateway.batch.Delete(batchId);
// Or, Delete multiple batches
bool deleteResult = gateway.batch.Delete(batchIds);
...
9. Method BatchGateway.query()
replaced
The BatchGateway.query()
has been replaced by BatchGateway.ListAllBatches()
method which allows you to list and search through all batches, and returns an object of type Batches
.
This Batches
object helps you manually paginate better by providing you with a List<Batch>
object along with a Meta
object for pagination information.
For more information, refer to our documentation, or the test found at tests/BatchTest.cs
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
int page = 1;
int pageSize = 10;
// List all batches with optional search term and manual pagination
Batches allBatches = gateway.batch.ListAllBatches("<search_term>", page, pageSize);
List<Batch> batches = allBatches.batches;
Meta meta = allBatches.meta;
int nextPage = page < meta.pages ? (meta.page + 1) : -1;
// Or, with auto-pagination with an IEnumerable object
var batches = gateway.batch.ListAllBatches("<search_term>");
foreach (Batch batch in batches){
Console.WriteLine(batch.id);
}
...
10. Method BatchGateway.generateQuote(Batch)
deleted
To comply with our API behaviour and for consistency, the only version of the above method that remains is the one that takes the batchId
as a string
argument.
For more information, refer to our documentation, or the test found at tests/BatchTest.cs
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
string batchId = getBatchId();
Batch batch = gateway.batch.GenerateQuote(batchId);
...
11. Method BatchGateway.processBatch(Batch)
deleted
To comply with our API behaviour and for consistency, the only version of the above method that remains is the one that takes the batchId
as a string
argument.
For more information, refer to our documentation, or the test found at tests/BatchTest.cs
...
Gateway gateway = new Trolley.Gateway("<ACCESS_KEY>","<SECRET_KEY>");
string batchId = getBatchId();
Batch batch = gateway.batch.ProcessBatch(batchId);
....