{"id":28577548,"url":"https://github.com/mastercard/carbon-calculator-experience-reference-app","last_synced_at":"2025-07-29T00:33:07.193Z","repository":{"id":39927448,"uuid":"434238389","full_name":"Mastercard/carbon-calculator-experience-reference-app","owner":"Mastercard","description":"Reference application for Carbon Calculator Experience APIs","archived":false,"fork":false,"pushed_at":"2024-12-05T11:25:45.000Z","size":158,"stargazers_count":5,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-11T00:48:52.285Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mastercard.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-12-02T13:49:14.000Z","updated_at":"2024-12-05T11:25:49.000Z","dependencies_parsed_at":"2024-03-20T15:43:00.435Z","dependency_job_id":"f6016350-df77-4d41-8823-f054283cf887","html_url":"https://github.com/Mastercard/carbon-calculator-experience-reference-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mastercard/carbon-calculator-experience-reference-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fcarbon-calculator-experience-reference-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fcarbon-calculator-experience-reference-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fcarbon-calculator-experience-reference-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fcarbon-calculator-experience-reference-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mastercard","download_url":"https://codeload.github.com/Mastercard/carbon-calculator-experience-reference-app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fcarbon-calculator-experience-reference-app/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267610345,"owners_count":24115434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-11T00:38:12.901Z","updated_at":"2025-07-29T00:33:07.167Z","avatar_url":"https://github.com/Mastercard.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Carbon Calculator Experience Reference App\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_carbon-calculator-experience-reference-app\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=Mastercard_carbon-calculator-experience-reference-app)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_carbon-calculator-experience-reference-app\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=Mastercard_carbon-calculator-experience-reference-app)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_carbon-calculator-experience-reference-app\u0026metric=code_smells)](https://sonarcloud.io/dashboard?id=Mastercard_carbon-calculator-experience-reference-app)\n[![](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/Mastercard/carbon-calculator-experience-reference-app/blob/master/LICENSE)\n\n\n## Table of Contents\n- [Overview](#overview)\n- [Requirements](#requirements)\n- [Frameworks/Libraries](#frameworks)\n- [Integrating with OpenAPI Generator](#OpenAPI_Generator)\n- [Configuration](#configuration)\n- [Use-Cases](#use-cases)\n- [Execute the Use-Cases](#execute-the-use-cases)\n- [Service Documentation](#documentation)\n- [API Reference](#api-reference)\n- [Support](#support)\n- [License](#license)\n\n## Overview  \u003ca name=\"overview\"\u003e\u003c/a\u003e\n\nThis is a reference application to demonstrate how Carbon Calculator Experience APIs can be used.\nTo call these APIs, consumer key and .p12 file are required from your project on Mastercard Developers.\n\n## Requirements  \u003ca name=\"requirements\"\u003e\u003c/a\u003e\n\n- Java 17\n- IntelliJ IDEA (or any other IDE)\n\n## Frameworks/Libraries \u003ca name=\"frameworks\"\u003e\u003c/a\u003e\n- Spring Boot\n- Apache Maven\n- OpenAPI Generator\n\n## Integrating with OpenAPI Generator \u003ca name=\"OpenAPI_Generator\"\u003e\u003c/a\u003e\n\nOpenAPI Generator generates API client libraries from OpenAPI Specs. It provides generators and library templates for supporting multiple languages and frameworks.\nCheck [Generating and Configuring a Mastercard API Client](https://developer.mastercard.com/platform/documentation/security-and-authentication/generating-and-configuring-a-mastercard-api-client/) to know more about how to generate a simple API client for consuming APIs.\n\n\n### Configuring Payload Encryption\nThe [Mastercard Encryption Library](https://github.com/Mastercard/client-encryption-java) provides interceptor class that you can use when configuring your API client. This [interceptor](https://github.com/Mastercard/client-encryption-java#usage-of-the-okhttpfieldlevelencryptioninterceptor-openapi-generator-4xy) will encrypt payload before sending the request.\n\n**Encryption Config**\n```\nFieldLevelEncryptionConfig config = FieldLevelEncryptionConfigBuilder\n                    .aFieldLevelEncryptionConfig()\n                    .withEncryptionCertificate(cert)\n                    .withEncryptionPath(\"$\", \"$\")\n                    .withEncryptedValueFieldName(\"encryptedData\")\n                    .withEncryptedKeyFieldName(\"encryptedKey\")\n                    .withOaepPaddingDigestAlgorithmFieldName(\"oaepHashingAlgorithm\")\n                    .withOaepPaddingDigestAlgorithm(\"SHA-256\")\n                    .withEncryptionKeyFingerprintFieldName(\"publicKeyFingerprint\")\n                    .withIvFieldName(\"iv\")\n                    .withFieldValueEncoding(FieldLevelEncryptionConfig.FieldValueEncoding.HEX)\n                    .build();\n```\n\n### Configuring Response Decryption\nThe [Mastercard Encryption Library](https://github.com/Mastercard/client-encryption-java) provides interceptor class that you can use when configuring your API client. This [interceptor](https://github.com/Mastercard/client-encryption-java#decrypting-entire-mastercard-payloads) will decrypt payload received in response.\n\n**Decryption Config**\n```\nFieldLevelEncryptionConfig config = FieldLevelEncryptionConfigBuilder.aFieldLevelEncryptionConfig()\n                    .withDecryptionKey(\u003c\u003cmc.p12\u003e\u003e)\n                    .withDecryptionPath(\"$\", \"$\")\n                    .withOaepPaddingDigestAlgorithm(\"SHA-256\")\n                    .withEncryptedValueFieldName(\"encryptedValue\")\n                    .withEncryptedKeyFieldName(\"encryptedKey\")\n                    .withIvFieldName(\"iv\")\n                    .withFieldValueEncoding(FieldValueEncoding.HEX)\n                    .build();\n```\n\nSee also:\n- [Securing Sensitive Data Using Payload Encryption](https://developer.mastercard.com/platform/documentation/security-and-authentication/securing-sensitive-data-using-payload-encryption/).\n\n## Configuration \u003ca name=\"configuration\"\u003e\u003c/a\u003e\n1. Create your account on [Mastercard Developers](https://developer.mastercard.com/) if you don't have it already.\n2. Create a new project here and add ***Carbon Calculator Experience*** to it and click continue.\n3. Download Sandbox Signing Key, a ```.p12``` file will be downloaded. Use this file for payload encryption.\n4. Download mastercard Signing Key, a ```mc.p12``` file will be downloaded. Use this file for payload decryption.\n5. In the Client Encryption Keys section of the dashboard, click on the ```Actions``` dropdown and download the client encryption key, a ``.pem`` file will be downloaded.\n6. Copy the downloaded ```.p12``` , ```mc.p12``` and ```.pem``` files to ```src/main/resources``` folder in your code.\n7. Open ```src/main/resources/application.yml``` and configure:\n    - ```mastercard.api.environment.basepath ```- Path to sandbox endpoint,for example for Sandbox https://sandbox.api.mastercard.com/cts\n    - ```mastercard.api.environment.key-file ```- Path to keystore (.p12) file, just change the name as per the downloaded file in step 5.\n    - ```mastercard.api.authentication.consumer-key``` - Copy the Consumer key from \"Sandbox/Production Keys\" section on your project page\n    - ```mastercard.api.authentication.keystore-alias``` - Alias of your key. Default key alias for sandbox is ```keyalias```.\n    - ```mastercard.api.authentication.keystore-password``` -  Password of your Keystore. Default keystore password for sandbox project is ```keystorepassword```.\n    - ```mastercard.api.encryption.key-file ```- Path to encryption key (.pem) file, just change the name as per the downloaded file in step 5.\n      ```mastercard.api.encryption.fingerprint ```- Fingerprint, copy the fingerprint from Client Encryption Keys section. If you have multiple client encryption keys then copy the fingerprint of the key which you want to use.\n\n## Use-Cases \u003ca name=\"use-cases\"\u003e\u003c/a\u003e\n1. **Get Webview URL** \u003cbr/\u003e\n   endpoint \"/issuers/users/{userid}/dashboards\"   \n   Use this endpoint to get a new token with expiry specified. Language code \"lang=en-US\" can be passed as query parameter (Not mandatory). Supported lang \"en-US,es-419,sv,es-CL,es-CR,pl-PL,ms-MY\". Default is \"en-US\".\n\n2. **Get Current Months Carbon Score** \u003cbr/\u003e\n   endpoint \"/issuers/users/{userid}/aggregate-carbon-scores\"\u003cbr/\u003e\n   Use this endpoint to display the current months' carbon score, to provide a snapshot of their score prior to opening the dashboard.\n\n3. **Enroll User** \u003cbr/\u003e\n   endpoint \"/issuers/users\" \u003cbr/\u003e\n   Use this endpoint to enrol their customers onto Carbon Calculator Experience platform.\n   Donate feature toggle, which allows the issuer to disable the donate feature during onboarding.\n   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.\n\n4. **Get Issuer** \u003cbr/\u003e\n   endpoint \"/issuers\" \u003cbr/\u003e\n   Use this endpoint to fetch issuer details onboarded to Carbon Calculator Experience platform.\n\n5. **Delete User** \u003cbr/\u003e\n   endpoint \"/issuers/user-deletions\" \u003c/br\u003e\n   Use this endpoint to delete user registered to Carbon Calculator Experience platform.\n\n6. **Update Issuer** \u003cbr/\u003e\n   endpoint \"/issuers\"\u003cbr/\u003e\n   Use this endpoint to update issuer details onboarded to Carbon Calculator Experience Platform.\n   This endpoint is not supported when the Donate feature for your bank is disabled.\n\nMore details can be found [here](https://developer.mastercard.com/priceless-planet-carbon-tracker/documentation/use-cases/).\n\n\n## Execute the Use-Cases   \u003ca name=\"execute-the-use-cases\"\u003e\u003c/a\u003e\n1. Run ```mvn clean install``` from the root of the project directory.\n2. There are two ways to execute the use-cases:\n    1. Execute the use-cases(test cases):\n        - Run ```mvn clean install``` from the root of the project directory.\n        - When the project builds successfully, you can run the following command to start the project:\n          java -jar target/carbon-tracker-0.0.1-SNAPSHOT.jar\n        - Above command will start the application and execute all the use cases mentioned in readme file\n\n    2. Use REST API based Client( such as [Insomnia](https://insomnia.rest/download/core/) or [Postman](https://www.postman.com/downloads/))\n        - Run ```mvn spring-boot:run``` command to run the application.\n        - Use any REST API based Client to test the functionality. Below are the APIs exposed by this application ,use locahost:8080 as the Host:\u003cbr/\u003e\n          - GET {HOST}/cts/issuers/users/{userid}/dashboards \u003cbr/\u003e\n          - GET {HOST}/cts/issuers/users/{userid}/aggregate-carbon-scores \u003cbr/\u003e\n          - GET {HOST}/cts/issuers \u003cbr/\u003e\n          - POST {HOST}/cts/issuers/users \u003cbr/\u003e\n          - PUT  {HOST}/cts/issuers \u003cbr/\u003e\n          - POST  {HOST}/cts/issuers/user-deletions \u003cbr/\u003e\n\n\n## Service Documentation \u003ca name=\"documentation\"\u003e\u003c/a\u003e\n\nCarbon Calculator Experience documentation can be found [here](https://developer.mastercard.com/priceless-planet-carbon-tracker/documentation/use-cases/).\n\n\n## API Reference \u003ca name=\"api-reference\"\u003e\u003c/a\u003e\nThe Swagger API specification can be found [here](https://developer.mastercard.com/priceless-planet-carbon-tracker/documentation/api-reference/).\n\n## Support \u003ca name=\"support\"\u003e\u003c/a\u003e\nPlease send an email to **apisupport@mastercard.com** with any questions or feedback you may have.\n\n\n## License \u003ca name=\"license\"\u003e\u003c/a\u003e\n\u003cp\u003eCopyright 2021 Mastercard\u003c/p\u003e\n\u003cp\u003eLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with\nthe License. You may obtain a copy of the License at:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e   http://www.apache.org/licenses/LICENSE-2.0\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on\nan \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the\nspecific language governing permissions and limitations under the License.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastercard%2Fcarbon-calculator-experience-reference-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastercard%2Fcarbon-calculator-experience-reference-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastercard%2Fcarbon-calculator-experience-reference-app/lists"}