Skip to content

feat(themes): Create user APIs for managing themes#8387

Merged
likhinbopanna merged 30 commits intomainfrom
theme-user-apis
Jul 28, 2025
Merged

feat(themes): Create user APIs for managing themes#8387
likhinbopanna merged 30 commits intomainfrom
theme-user-apis

Conversation

@kanikabansal08
Copy link
Contributor

@kanikabansal08 kanikabansal08 commented Jun 19, 2025

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR adds user APIs to manage themes. Earlier themes was being managed using Admin apis.
These are the following APIs

  1. Create Theme
  2. Delete Theme
  3. Update Theme
  4. Upload Asset
  5. Find Theme by Theme ID
  6. List themes by entity level
  7. Get Theme by lineage
  • Added Theme resource and ThemeManage permission group
  • Assigned ThemeManage permission to OrganizationAdmin role

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

  1. Create theme
curl --location 'http://localhost:8080/user/theme' \
--header 'Content-Type: application/json' \
--header 'cookie: login_token=••••••' \
--header 'Authorization: ••••••' \
--data '{
    "entity_type": "merchant",
    "theme_name": "Test_integ",
    "theme_data": {
        "settings": {
            "colors": {
                "primary": "#3498db",
                "sidebar": "#2ecc71"
            },
            "buttons": {
                "primary": {
                    "hoverBackgroundColor": "#27ae60"
                }
            }
        }
    }
}'
  1. Get theme by theme ID
curl --location --request GET 'http://localhost:8080/user/theme/9e144c3e-a68c-4653-b180-5771380df699' \
--header 'cookie: login_token=••••••' \
--header 'Authorization: ••••••' 
  1. Update theme
curl --location --request PUT 'http://localhost:8080/user/theme/9e144c3e-a68c-4653-b180-5771380df699' \
--header 'cookie: login_token=••••••' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••'  \
--data '{
    "theme_data": {
        "settings": {
            "colors": {
                "primary": "#ffffff",
                "sidebar": "#2ecc71"
            },
            "buttons": {
                "primary": {
                    "hoverBackgroundColor": "#27ae60"
                }
            }
        }
    },
    "email_config": {
        "entity_name": "Merchant123",
        "entity_logo_url": "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png",
        "primary_color": "#006DF9",
        "foreground_color": "#111326",
        "background_color": "#FFFFFF"
    }
}'
  1. Upload Asset
curl --location 'http://localhost:8080/user/theme/9e144c3e-a68c-4653-b180-5771380df699' \
--header 'cookie: login_token=••••••' \
--header 'Authorization: ••••••'  \
--form 'asset_name="logo.png"' \
--form 'asset_data=@"/Users/kanika.bansal/Desktop/zurichLogo.png"'
  1. Delete Theme
curl --location --request DELETE 'http://localhost:8080/user/theme/9e144c3e-a68c-4653-b180-5771380df699' \
--header 'cookie: login_token=••••••' \
--header 'Authorization: ••••••'  
  1. List themes by entity level
curl --location 'http://localhost:8080/user/theme/list?entity_type=organization' \
--header 'cookie: login_token=••••••' \
--header 'Authorization: ••••••'  
  1. Get theme by lineage
curl --location 'http://localhost:8080/user/theme?entity_type=merchant' \
--header 'cookie: login_token=••••••' \
--header 'Authorization: ••••••'  

Response

  • Delete Theme and Upload Asset: 200 OK
  • list themes by entity level

