From 8d89fdb323d155a67d17b60e500adbdb4f0302f4 Mon Sep 17 00:00:00 2001 From: Deep Chakraborty Date: Tue, 14 Sep 2021 13:40:09 -0700 Subject: [PATCH] merge ValidateDetachPaymentMethod API into detach API --- .../PaymentMethodAtBillingProfile_Remove.json | 31 ++++++++++++- ...DetachPaymentMethodEligibilityFailure.json | 36 --------------- ...DetachPaymentMethodEligibilitySuccess.json | 14 ------ .../stable/2021-10-01/payment.json | 46 ++----------------- 4 files changed, 34 insertions(+), 93 deletions(-) delete mode 100644 specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/ValidateDetachPaymentMethodEligibilityFailure.json delete mode 100644 specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/ValidateDetachPaymentMethodEligibilitySuccess.json diff --git a/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/PaymentMethodAtBillingProfile_Remove.json b/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/PaymentMethodAtBillingProfile_Remove.json index d9ab29d3f71a..a924605201bc 100644 --- a/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/PaymentMethodAtBillingProfile_Remove.json +++ b/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/PaymentMethodAtBillingProfile_Remove.json @@ -8,11 +8,38 @@ "responses": { "202": { "headers": { - "Location": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks/operationResults/ed2975a8-8f77-43bb-a717-ace54326b14b?api-version=2020-11-01-privatepreview", + "Location": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks/operationResults/ed2975a8-8f77-43bb-a717-ace54326b14b?api-version=2021-10-01", "Retry-After": "60" } }, "200": {}, - "204": {} + "204": {}, + "409": { + "body": { + "code": "PaymentMethodNotEligibleForDetach", + "errorDetails": [ + { + "code": "AzureSubscriptions", + "message": "Payment method cannot be detached as there are active or disabled azure subscriptions on this billing profile." + }, + { + "code": "RecurringCharges", + "message": "Payment method cannot be detached as there are recurring charges on this billing profile." + }, + { + "code": "ReservedInstances", + "message": "Payment method cannot be detached as there are reserved instances on this billing profile." + }, + { + "code": "OutstandingCharges", + "message": "Payment method cannot be detached as there are unpaid outstanding charges on this billing profile." + }, + { + "code": "PendingCharges", + "message": "Payment method cannot be detached as there are pending charges accumulating on this billing profile." + } + ] + } + } } } diff --git a/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/ValidateDetachPaymentMethodEligibilityFailure.json b/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/ValidateDetachPaymentMethodEligibilityFailure.json deleted file mode 100644 index a182a9b80fe8..000000000000 --- a/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/ValidateDetachPaymentMethodEligibilityFailure.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "parameters": { - "api-version": "2021-10-01", - "billingAccountName": "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", - "billingProfileName": "ABC1-A1CD-AB1-BP1" - }, - "responses": { - "200": { - "body": { - "isEligible": false, - "errorDetails": [ - { - "code": "AzureSubscriptions", - "message": "Payment method cannot be detached as there are active or disabled azure subscriptions on this billing profile." - }, - { - "code": "RecurringCharges", - "message": "Payment method cannot be detached as there are recurring charges on this billing profile." - }, - { - "code": "ReservedInstances", - "message": "Payment method cannot be detached as there are reserved instances on this billing profile." - }, - { - "code": "OutstandingCharges", - "message": "Payment method cannot be detached as there are unpaid outstanding charges on this billing profile." - }, - { - "code": "PendingCharges", - "message": "Payment method cannot be detached as there are pending charges accumulating on this billing profile." - } - ] - } - } - } -} diff --git a/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/ValidateDetachPaymentMethodEligibilitySuccess.json b/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/ValidateDetachPaymentMethodEligibilitySuccess.json deleted file mode 100644 index f16754a64db1..000000000000 --- a/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/examples/ValidateDetachPaymentMethodEligibilitySuccess.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "parameters": { - "api-version": "2021-10-01", - "billingAccountName": "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", - "billingProfileName": "ABC1-A1CD-AB1-BP1" - }, - "responses": { - "200": { - "body": { - "isEligible": true - } - } - } -} diff --git a/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/payment.json b/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/payment.json index 4159529e3b16..7ca75196a523 100644 --- a/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/payment.json +++ b/specification/billing/resource-manager/Microsoft.Billing/stable/2021-10-01/payment.json @@ -354,44 +354,8 @@ } } }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - } - } - }, - "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/validateDetachPaymentMethodEligibility": { - "post": { - "tags": [ - "BillingProfiles" - ], - "x-ms-examples": { - "ValidateDetachPaymentMethodEligibilitySuccess": { - "$ref": "./examples/ValidateDetachPaymentMethodEligibilitySuccess.json" - }, - "ValidateDetachPaymentMethodEligibilityFailure": { - "$ref": "./examples/ValidateDetachPaymentMethodEligibilityFailure.json" - } - }, - "operationId": "BillingProfiles_GetEligibilityToDetachPaymentMethod", - "description": "Validates if the payment method can be detached from the billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement.", - "parameters": [ - { - "$ref": "#/parameters/billingAccountNameParameter" - }, - { - "$ref": "#/parameters/billingProfileNameParameter" - }, - { - "$ref": "#/parameters/apiVersionParameter" - } - ], - "responses": { - "200": { - "description": "OK. The request has succeeded.", + "409": { + "description": "Conflict. Payment method cannot be detached from billing profile.", "schema": { "$ref": "#/definitions/DetachPaymentMethodEligibilityResult" } @@ -635,9 +599,9 @@ "type": "object", "description": "Result of the detach payment method eligibility.", "properties": { - "isEligible": { - "description": "Specifies whether the payment method is eligible to be detached from the billing profile.", - "type": "boolean", + "code": { + "description": "Error code.", + "type": "string", "readOnly": true }, "errorDetails": {