feat(core): add subscription table#9133
Merged
Gnanasundari24 merged 22 commits intomainfrom Sep 3, 2025
Merged
Conversation
Changed Files
|
jagan-jaya
requested changes
Sep 2, 2025
jagan-jaya
requested changes
Sep 2, 2025
Sarthak1799
reviewed
Sep 2, 2025
jagan-jaya
requested changes
Sep 2, 2025
jagan-jaya
previously approved these changes
Sep 3, 2025
Sarthak1799
requested changes
Sep 3, 2025
jagan-jaya
requested changes
Sep 3, 2025
jagan-jaya
approved these changes
Sep 3, 2025
Sarthak1799
approved these changes
Sep 3, 2025
| status VARCHAR(128) NOT NULL, | ||
| billing_processor VARCHAR(128), | ||
| payment_method_id VARCHAR(128), | ||
| mca_id VARCHAR(128), |
Member
There was a problem hiding this comment.
You should have use merchant_connector_id instead of mca_id, to avoid the abbreviations as much as possible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Additional Changes
Description
Introduce Subscriptions as a first-class entity in the router.
This PR adds a
subscriptiontable, Diesel models, storage interfaces, and query helpers to create, fetch, and update subscription entries keyed by(merchant_id, customer_id, subscription_id).What’s included
Database (PostgreSQL)
subscriptionid VARCHAR(128) PRIMARY KEYsubscription_id VARCHAR(128) NULLbilling_processor VARCHAR(128) NULLpayment_method_id VARCHAR(128) NULLmca_id VARCHAR(128) NULLclient_secret VARCHAR(128) NULLmerchant_id VARCHAR(64) NOT NULLcustomer_id VARCHAR(64) NOT NULLmetadata JSONB NULLcreated_at TIMESTAMP NOT NULLmodified_at TIMESTAMP NOT NULLCREATE UNIQUE INDEX merchant_customer_subscription_unique_index ON subscription (merchant_id, customer_id, subscription_id);Migrations
up.sqlcreates the table + unique indexdown.sqldrops the tableDiesel models & schema
crates/diesel_models/src/schema.rs:subscriptiontable mappingcrates/diesel_models/src/subscription.rs:SubscriptionNew(insert)Subscription(read)SubscriptionUpdate(update:subscription_id,payment_method_id,modified_at)crates/diesel_models/src/query/subscription.rsSubscriptionNew::insertSubscription::find_by_merchant_id_customer_id_subscription_idSubscription::update_subscription_entryRouter storage interface
SubscriptionInterface(crates/router/src/db/subscription.rs)insert_subscription_entryfind_by_merchant_id_customer_id_subscription_idupdate_subscription_entryStore,KafkaStore(delegates), andMockDb(stubbed)Wiring
crates/router/src/types/storage.rsand module plumbing indb.rs,diesel_models/src/lib.rs,query.rs.Motivation and Context
Subscriptions are often provisioned/managed outside Payments, but Payments needs a lightweight mapping to:
mca_id,client_secret)This schema enables upstream orchestration to store/retrieve subscription context without coupling to payment flows.
API / Contract / Config Impact
Testing
can't be performed, as in this PR we only have created the tables and not used it anywhere in the upcoming micro-prs, this will be used. however I have used it myself by making code changes, here are the screenshots.
Checklist
cargo +nightly fmt --allcargo clippy