[
        {
            "theme_id": "2bab0cbb-491b-420e-aa82-cdd02e1a890d",
            "theme_name": "Test_org",
            "entity_type": "organization",
            "tenant_id": "public",
            "org_id": "o1",
            "merchant_id": null,
            "profile_id": null,
            "email_config": {
                "entity_name": "Hyperswitch",
                "entity_logo_url": "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png",
                "primary_color": "#006DF9",
                "foreground_color": "#111326",
                "background_color": "#FFFFFF"
            },
            "theme_data": {
                "settings": {
                    "colors": {
                        "primary": "#3498db",
                        "secondary": null,
                        "background": null
                    },
                    "sidebar": null,
                    "typography": null,
                    "buttons": {
                        "primary": {
                            "backgroundColor": null,
                            "textColor": null,
                            "hoverBackgroundColor": "#27ae60"
                        },
                        "secondary": null
                    },
                    "borders": null,
                    "spacing": null
                },
                "urls": null
            }
        },
        {
            "theme_id": "8ffbed01-5b65-4f7f-8323-bcb0689a2e3c",
            "theme_name": "Test_o1_m2_profile",
            "entity_type": "profile",
            "tenant_id": "public",
            "org_id": "o1",
            "merchant_id": "m1",
            "profile_id": "p1",
            "email_config": {
                "entity_name": "Hyperswitch",
                "entity_logo_url": "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png",
                "primary_color": "#006DF9",
                "foreground_color": "#111326",
                "background_color": "#FFFFFF"
            },
            "theme_data": {
                "settings": {
                    "colors": {
                        "primary": "#3498db",
                        "secondary": null,
                        "background": null
                    },
                    "sidebar": null,
                    "typography": null,
                    "buttons": {
                        "primary": {
                            "backgroundColor": null,
                            "textColor": null,
                            "hoverBackgroundColor": "#27ae60"
                        },
                        "secondary": null
                    },
                    "borders": null,
                    "spacing": null
                },
                "urls": null
            }
        },
        {
            "theme_id": "9b0186c1-7ae2-412c-b91f-a5439cae5839",
            "theme_name": "Test_o1_merchant",
            "entity_type": "merchant",
            "tenant_id": "public",
            "org_id": "o1",
            "merchant_id": "m1",
            "profile_id": null,
            "email_config": {
                "entity_name": "Hyperswitch",
                "entity_logo_url": "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png",
                "primary_color": "#006DF9",
                "foreground_color": "#111326",
                "background_color": "#FFFFFF"
            },
            "theme_data": {
                "settings": {
                    "colors": {
                        "primary": "#3498db",
                        "secondary": null,
                        "background": null
                    },
                    "sidebar": null,
                    "typography": null,
                    "buttons": {
                        "primary": {
                            "backgroundColor": null,
                            "textColor": null,
                            "hoverBackgroundColor": "#27ae60"
                        },
                        "secondary": null
                    },
                    "borders": null,
                    "spacing": null
                },
                "urls": null
            }
        },
        {
            "theme_id": "929dcbb1-9dbf-4062-8b32-80683e6a8418",
            "theme_name": "Test_o1_m1_profile",
            "entity_type": "profile",
            "tenant_id": "public",
            "org_id": "o1",
            "merchant_id": "m1",
            "profile_id": "p2",
            "email_config": {
                "entity_name": "Hyperswitch",
                "entity_logo_url": "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png",
                "primary_color": "#006DF9",
                "foreground_color": "#111326",
                "background_color": "#FFFFFF"
            },
            "theme_data": {
                "settings": {
                    "colors": {
                        "primary": "#3498db",
                        "secondary": null,
                        "background": null
                    },
                    "sidebar": null,
                    "typography": null,
                    "buttons": {
                        "primary": {
                            "backgroundColor": null,
                            "textColor": null,
                            "hoverBackgroundColor": "#27ae60"
                        },
                        "secondary": null
                    },
                    "borders": null,
                    "spacing": null
                },
                "urls": null
            }
        }
    ]

  • Everything else
{
    "theme_id": "9e144c3e-a68c-4653-b180-5771380df699",
    "theme_name": "Test_Integ",
    "entity_type": "merchant",
    "tenant_id": "t1",
    "org_id": "o1",
    "merchant_id": "m1",
    "profile_id": null,
    "email_config": {
        "entity_name": "Hyperswitch",
        "entity_logo_url": "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png",
        "primary_color": "#006DF9",
        "foreground_color": "#111326",
        "background_color": "#FFFFFF"
    },
    "theme_data": {
        "settings": {
            "colors": {
                "primary": "#3498db",
                "secondary": null,
                "background": null
            },
            "sidebar": null,
            "typography": null,
            "buttons": {
                "primary": {
                    "backgroundColor": null,
                    "textColor": null,
                    "hoverBackgroundColor": "#27ae60"
                },
                "secondary": null
            },
            "borders": null,
            "spacing": null
        },
        "urls": null
    }
}

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@kanikabansal08 kanikabansal08 self-assigned this Jun 19, 2025
@kanikabansal08 kanikabansal08 added the S-in-progress Status: Implementation is underway label Jun 19, 2025
@kanikabansal08 kanikabansal08 requested review from a team as code owners June 19, 2025 08:00
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jun 19, 2025

@kanikabansal08 kanikabansal08 added C-feature Category: Feature request or enhancement and removed S-in-progress Status: Implementation is underway labels Jun 19, 2025
@kanikabansal08 kanikabansal08 linked an issue Jun 20, 2025 that may be closed by this pull request
2 tasks
@kanikabansal08 kanikabansal08 requested a review from a team as a code owner June 29, 2025 10:37
ThisIsMani
ThisIsMani previously approved these changes Jul 9, 2025
@tsdk02
Copy link
Contributor

tsdk02 commented Jul 11, 2025

Analytics changes LGTM

tsdk02
tsdk02 previously approved these changes Jul 11, 2025
@su-shivanshmathur su-shivanshmathur requested a review from a team July 16, 2025 09:32
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 28, 2025
Merged via the queue into main with commit 20049d5 Jul 28, 2025
15 of 20 checks passed
@likhinbopanna likhinbopanna deleted the theme-user-apis branch July 28, 2025 07:46
pixincreate added a commit that referenced this pull request Jul 28, 2025
…rver

* 'main' of github.com:juspay/hyperswitch: (24 commits)
  chore(version): 2025.07.28.1
  feat(core): Hyperswitch <|> UCS Mandate flow integration (#8738)
  feat(themes): Create user APIs for managing themes (#8387)
  chore: update devDependencies for cypress (#8735)
  refactor: Add routing_approach other variant to handle unknown data (#8754)
  chore(version): 2025.07.28.0
  refactor(connector): [facilitapay] move destination bank account number to connector metadata (#8704)
  feat(recovery-events): add revenue recovery topic and vector config to push these events to s3 (#8285)
  ci(cypress): add authorizedotnet connector (#8688)
  refactor(schema): add a new column for storing large customer user agents in mandate table (#8616)
  feat(authentication): add authentication api for modular authentication (#8459)
  feat(connector): [MPGS] template code (#8544)
  fix(chat): append request id to headers for chat request (#8680)
  feat(connector): [Flexiti]template code for flexiti connector (#8714)
  chore(version): 2025.07.25.0
  feat(core): Consuming locale in PaymentsAuthorizeData from SessionState (#8731)
  fix(payment-methods): fetch payment method details in payouts flow (#8729)
  refactor(core): remove hardcoded timeout limit of 5s for outgoing webhook requests (#8725)
  feat(connector): [Breadpay]Add support for Breadpay connector (#8676)
  fix(feature_matrix): refunds are supported by jpmorgan (#8699)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-feature Category: Feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Themes via Dashboard BE

5 participants