From c069a8ae8843a1512cbe212d4f9d7daf0748f2e8 Mon Sep 17 00:00:00 2001 From: "Srivastava, Ayushee" Date: Thu, 13 Apr 2023 12:03:03 -0500 Subject: [PATCH] Pull request #29: added donate feature toggle changes Merge in PPCT/carbon-tracker-reference-app from feature/S3035231-DonateFeature_toggle_update to master Squashed commit of the following: commit 8922e467cf97a1c22bb8b678af28df9b90ad8ae8 Author: Srivastava, Ayushee Date: Mon Jan 23 15:49:26 2023 +0530 S3035231:feat added donate feature toggle changes commit c64d958e83f223c12762eabb394ce654fec48102 Author: Srivastava, Ayushee Date: Thu Jan 19 16:24:53 2023 +0530 S3035231:feat added donate feature toggle changes --- README.md | 3 +++ src/main/resources/carbon-tracker.yaml | 36 +++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 28a984f..9fd4b18 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,8 @@ Use this endpoint to display the current months' carbon score, to provide a snap 3. **Enroll User**
endpoint "/issuers/users"
Use this endpoint to enrol their customers onto Carbon Calculator Experience platform. +Donate feature toggle, which allows the issuer to disable the donate feature during onboarding. +If the issuer has opted for the Donation feature then the fields - *name, billing address, email, locale, cardholder name, card number, card base currency and card expiry date* fields are **mandatory** in the payload. 4. **Get Issuer**
endpoint "/issuers"
@@ -118,6 +120,7 @@ Use this endpoint to delete user registered to Carbon Calculator Experience plat 6. **Update Issuer**
endpoint "/issuers"
Use this endpoint to update issuer details onboarded to Carbon Calculator Experience Platform. +This endpoint is not supported when the Donate feature for your bank is disabled. More details can be found [here](https://stage.developer.mastercard.com/drafts/priceless-planet-carbon-tracker/staging/documentation/use-cases/). diff --git a/src/main/resources/carbon-tracker.yaml b/src/main/resources/carbon-tracker.yaml index b1a7b50..5dcc408 100644 --- a/src/main/resources/carbon-tracker.yaml +++ b/src/main/resources/carbon-tracker.yaml @@ -89,6 +89,10 @@ paths: Used to enroll users for the Carbon Calculator Experience API so that they can track the carbon usage for their transactions and and provides them with an option to donate towards tree plantations. + + + **Note-** + If the issuer has opted for the Donation feature then the fields - *name, billing address, email, locale, cardholder name, card number, card base currency and card expiry date* fields are **mandatory** in the payload. operationId: userRegistration x-mastercard-api-encrypted: true requestBody: @@ -123,7 +127,7 @@ paths: "400": $ref: '#/components/responses/UserEnrolmentBadRequestError' "401": - $ref: '#/components/responses/UserEnrolmentUnauthorisedError' + $ref: '#/components/responses/UpdateUserUnauthorisedError' "404": $ref: '#/components/responses/IssuerNotFoundError' "415": @@ -336,10 +340,7 @@ components: Experience API. required: - cardNumber - - billingAddress - email - - locale - - name - expiryInfo - cardBaseCurrency - cardholderName @@ -963,6 +964,21 @@ components: $ref: '#/components/examples/IssuerSuspendedError' IssuerTerminatedError: $ref: '#/components/examples/IssuerTerminatedError' + UpdateUserUnauthorisedError: + description: This response code is returned for unauthorized Issuer and User. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorWrapper' + examples: + IssuerInactiveError: + $ref: '#/components/examples/IssuerInactiveError' + IssuerSuspendedError: + $ref: '#/components/examples/IssuerSuspendedError' + IssuerTerminatedError: + $ref: '#/components/examples/IssuerTerminatedError' + UpdateUserNotAccessible: + $ref: '#/components/examples/UpdateUserNotAccessible' AggregateCarbonScoreNotFoundError: description: This response code is returned when a user or Issuer is not present. content: @@ -1007,6 +1023,7 @@ components: examples: InvalidUserIdError: $ref: '#/components/examples/InvalidUserIdError' + AggregateCarbonScoreBadRequestError: description: >- This response code is returned when a request is invalid or data in the @@ -1138,6 +1155,17 @@ components: request. Recoverable: false Details: 'Email must be in the format: xyz@mail.com' + UpdateUserNotAccessible: + value: + Errors: + Error: + - Source: CARBON CALCULATOR EXPERIENCE + ReasonCode: UPDATE_USER_NOT_ACCESSIBLE + Description: >- + You do not have permission to access this API. The Donate feature for your bank is disabled. + Recoverable: false + Details: >- + You do not have permission to access this API. The Donate feature for your bank is disabled. IssuerEmptyRequestBodyError: value: Errors: