From f8bd07f450e64c11586b28d1279a83f457b64838 Mon Sep 17 00:00:00 2001 From: jchen293 Date: Wed, 3 Apr 2024 15:42:17 -0400 Subject: [PATCH] add refund code examples --- .../docs/csharp/current/insurance/refund.cs | 21 +++ .../docs/curl/current/insurance/refund.sh | 2 + .../docs/golang/current/insurance/refund.go | 15 ++ .../docs/java/current/insurance/refund.java | 15 ++ .../docs/node/current/insurance/refund.js | 9 ++ .../docs/node/current/insurance/retrieve.js | 2 +- .../docs/php/current/insurance/refund.php | 7 + .../docs/python/current/insurance/refund.py | 7 + .../responses/insurance/insurance-refund.json | 136 ++++++++++++++++++ .../docs/ruby/current/insurance/refund.rb | 7 + 10 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 official/docs/csharp/current/insurance/refund.cs create mode 100644 official/docs/curl/current/insurance/refund.sh create mode 100644 official/docs/golang/current/insurance/refund.go create mode 100644 official/docs/java/current/insurance/refund.java create mode 100644 official/docs/node/current/insurance/refund.js create mode 100644 official/docs/php/current/insurance/refund.php create mode 100644 official/docs/python/current/insurance/refund.py create mode 100644 official/docs/responses/insurance/insurance-refund.json create mode 100644 official/docs/ruby/current/insurance/refund.rb diff --git a/official/docs/csharp/current/insurance/refund.cs b/official/docs/csharp/current/insurance/refund.cs new file mode 100644 index 00000000..430d5d1e --- /dev/null +++ b/official/docs/csharp/current/insurance/refund.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Newtonsoft.Json; +using EasyPost; +using EasyPost.Models.API; + +namespace EasyPostExamples +{ + public class Examples + { + public static async Task Main() + { + var client = new EasyPost.Client("EASYPOST_API_KEY"); + + Insurance insurance = await client.Insurance.Refund("ins_..."); + + Console.WriteLine(JsonConvert.SerializeObject(insurance, Formatting.Indented)); + } + } +} diff --git a/official/docs/curl/current/insurance/refund.sh b/official/docs/curl/current/insurance/refund.sh new file mode 100644 index 00000000..73d6f698 --- /dev/null +++ b/official/docs/curl/current/insurance/refund.sh @@ -0,0 +1,2 @@ +curl -X POST https://api.easypost.com/v2/insurances/ins_.../refund \ + -u "EASYPOST_API_KEY": diff --git a/official/docs/golang/current/insurance/refund.go b/official/docs/golang/current/insurance/refund.go new file mode 100644 index 00000000..36002dda --- /dev/null +++ b/official/docs/golang/current/insurance/refund.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v3" +) + +func main() { + client := easypost.New("EASYPOST_API_KEY") + + insurance, _ := client.RefundInsurance("ins_...") + + fmt.Println(insurance) +} diff --git a/official/docs/java/current/insurance/refund.java b/official/docs/java/current/insurance/refund.java new file mode 100644 index 00000000..1a21d424 --- /dev/null +++ b/official/docs/java/current/insurance/refund.java @@ -0,0 +1,15 @@ +package insurances; + +import com.easypost.exception.EasyPostException; +import com.easypost.model.Insurance; +import com.easypost.service.EasyPostClient; + +public class Retrieve { + public static void main(String[] args) throws EasyPostException { + EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY"); + + Insurance insurance = client.insurance.refund("ins_..."); + + System.out.println(insurance); + } +} diff --git a/official/docs/node/current/insurance/refund.js b/official/docs/node/current/insurance/refund.js new file mode 100644 index 00000000..9a1bef56 --- /dev/null +++ b/official/docs/node/current/insurance/refund.js @@ -0,0 +1,9 @@ +const EasyPostClient = require('@easypost/api'); + +const client = new EasyPostClient('EASYPOST_API_KEY'); + +(async () => { + const insurance = await client.Insurance.refund('ins_...'); + + console.log(insurance); +})(); diff --git a/official/docs/node/current/insurance/retrieve.js b/official/docs/node/current/insurance/retrieve.js index 93497707..2e52f48e 100644 --- a/official/docs/node/current/insurance/retrieve.js +++ b/official/docs/node/current/insurance/retrieve.js @@ -5,5 +5,5 @@ const client = new EasyPostClient('EASYPOST_API_KEY'); (async () => { const insurance = await client.Insurance.retrieve('ins_...'); - console.logP(insurance); + console.log(insurance); })(); diff --git a/official/docs/php/current/insurance/refund.php b/official/docs/php/current/insurance/refund.php new file mode 100644 index 00000000..fadceaa8 --- /dev/null +++ b/official/docs/php/current/insurance/refund.php @@ -0,0 +1,7 @@ +insurance->refund('ins_...'); + +echo $insurance; diff --git a/official/docs/python/current/insurance/refund.py b/official/docs/python/current/insurance/refund.py new file mode 100644 index 00000000..c5fb6bd2 --- /dev/null +++ b/official/docs/python/current/insurance/refund.py @@ -0,0 +1,7 @@ +import easypost + +client = easypost.EasyPostClient("EASYPOST_API_KEY") + +insurance = client.insurance.refund("ins_...") + +print(insurance) diff --git a/official/docs/responses/insurance/insurance-refund.json b/official/docs/responses/insurance/insurance-refund.json new file mode 100644 index 00000000..79948d2c --- /dev/null +++ b/official/docs/responses/insurance/insurance-refund.json @@ -0,0 +1,136 @@ +{ + "id": "ins_2500e29183a64136b84a1e44ff08905f", + "object": "Insurance", + "mode": "test", + "reference": null, + "status": "cancelled", + "amount": "100.00000", + "provider": "easypost", + "provider_id": null, + "to_address": { + "id": "adr_568c1ebcba4c11ee96cd3cecef1b359e", + "object": "Address", + "created_at": "2024-01-24T00:05:52+00:00", + "updated_at": "2024-01-24T00:05:52+00:00", + "name": "DR. STEVE BRULE", + "company": null, + "street1": "179 N HARBOR DR", + "street2": null, + "city": "REDONDO BEACH", + "state": "CA", + "zip": "90277-2506", + "country": "US", + "phone": "8573875756", + "email": "DR_STEVE_BRULE@GMAIL.COM", + "mode": "test", + "carrier_facility": null, + "residential": false, + "federal_tax_id": null, + "state_tax_id": null, + "verifications": { + "zip4": { + "success": true, + "errors": [], + "details": null + }, + "delivery": { + "success": true, + "errors": [], + "details": { + "latitude": 33.8436, + "longitude": -118.39177, + "time_zone": "America/Los_Angeles" + } + } + } + }, + "from_address": { + "id": "adr_56912a8aba4c11ee96cf3cecef1b359e", + "object": "Address", + "created_at": "2024-01-24T00:05:52+00:00", + "updated_at": "2024-01-24T00:05:52+00:00", + "name": "EASYPOST", + "company": null, + "street1": "417 MONTGOMERY ST # 5", + "street2": null, + "city": "SAN FRANCISCO", + "state": "CA", + "zip": "94104-1129", + "country": "US", + "phone": "4153334445", + "email": "SUPPORT@EASYPOST.COM", + "mode": "test", + "carrier_facility": null, + "residential": false, + "federal_tax_id": null, + "state_tax_id": null, + "verifications": { + "zip4": { + "success": true, + "errors": [], + "details": null + }, + "delivery": { + "success": true, + "errors": [], + "details": { + "latitude": 37.79342, + "longitude": -122.40288, + "time_zone": "America/Los_Angeles" + } + } + } + }, + "shipment_id": null, + "tracker": { + "id": "trk_48fb9b6e8270488397cabd1ee6feccd6", + "object": "Tracker", + "mode": "test", + "tracking_code": "9400110898825022579493", + "status": "error", + "status_detail": null, + "created_at": "2024-01-24T00:05:52Z", + "updated_at": "2024-01-24T00:05:52Z", + "signed_by": null, + "weight": null, + "est_delivery_date": null, + "shipment_id": null, + "carrier": "USPS", + "tracking_details": [ + { + "object": "TrackingDetail", + "message": "In test mode, only test tracking numbers are valid. Test tracking numbers are EZ1000000001, EZ2000000002, ... , EZ7000000007", + "description": "", + "status": "error", + "status_detail": null, + "datetime": "2024-01-24T00:05:52Z", + "source": "ProcessingError", + "carrier_code": "", + "tracking_location": { + "object": "TrackingLocation", + "city": null, + "state": null, + "country": null, + "zip": null + } + } + ], + "carrier_detail": null, + "finalized": true, + "is_return": false, + "public_url": "https://track.easypost.com/djE6dHJrXzQ4ZmI5YjZlODI3MDQ4ODM5N2NhYmQxZWU2ZmVjY2Q2", + "fees": [] + }, + "tracking_code": "9400110898825022579493", + "fee": { + "object": "Fee", + "type": "InsuranceFee", + "amount": "0.50000", + "charged": true, + "refunded": false + }, + "messages": [], + "created_at": "2024-01-24T00:05:52Z", + "updated_at": "2024-01-24T00:05:52Z" + } + \ No newline at end of file diff --git a/official/docs/ruby/current/insurance/refund.rb b/official/docs/ruby/current/insurance/refund.rb new file mode 100644 index 00000000..f386a7bc --- /dev/null +++ b/official/docs/ruby/current/insurance/refund.rb @@ -0,0 +1,7 @@ +require 'easypost' + +client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY') + +insurance = client.insurance.refund('ins_...') + +puts insurance