diff --git a/insurance.go b/insurance.go index 170757a..459d640 100644 --- a/insurance.go +++ b/insurance.go @@ -130,6 +130,6 @@ func (c *Client) RefundInsurance(insuranceID string) (out *Insurance, err error) // allows specifying a context that can interrupt the request. func (c *Client) RefundInsuranceWithContext(ctx context.Context, insuranceID string) (out *Insurance, err error) { // TODO: remove beta when endpoint is in GA. - err = c.post(ctx, "/beta/insurances/"+insuranceID+"/refund", nil, &out) + err = c.post(ctx, "insurances/"+insuranceID+"/refund", nil, &out) return } diff --git a/tests/cassettes/TestInsuranceRefund.yaml b/tests/cassettes/TestInsuranceRefund.yaml index a94cb4a..9b36fa3 100644 --- a/tests/cassettes/TestInsuranceRefund.yaml +++ b/tests/cassettes/TestInsuranceRefund.yaml @@ -18,18 +18,18 @@ interactions: url: https://api.easypost.com/v2/insurances method: POST response: - body: '{"amount":"100.00000","created_at":"2024-04-02T21:40:33Z","fee":{"amount":"1.00000","charged":true,"object":"Fee","refunded":false,"type":"InsuranceFee"},"from_address":{"carrier_facility":null,"city":"SAN - FRANCISCO","company":null,"country":"US","created_at":"2024-04-02T21:40:33+00:00","email":"REDACTED","federal_tax_id":null,"id":"adr_a2a5ca7ff13911ee86373cecef1b359e","mode":"test","name":"JACK + body: '{"amount":"100.00000","created_at":"2024-04-04T16:43:58Z","fee":{"amount":"1.00000","charged":true,"object":"Fee","refunded":false,"type":"InsuranceFee"},"from_address":{"carrier_facility":null,"city":"SAN + FRANCISCO","company":null,"country":"US","created_at":"2024-04-04T16:43:58+00:00","email":"REDACTED","federal_tax_id":null,"id":"adr_8847027bf2a211eeb73fac1f6bc53342","mode":"test","name":"JACK SPARROW","object":"Address","phone":"REDACTED","residential":true,"state":"CA","state_tax_id":null,"street1":"388 - TOWNSEND ST APT 20","street2":"","updated_at":"2024-04-02T21:40:33+00:00","verifications":{"delivery":{"details":{"latitude":37.77551,"longitude":-122.39697,"time_zone":"America/Los_Angeles"},"errors":[],"success":true},"zip4":{"details":null,"errors":[],"success":true}},"zip":"94107-1670"},"id":"ins_dfdbe86c54d14b7b82a337ccfa0cbc03","messages":[],"mode":"test","object":"Insurance","provider":"easypost","provider_id":null,"reference":null,"shipment_id":null,"status":"pending","to_address":{"carrier_facility":null,"city":"REDONDO - BEACH","company":null,"country":"US","created_at":"2024-04-02T21:40:33+00:00","email":"REDACTED","federal_tax_id":null,"id":"adr_a2a01f7ef13911eea98dac1f6bc53342","mode":"test","name":"ELIZABETH + TOWNSEND ST APT 20","street2":"","updated_at":"2024-04-04T16:43:58+00:00","verifications":{"delivery":{"details":{"latitude":37.77551,"longitude":-122.39697,"time_zone":"America/Los_Angeles"},"errors":[],"success":true},"zip4":{"details":null,"errors":[],"success":true}},"zip":"94107-1670"},"id":"ins_134ab85c12134a0a9b45f3bc7ba9e85c","messages":[],"mode":"test","object":"Insurance","provider":"easypost","provider_id":null,"reference":null,"shipment_id":null,"status":"pending","to_address":{"carrier_facility":null,"city":"REDONDO + BEACH","company":null,"country":"US","created_at":"2024-04-04T16:43:57+00:00","email":"REDACTED","federal_tax_id":null,"id":"adr_88416b59f2a211ee9ad83cecef1b359e","mode":"test","name":"ELIZABETH SWAN","object":"Address","phone":"REDACTED","residential":false,"state":"CA","state_tax_id":null,"street1":"179 - N HARBOR DR","street2":"","updated_at":"2024-04-02T21:40:33+00:00","verifications":{"delivery":{"details":{"latitude":33.8436,"longitude":-118.39177,"time_zone":"America/Los_Angeles"},"errors":[],"success":true},"zip4":{"details":null,"errors":[],"success":true}},"zip":"90277-2506"},"tracker":{"carrier":"USPS","carrier_detail":{"alternate_identifier":null,"container_type":null,"destination_location":"CHARLESTON + N HARBOR DR","street2":"","updated_at":"2024-04-04T16:43:57+00:00","verifications":{"delivery":{"details":{"latitude":33.8436,"longitude":-118.39177,"time_zone":"America/Los_Angeles"},"errors":[],"success":true},"zip4":{"details":null,"errors":[],"success":true}},"zip":"90277-2506"},"tracker":{"carrier":"USPS","carrier_detail":{"alternate_identifier":null,"container_type":null,"destination_location":"CHARLESTON SC, 29401","destination_tracking_location":null,"est_delivery_date_local":null,"est_delivery_time_local":null,"guaranteed_delivery_date":null,"initial_delivery_attempt":null,"object":"CarrierDetail","origin_location":"HOUSTON TX, 77001","origin_tracking_location":{"city":"HOUSTON","country":null,"object":"TrackingLocation","state":"TX","zip":"77063"},"service":"First-Class - Package Service"},"created_at":"2024-04-02T21:39:43Z","est_delivery_date":"2024-04-02T21:39:43Z","fees":[],"finalized":true,"id":"trk_a70d538510fa45bfb03d18b4fb8ae4fc","is_return":false,"mode":"test","object":"Tracker","public_url":"https://track.easypost.com/djE6dHJrX2E3MGQ1Mzg1MTBmYTQ1YmZiMDNkMThiNGZiOGFlNGZj","shipment_id":null,"signed_by":null,"status":"pre_transit","status_detail":"status_update","tracking_code":"EZ1000000001","tracking_details":[{"carrier_code":"","datetime":"2024-03-02T21:39:43Z","description":"","message":"Pre-Shipment - Info Sent to USPS","object":"TrackingDetail","source":"USPS","status":"pre_transit","status_detail":"status_update","tracking_location":{"city":null,"country":null,"object":"TrackingLocation","state":null,"zip":null}},{"carrier_code":"","datetime":"2024-03-03T10:16:43Z","description":"","message":"Shipping - Label Created","object":"TrackingDetail","source":"USPS","status":"pre_transit","status_detail":"status_update","tracking_location":{"city":"HOUSTON","country":null,"object":"TrackingLocation","state":"TX","zip":"77063"}}],"updated_at":"2024-04-02T21:39:43Z","weight":null},"tracking_code":"EZ1000000001","updated_at":"2024-04-02T21:40:33Z"}' + Package Service"},"created_at":"2024-04-04T16:40:56Z","est_delivery_date":"2024-04-04T16:40:56Z","fees":[],"finalized":true,"id":"trk_9e3524de40064c12a4681ec0134c61e1","is_return":false,"mode":"test","object":"Tracker","public_url":"https://track.easypost.com/djE6dHJrXzllMzUyNGRlNDAwNjRjMTJhNDY4MWVjMDEzNGM2MWUx","shipment_id":null,"signed_by":null,"status":"pre_transit","status_detail":"status_update","tracking_code":"EZ1000000001","tracking_details":[{"carrier_code":"","datetime":"2024-03-04T16:40:56Z","description":"","message":"Pre-Shipment + Info Sent to USPS","object":"TrackingDetail","source":"USPS","status":"pre_transit","status_detail":"status_update","tracking_location":{"city":null,"country":null,"object":"TrackingLocation","state":null,"zip":null}},{"carrier_code":"","datetime":"2024-03-05T05:17:56Z","description":"","message":"Shipping + Label Created","object":"TrackingDetail","source":"USPS","status":"pre_transit","status_detail":"status_update","tracking_location":{"city":"HOUSTON","country":null,"object":"TrackingLocation","state":"TX","zip":"77063"}}],"updated_at":"2024-04-04T16:40:56Z","weight":null},"tracking_code":"EZ1000000001","updated_at":"2024-04-04T16:43:58Z"}' headers: Cache-Control: - private, no-cache, no-store @@ -38,7 +38,7 @@ interactions: Expires: - "0" Location: - - /api/v2/insurances/ins_dfdbe86c54d14b7b82a337ccfa0cbc03 + - /api/v2/insurances/ins_134ab85c12134a0a9b45f3bc7ba9e85c Pragma: - no-cache Referrer-Policy: @@ -54,20 +54,20 @@ interactions: X-Download-Options: - noopen X-Ep-Request-Uuid: - - ecfb0090660c7b51e78b23cc002f89bd + - 57918bbe660ed8cde786a2bc007157e2 X-Frame-Options: - SAMEORIGIN X-Node: - - bigweb32nuq + - bigweb43nuq X-Permitted-Cross-Domain-Policies: - none X-Proxied: - - intlb4nuq 39c21b8207 + - intlb3nuq 39c21b8207 - extlb1nuq 60566a9ec2 X-Runtime: - - "0.181918" + - "0.224278" X-Version-Label: - - easypost-202404022034-93dc413b70-master + - easypost-202404041612-01938f7c7e-master X-Xss-Protection: - 1; mode=block status: 201 Created @@ -81,21 +81,21 @@ interactions: - REDACTED User-Agent: - REDACTED - url: https://api.easypost.com/beta/insurances/ins_dfdbe86c54d14b7b82a337ccfa0cbc03/refund + url: https://api.easypost.com/v2/insurances/ins_134ab85c12134a0a9b45f3bc7ba9e85c/refund method: POST response: - body: '{"amount":"100.00000","created_at":"2024-04-02T21:40:33Z","fee":{"amount":"1.00000","charged":true,"object":"Fee","refunded":false,"type":"InsuranceFee"},"from_address":{"carrier_facility":null,"city":"SAN - FRANCISCO","company":null,"country":"US","created_at":"2024-04-02T21:40:33+00:00","email":"REDACTED","federal_tax_id":null,"id":"adr_a2a5ca7ff13911ee86373cecef1b359e","mode":"test","name":"JACK + body: '{"amount":"100.00000","created_at":"2024-04-04T16:43:58Z","fee":{"amount":"1.00000","charged":true,"object":"Fee","refunded":false,"type":"InsuranceFee"},"from_address":{"carrier_facility":null,"city":"SAN + FRANCISCO","company":null,"country":"US","created_at":"2024-04-04T16:43:58+00:00","email":"REDACTED","federal_tax_id":null,"id":"adr_8847027bf2a211eeb73fac1f6bc53342","mode":"test","name":"JACK SPARROW","object":"Address","phone":"REDACTED","residential":true,"state":"CA","state_tax_id":null,"street1":"388 - TOWNSEND ST APT 20","street2":null,"updated_at":"2024-04-02T21:40:33+00:00","verifications":{"delivery":{"details":{"latitude":37.77551,"longitude":-122.39697,"time_zone":"America/Los_Angeles"},"errors":[],"success":true},"zip4":{"details":null,"errors":[],"success":true}},"zip":"94107-1670"},"id":"ins_dfdbe86c54d14b7b82a337ccfa0cbc03","messages":[],"mode":"test","object":"Insurance","provider":"easypost","provider_id":null,"reference":null,"shipment_id":null,"status":"cancelled","to_address":{"carrier_facility":null,"city":"REDONDO - BEACH","company":null,"country":"US","created_at":"2024-04-02T21:40:33+00:00","email":"REDACTED","federal_tax_id":null,"id":"adr_a2a01f7ef13911eea98dac1f6bc53342","mode":"test","name":"ELIZABETH + TOWNSEND ST APT 20","street2":null,"updated_at":"2024-04-04T16:43:58+00:00","verifications":{"delivery":{"details":{"latitude":37.77551,"longitude":-122.39697,"time_zone":"America/Los_Angeles"},"errors":[],"success":true},"zip4":{"details":null,"errors":[],"success":true}},"zip":"94107-1670"},"id":"ins_134ab85c12134a0a9b45f3bc7ba9e85c","messages":[],"mode":"test","object":"Insurance","provider":"easypost","provider_id":null,"reference":null,"shipment_id":null,"status":"cancelled","to_address":{"carrier_facility":null,"city":"REDONDO + BEACH","company":null,"country":"US","created_at":"2024-04-04T16:43:57+00:00","email":"REDACTED","federal_tax_id":null,"id":"adr_88416b59f2a211ee9ad83cecef1b359e","mode":"test","name":"ELIZABETH SWAN","object":"Address","phone":"REDACTED","residential":false,"state":"CA","state_tax_id":null,"street1":"179 - N HARBOR DR","street2":null,"updated_at":"2024-04-02T21:40:33+00:00","verifications":{"delivery":{"details":{"latitude":33.8436,"longitude":-118.39177,"time_zone":"America/Los_Angeles"},"errors":[],"success":true},"zip4":{"details":null,"errors":[],"success":true}},"zip":"90277-2506"},"tracker":{"carrier":"USPS","carrier_detail":{"alternate_identifier":null,"container_type":null,"destination_location":"CHARLESTON + N HARBOR DR","street2":null,"updated_at":"2024-04-04T16:43:57+00:00","verifications":{"delivery":{"details":{"latitude":33.8436,"longitude":-118.39177,"time_zone":"America/Los_Angeles"},"errors":[],"success":true},"zip4":{"details":null,"errors":[],"success":true}},"zip":"90277-2506"},"tracker":{"carrier":"USPS","carrier_detail":{"alternate_identifier":null,"container_type":null,"destination_location":"CHARLESTON SC, 29401","destination_tracking_location":null,"est_delivery_date_local":null,"est_delivery_time_local":null,"guaranteed_delivery_date":null,"initial_delivery_attempt":null,"object":"CarrierDetail","origin_location":"HOUSTON TX, 77001","origin_tracking_location":{"city":"HOUSTON","country":null,"object":"TrackingLocation","state":"TX","zip":"77063"},"service":"First-Class - Package Service"},"created_at":"2024-04-02T21:40:34Z","est_delivery_date":"2024-04-02T21:40:34Z","fees":[],"finalized":true,"id":"trk_efa51f08fed54736abbd400f6866755a","is_return":false,"mode":"test","object":"Tracker","public_url":"https://track.easypost.com/djE6dHJrX2VmYTUxZjA4ZmVkNTQ3MzZhYmJkNDAwZjY4NjY3NTVh","shipment_id":null,"signed_by":null,"status":"pre_transit","status_detail":"status_update","tracking_code":"EZ1000000001","tracking_details":[{"carrier_code":"","datetime":"2024-03-02T21:40:34Z","description":"","message":"Pre-Shipment - Info Sent to USPS","object":"TrackingDetail","source":"USPS","status":"pre_transit","status_detail":"status_update","tracking_location":{"city":null,"country":null,"object":"TrackingLocation","state":null,"zip":null}},{"carrier_code":"","datetime":"2024-03-03T10:17:34Z","description":"","message":"Shipping - Label Created","object":"TrackingDetail","source":"USPS","status":"pre_transit","status_detail":"status_update","tracking_location":{"city":"HOUSTON","country":null,"object":"TrackingLocation","state":"TX","zip":"77063"}}],"updated_at":"2024-04-02T21:40:34Z","weight":null},"tracking_code":"EZ1000000001","updated_at":"2024-04-02T21:40:34Z"}' + Package Service"},"created_at":"2024-04-04T16:43:58Z","est_delivery_date":"2024-04-04T16:43:58Z","fees":[],"finalized":true,"id":"trk_84a66fa679d1464a97ac23973925c94f","is_return":false,"mode":"test","object":"Tracker","public_url":"https://track.easypost.com/djE6dHJrXzg0YTY2ZmE2NzlkMTQ2NGE5N2FjMjM5NzM5MjVjOTRm","shipment_id":null,"signed_by":null,"status":"pre_transit","status_detail":"status_update","tracking_code":"EZ1000000001","tracking_details":[{"carrier_code":"","datetime":"2024-03-04T16:43:58Z","description":"","message":"Pre-Shipment + Info Sent to USPS","object":"TrackingDetail","source":"USPS","status":"pre_transit","status_detail":"status_update","tracking_location":{"city":null,"country":null,"object":"TrackingLocation","state":null,"zip":null}},{"carrier_code":"","datetime":"2024-03-05T05:20:58Z","description":"","message":"Shipping + Label Created","object":"TrackingDetail","source":"USPS","status":"pre_transit","status_detail":"status_update","tracking_location":{"city":"HOUSTON","country":null,"object":"TrackingLocation","state":"TX","zip":"77063"}}],"updated_at":"2024-04-04T16:43:58Z","weight":null},"tracking_code":"EZ1000000001","updated_at":"2024-04-04T16:43:58Z"}' headers: Cache-Control: - private, no-cache, no-store @@ -109,8 +109,6 @@ interactions: - strict-origin-when-cross-origin Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload - Vary: - - Origin X-Backend: - easypost X-Content-Type-Options: @@ -118,20 +116,20 @@ interactions: X-Download-Options: - noopen X-Ep-Request-Uuid: - - ecfb0090660c7b52e78b23cc002f89f9 + - 57918bbe660ed8cee786a2bc00715831 X-Frame-Options: - SAMEORIGIN X-Node: - - bigweb36nuq + - bigweb33nuq X-Permitted-Cross-Domain-Policies: - none X-Proxied: - - intlb3nuq 39c21b8207 + - intlb4nuq 39c21b8207 - extlb1nuq 60566a9ec2 X-Runtime: - - "0.095162" + - "0.087370" X-Version-Label: - - easypost-202404022034-93dc413b70-master + - easypost-202404041612-01938f7c7e-master X-Xss-Protection: - 1; mode=block status: 200 OK