Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add refund function in insurance service #552

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## Next release

- Add Refund function in insurance service for requesting a refund for standalone insurance.

## v6.2.1 (2024-03-18)

- Fix serialization bug for carrier accounts parameter on `RetrieveStatelessRates` parameter set
Expand Down
19 changes: 19 additions & 0 deletions EasyPost.Tests/ServicesTests/InsuranceServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ public async Task TestRetrieve()
Assert.Equal(insurance.Id, retrievedInsurance.Id);
}

[Fact]
[CrudOperations.Create]
[Testing.Function]
public async Task TestRefund()
{
UseVCR("refund");

Dictionary<string, object> parameters = Fixtures.BasicInsurance;
parameters.Add("tracking_code", "EZ1000000001");

Insurance insurance = await Client.Insurance.Create(parameters);
Insurance cancelledInsurance = await Client.Insurance.Refund(insurance.Id);

Assert.IsType<Insurance>(insurance);
Assert.StartsWith("ins_", cancelledInsurance.Id);
Assert.Equal("cancelled", cancelledInsurance.Status);
Assert.Equal("Insurance was cancelled by the user.", cancelledInsurance.Messages[0]);
}

#endregion

#endregion
Expand Down
98 changes: 98 additions & 0 deletions EasyPost.Tests/cassettes/net/insurance_service/refund.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading