diff --git a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateRefund.json b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateRefund.json new file mode 100644 index 000000000000..e8c9ea78c131 --- /dev/null +++ b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateRefund.json @@ -0,0 +1,69 @@ +{ + "parameters": { + "api-version": "2022-03-01", + "body": { + "id": "/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004", + "properties": { + "scope": "Reservation", + "reservationToReturn": { + "reservationId": "/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000", + "quantity": 1 + } + } + } + }, + "responses": { + "200": { + "body": { + "id": "/providers/Microsoft.Capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000", + "properties": { + "sessionId": "10000000-aaaa-bbbb-cccc-200000000000", + "quantity": 1, + "billingRefundAmount": { + "currencyCode": "GBP", + "amount": 20.72 + }, + "pricingRefundAmount": { + "currencyCode": "USD", + "amount": 24.92 + }, + "policyResult": { + "properties": { + "consumedRefundsTotal": { + "currencyCode": "USD", + "amount": 83.69 + }, + "maxRefundLimit": { + "currencyCode": "USD", + "amount": 50000.0 + }, + "policyErrors": [ + { + "code": "SelfServiceRefundNotSupported", + "message": "Self Service refunds are currently not supported for this resource, please contact support." + } + ] + } + }, + "billingInformation": { + "billingPlan": "Upfront", + "completedTransactions": 1, + "totalTransactions": 1, + "billingCurrencyTotalPaidAmount": { + "currencyCode": "GBP", + "amount": 24.0 + }, + "billingCurrencyProratedAmount": { + "currencyCode": "GBP", + "amount": 3.28 + }, + "billingCurrencyRemainingCommitmentAmount": { + "currencyCode": "GBP", + "amount": 0.0 + } + } + } + } + } + } +} diff --git a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json new file mode 100644 index 000000000000..13cfc3f17dad --- /dev/null +++ b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json @@ -0,0 +1,65 @@ +{ + "parameters": { + "api-version": "2022-03-01", + "body": { + "properties": { + "sessionId": "10000000-aaaa-bbbb-cccc-200000000000", + "scope": "Reservation", + "reservationToReturn": { + "reservationId": "/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000", + "quantity": 1 + }, + "returnReason": "PurchasedWrongProduct" + } + } + }, + "responses": { + "202": { + "body": { + "id": "/providers/Microsoft.Capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000", + "properties": { + "sessionId": "10000000-aaaa-bbbb-cccc-200000000000", + "quantity": 1, + "billingRefundAmount": { + "currencyCode": "GBP", + "amount": 20.52 + }, + "pricingRefundAmount": { + "currencyCode": "USD", + "amount": 24.68 + }, + "policyResult": { + "properties": { + "consumedRefundsTotal": { + "currencyCode": "USD", + "amount": 83.69 + }, + "maxRefundLimit": { + "currencyCode": "USD", + "amount": 50000.0 + }, + "policyErrors": [] + } + }, + "billingInformation": { + "billingPlan": "Upfront", + "completedTransactions": 1, + "totalTransactions": 1, + "billingCurrencyTotalPaidAmount": { + "currencyCode": "GBP", + "amount": 24.0 + }, + "billingCurrencyProratedAmount": { + "currencyCode": "GBP", + "amount": 3.48 + }, + "billingCurrencyRemainingCommitmentAmount": { + "currencyCode": "GBP", + "amount": 0.0 + } + } + } + } + } + } +} diff --git a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/reservations.json b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/reservations.json index 4016ca4df335..32dc9a0fd6a2 100644 --- a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/reservations.json +++ b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/reservations.json @@ -652,6 +652,85 @@ } } }, + "/providers/Microsoft.Capacity/calculateRefund": { + "post": { + "summary": "Calculate the refund amount of a reservation order.", + "description": "Calculate price for returning `Reservations` if there are no policy errors.\n", + "operationId": "CalculateRefund_Post", + "x-ms-examples": { + "Purchase": { + "$ref": "./examples/CalculateRefund.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/CalculateRefundRequestParameter" + } + ], + "tags": [ + "CalculateRefund" + ], + "responses": { + "200": { + "description": "Detailed refund info of a reservation", + "schema": { + "$ref": "#/definitions/CalculateRefundResponse" + } + }, + "default": { + "description": "Unexpected error", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, + "/providers/Microsoft.Capacity/return": { + "post": { + "summary": "Return a reservation.", + "description": "Return a reservation.", + "operationId": "Return_Post", + "x-ms-examples": { + "Purchase": { + "$ref": "./examples/Return.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RefundRequestParameter" + } + ], + "tags": [ + "Return" + ], + "responses": { + "202": { + "description": "Detailed refund info of a reservation", + "headers": { + "Location": { + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/RefundResponse" + } + }, + "default": { + "description": "Unexpected error", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, "/providers/Microsoft.Capacity/calculateExchange": { "post": { "summary": "Calculates the refund amounts and price of the new purchases.", @@ -945,7 +1024,9 @@ "FulfillmentTransientError", "FulfillmentError", "CalculatePriceFailed", - "AppliedScopesSameAsExisting" + "AppliedScopesSameAsExisting", + "SelfServiceRefundNotSupported", + "RefundLimitExceeded" ], "x-ms-enum": { "name": "ErrorResponseCode", @@ -1066,6 +1147,58 @@ } } }, + "CalculateRefundRequest": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Fully qualified identifier of the reservation order being returned" + }, + "properties": { + "$ref": "#/definitions/CalculateRefundRequestProperties" + } + } + }, + "RefundRequest": { + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/RefundRequestProperties" + } + } + }, + "CalculateRefundRequestProperties": { + "type": "object", + "properties": { + "scope": { + "type": "string", + "description": "The scope of the refund, e.g. Reservation" + }, + "reservationToReturn": { + "$ref": "#/definitions/ReservationToReturn" + } + } + }, + "RefundRequestProperties": { + "type": "object", + "properties": { + "sessionId": { + "type": "string", + "description": "SessionId that was returned by CalculateRefund API." + }, + "scope": { + "type": "string", + "description": "The scope of the refund, e.g. Reservation" + }, + "reservationToReturn": { + "$ref": "#/definitions/ReservationToReturn" + }, + "returnReason": { + "type": "string", + "description": "The reason of returning the reservation" + } + } + }, "CalculateExchangeRequest": { "type": "object", "description": "Calculate exchange request", @@ -1168,6 +1301,34 @@ } } }, + "RefundBillingInformation": { + "type": "object", + "description": "billing information", + "properties": { + "billingPlan": { + "$ref": "#/definitions/ReservationBillingPlan" + }, + "completedTransactions": { + "type": "integer", + "format": "int32", + "description": "The number of completed transactions in this reservation's payment" + }, + "totalTransactions": { + "type": "integer", + "format": "int32", + "description": "The number of total transactions in this reservation's payment" + }, + "billingCurrencyTotalPaidAmount": { + "$ref": "#/definitions/Price" + }, + "billingCurrencyProratedAmount": { + "$ref": "#/definitions/Price" + }, + "billingCurrencyRemainingCommitmentAmount": { + "$ref": "#/definitions/Price" + } + } + }, "Catalog": { "type": "object", "properties": { @@ -1732,6 +1893,56 @@ } } }, + "CalculateRefundResponse": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Fully qualified identifier of the reservation being returned" + }, + "properties": { + "$ref": "#/definitions/RefundResponseProperties" + } + } + }, + "RefundResponse": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Fully qualified identifier of the reservation being returned" + }, + "properties": { + "$ref": "#/definitions/RefundResponseProperties" + } + } + }, + "RefundResponseProperties": { + "type": "object", + "properties": { + "sessionId": { + "type": "string", + "description": "Refund session identifier" + }, + "quantity": { + "type": "integer", + "format": "int32", + "description": "Quantity to be returned" + }, + "billingRefundAmount": { + "$ref": "#/definitions/Price" + }, + "pricingRefundAmount": { + "$ref": "#/definitions/Price" + }, + "policyResult": { + "$ref": "#/definitions/RefundPolicyResult" + }, + "billingInformation": { + "$ref": "#/definitions/RefundBillingInformation" + } + } + }, "CalculateExchangeOperationResultResponse": { "type": "object", "description": "CalculateExchange operation result", @@ -1887,6 +2098,47 @@ } } }, + "RefundPolicyResult": { + "type": "object", + "description": "Refund policy result", + "properties": { + "properties": { + "$ref": "#/definitions/RefundPolicyResultProperty" + } + } + }, + "RefundPolicyResultProperty": { + "type": "object", + "description": "Refund policy result property", + "properties": { + "consumedRefundsTotal": { + "$ref": "#/definitions/Price" + }, + "maxRefundLimit": { + "$ref": "#/definitions/Price" + }, + "policyErrors": { + "type": "array", + "description": "Refund Policy errors", + "items": { + "$ref": "#/definitions/RefundPolicyError" + }, + "x-ms-identifiers": [] + } + } + }, + "RefundPolicyError": { + "type": "object", + "description": "error details", + "properties": { + "code": { + "$ref": "#/definitions/ErrorResponseCode" + }, + "message": { + "type": "string" + } + } + }, "ExchangePolicyErrors": { "type": "object", "description": "Exchange policy errors", @@ -2732,6 +2984,16 @@ } }, "parameters": { + "CalculateRefundRequestParameter": { + "name": "body", + "x-ms-parameter-location": "method", + "in": "body", + "required": true, + "description": "Information needed for calculating refund of a reservation.", + "schema": { + "$ref": "#/definitions/CalculateRefundRequest" + } + }, "CalculateExchangeRequestParameter": { "name": "body", "x-ms-parameter-location": "method", @@ -2742,6 +3004,16 @@ "$ref": "#/definitions/CalculateExchangeRequest" } }, + "RefundRequestParameter": { + "name": "body", + "x-ms-parameter-location": "method", + "in": "body", + "required": true, + "description": "Information needed for returning reservation.", + "schema": { + "$ref": "#/definitions/RefundRequest" + } + }, "ExchangeRequestParameter": { "name": "body", "x-ms-parameter-location": "method", diff --git a/specification/reservations/resource-manager/readme.python.md b/specification/reservations/resource-manager/readme.python.md index 825e203b1e90..a97c05c0fcf5 100644 --- a/specification/reservations/resource-manager/readme.python.md +++ b/specification/reservations/resource-manager/readme.python.md @@ -1,3 +1,5 @@ + + ## Python These settings apply only when `--python` is specified on the command line.