feat(subscriptions): Invoice record back workflow#9529
feat(subscriptions): Invoice record back workflow#9529Gnanasundari24 merged 195 commits intomainfrom
Conversation
…to subscription_cruds
…to subscription_cruds
…to subscription_cruds
…ord-back-workflow
| @@ -0,0 +1,452 @@ | |||
| #[cfg(feature = "v1")] | |||
There was a problem hiding this comment.
why feature flag is not removed here? And in other places too in this module?
There was a problem hiding this comment.
Since the subscription core module itself is gated under v1 as it has DB calls where the DB interface differs between v1 and v2. For example, customer DB interface has different implementation for both versions, we are using the v1 implementation.
We would have to replicate the functions where different DB interfaces are involved. hence had kept the feature flag.
| storage::invoice_sync::InvoiceSyncPaymentStatus::PaymentProcessing => { | ||
| let db = &*self.state.store; | ||
| let connector = self.tracking_data.connector_name.to_string().clone(); | ||
| let is_last_retry = retry_subscription_invoice_sync_task( |
There was a problem hiding this comment.
transition_workflow_state function is like a control plane for controlling the job related action for the workflow in every branch, if a helper function is created to handle job then lets have all logic related to job handling inside it or job related functionality lets have here itself, i.e move is_last_retry logic inside retry_subscription_invoice_sync_task or move job related logic from retry_subscription_invoice_sync_task to here
There was a problem hiding this comment.
have moved all the logic to retry_subscription_invoice_sync_task
We did not need the last retry part as the retry_subscription_invoice_sync_task function marks the appropriate status for the job.
…ord-back-workflow
…esouro-googlepay * 'main' of github.com:juspay/hyperswitch: feat(connector): [tesouro] apple pay (#9648) fix(payments): update error handling for payment void v2 (#9595) fix(connectors): [Nexixpay] MIT & order_id fix (#9644) chore(version): 2025.10.07.0 fix(database): percent-encode spaces in Postgres connection URI (#9685) chore(version): 2025.10.06.0 feat(subscriptions): Invoice record back workflow (#9529) feat: Implement subscriptions workflow and incoming webhook support (#9400) Feat(Customer): Added search Feature to the Customer Page (#9619) chore(version): 2025.10.02.0 feat(subscription): Add support to call payments microservice from subscription service via payments API client (#9590)
Type of Change
Description
This pull request introduces a comprehensive set of changes to add invoice management capabilities to the codebase. The changes include new data models and enums for invoices, database schema and query support, and integration with connectors and APIs for invoice-related workflows.
Invoice Data Model and Enums
InvoiceStatusenum to represent the various states an invoice can be in, such asInvoiceCreated,PaymentPending,PaymentSucceeded, etc. (crates/common_enums/src/connector_enums.rs)InvoiceRecordBackTrackingDatastruct for tracking invoice-related process data, along with a constructor. (crates/api_models/src/process_tracker/invoice_record_back.rs)InvoiceIdtype and implemented associated methods and traits, including event metric integration. (crates/common_utils/src/id_type/invoice.rs)InvoiceIdin the global ID types and exposed it for use. (crates/common_utils/src/id_type.rs) [1] [2]Invoiceto theApiEventsTypeenum for event categorization. (crates/common_utils/src/events.rs)ProcessTrackerRunnerenum to includeInvoiceRecordBackflow. (crates/common_enums/src/enums.rs)Database Schema and Models
invoicetable to the Diesel ORM schema (both v1 and v2), including all necessary fields and indices. (crates/diesel_models/src/schema.rs,crates/diesel_models/src/schema_v2.rs) [1] [2] [3] [4]Invoice,InvoiceNew, andInvoiceUpdatestructs for ORM mapping, along with constructors and update methods. (crates/diesel_models/src/invoice.rs)crates/diesel_models/src/query/invoice.rs)invoicemodule in the Diesel models and query modules. (crates/diesel_models/src/lib.rs,crates/diesel_models/src/query.rs) [1] [2]Connector and API Integration
crates/hyperswitch_connectors/src/connectors/chargebee.rs,crates/hyperswitch_connectors/src/connectors/recurly.rs) [1] [2] [3] [4]crates/hyperswitch_connectors/src/default_implementations.rs) [1] [2] [3] [4]API Models
invoice_record_backin the process tracker API models. (crates/api_models/src/process_tracker.rs)Summary of Most Important Changes:
Invoice Data Model and Enums
InvoiceStatusenum and theInvoiceRecordBackTrackingDatastruct for invoice state tracking and process workflows. [1] [2]InvoiceIdtype with associated methods and event metric integration. [1] [2] [3] [4]Database Schema and Models
invoicetable in the Diesel schema, and implemented corresponding ORM structs and query methods for invoice creation, lookup, and updates. [1] [2] [3] [4] [5] [6] [7] [8]Connector and API Integration
API Models
invoice_record_backmodule in the process tracker API models.Additional Changes
Motivation and Context
How did you test it?
Response -
Checklist
cargo +nightly fmt --allcargo clippy