mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
feat(subscription): add support to create subscription with trial plans (#9721)
Co-authored-by: Ankit Kumar Gupta <ankit.gupta.001@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Gaurav Rawat <104276743+GauravRawat369@users.noreply.github.com>
This commit is contained in:
@ -100,6 +100,27 @@ impl<T: DatabaseStore> InvoiceInterface for RouterStore<T> {
|
||||
subscription_id
|
||||
))))
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
async fn find_invoice_by_subscription_id_connector_invoice_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
key_store: &MerchantKeyStore,
|
||||
subscription_id: String,
|
||||
connector_invoice_id: common_utils::id_type::InvoiceId,
|
||||
) -> CustomResult<Option<DomainInvoice>, StorageError> {
|
||||
let conn = connection::pg_connection_read(self).await?;
|
||||
self.find_optional_resource(
|
||||
state,
|
||||
key_store,
|
||||
Invoice::get_invoice_by_subscription_id_connector_invoice_id(
|
||||
&conn,
|
||||
subscription_id,
|
||||
connector_invoice_id,
|
||||
),
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
@ -154,6 +175,24 @@ impl<T: DatabaseStore> InvoiceInterface for KVRouterStore<T> {
|
||||
.get_latest_invoice_for_subscription(state, key_store, subscription_id)
|
||||
.await
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
async fn find_invoice_by_subscription_id_connector_invoice_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
key_store: &MerchantKeyStore,
|
||||
subscription_id: String,
|
||||
connector_invoice_id: common_utils::id_type::InvoiceId,
|
||||
) -> CustomResult<Option<DomainInvoice>, StorageError> {
|
||||
self.router_store
|
||||
.find_invoice_by_subscription_id_connector_invoice_id(
|
||||
state,
|
||||
key_store,
|
||||
subscription_id,
|
||||
connector_invoice_id,
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
@ -197,4 +236,14 @@ impl InvoiceInterface for MockDb {
|
||||
) -> CustomResult<DomainInvoice, StorageError> {
|
||||
Err(StorageError::MockDbError)?
|
||||
}
|
||||
|
||||
async fn find_invoice_by_subscription_id_connector_invoice_id(
|
||||
&self,
|
||||
_state: &KeyManagerState,
|
||||
_key_store: &MerchantKeyStore,
|
||||
_subscription_id: String,
|
||||
_connector_invoice_id: common_utils::id_type::InvoiceId,
|
||||
) -> CustomResult<Option<DomainInvoice>, StorageError> {
|
||||
Err(StorageError::MockDbError)?
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user