-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat: Implement subscription create and record back for Chargebee #9303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ubscriptionCreate trait in subscriptions API
…nd correct import in subscriptions.rs
@@ -309,6 +326,24 @@ pub type BillingConnectorInvoiceSyncTypeV2 = dyn ConnectorIntegrationV2< | |||
BillingConnectorInvoiceSyncResponse, | |||
>; | |||
|
|||
#[cfg(feature = "v1")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[cfg(feature = "v1")] | |
#[cfg(feature = "v2")] |
RevenueRecoveryRecordBackResponse, | ||
>; | ||
|
||
#[cfg(feature = "v1")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[cfg(feature = "v1")] | |
#[cfg(feature = "v2")] |
#[cfg(feature = "v1")] | ||
/// Type alias for `ConnectorIntegration<SubscriptionRecordBack, SubscriptionsRecordBackRequest, RevenueRecoveryRecordBackResponse>` | ||
pub type SubscriptionRecordBackType = dyn ConnectorIntegration< | ||
hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack, | |
SubscriptionRecordBack, |
#[cfg(feature = "v1")] | ||
/// Type alias for `ConnectorIntegration<SubscriptionCreate, SubscriptionCreateRequest, SubscriptionCreateResponse>` | ||
pub type SubscriptionCreateType = dyn ConnectorIntegration< | ||
hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate, | |
SubscriptionCreate, |
pub type SubscriptionCreateType = dyn ConnectorIntegration< | ||
hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate, | ||
SubscriptionCreateRequest, | ||
hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse, | |
SubscriptionCreateResponse, |
#[cfg(feature = "v1")] | ||
/// Type alias for `ConnectorIntegrationV2<SubscriptionRecordBack, SubscriptionCreateData, SubscriptionsRecordBackRequest, RevenueRecoveryRecordBackResponse>` | ||
pub type SubscriptionRecordBackTypeV2 = dyn ConnectorIntegrationV2< | ||
hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionRecordBack, | |
SubscriptionRecordBack, |
hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate, | ||
flow_common_types::SubscriptionCreateData, | ||
SubscriptionCreateRequest, | ||
hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hyperswitch_domain_models::router_flow_types::subscriptions::SubscriptionCreate, | |
flow_common_types::SubscriptionCreateData, | |
SubscriptionCreateRequest, | |
hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionCreateResponse, | |
SubscriptionCreate, | |
flow_common_types::SubscriptionCreateData, | |
SubscriptionCreateRequest, | |
SubscriptionCreateResponse, |
{ | ||
fn get_headers( | ||
&self, | ||
req: &hyperswitch_domain_models::types::SubscriptionRecordBackRouterData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
req: &hyperswitch_domain_models::types::SubscriptionRecordBackRouterData, | |
req: &SubscriptionRecordBackRouterData, |
change it in other places also
Ok(Self { | ||
item_price_id: first_item.item_price_id.clone(), | ||
quantity: first_item.quantity, | ||
billing_address_line1: req | ||
.billing_address | ||
.address | ||
.as_ref() | ||
.and_then(|addr| addr.line1.as_ref().map(|line1| line1.clone().expose())), | ||
billing_address_city: req | ||
.billing_address | ||
.address | ||
.as_ref() | ||
.and_then(|addr| addr.city.clone()), | ||
billing_address_state: req | ||
.billing_address | ||
.address | ||
.as_ref() | ||
.and_then(|addr| addr.state.as_ref().map(|state| state.clone().expose())), | ||
billing_address_zip: req | ||
.billing_address | ||
.address | ||
.as_ref() | ||
.and_then(|addr| addr.zip.as_ref().map(|zip| zip.clone().expose())), | ||
billing_address_country: req | ||
.billing_address | ||
.address | ||
.as_ref() | ||
.and_then(|addr| addr.country.map(|country| country.to_string())), | ||
auto_collection: req.auto_collection.clone(), | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok(Self { | |
item_price_id: first_item.item_price_id.clone(), | |
quantity: first_item.quantity, | |
billing_address_line1: req | |
.billing_address | |
.address | |
.as_ref() | |
.and_then(|addr| addr.line1.as_ref().map(|line1| line1.clone().expose())), | |
billing_address_city: req | |
.billing_address | |
.address | |
.as_ref() | |
.and_then(|addr| addr.city.clone()), | |
billing_address_state: req | |
.billing_address | |
.address | |
.as_ref() | |
.and_then(|addr| addr.state.as_ref().map(|state| state.clone().expose())), | |
billing_address_zip: req | |
.billing_address | |
.address | |
.as_ref() | |
.and_then(|addr| addr.zip.as_ref().map(|zip| zip.clone().expose())), | |
billing_address_country: req | |
.billing_address | |
.address | |
.as_ref() | |
.and_then(|addr| addr.country.map(|country| country.to_string())), | |
auto_collection: req.auto_collection.clone(), | |
}) | |
let address = req.billing_address.address.as_ref(); | |
Ok(Self { | |
item_price_id: first_item.item_price_id.clone(), | |
quantity: first_item.quantity, | |
billing_address_line1: address.and_then(|addr| addr.line1.as_ref().map(|line1| line1.clone().expose())), | |
billing_address_city: address.and_then(|addr| addr.city.clone()), | |
billing_address_state: address.and_then(|addr| addr.state.as_ref().map(|state| state.clone().expose())), | |
billing_address_zip: address.and_then(|addr| addr.zip.as_ref().map(|zip| zip.clone().expose())), | |
billing_address_country: address.and_then(|addr| addr.country.map(|country| country.to_string())), | |
auto_collection: req.auto_collection.clone(), | |
}) |
pub type SubscriptionRecordBackRouterData = RouterData< | ||
SubscriptionRecordBack, | ||
SubscriptionsRecordBackRequest, | ||
RevenueRecoveryRecordBackResponse, | ||
>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub type SubscriptionRecordBackRouterData = RouterData< | |
SubscriptionRecordBack, | |
SubscriptionsRecordBackRequest, | |
RevenueRecoveryRecordBackResponse, | |
>; | |
pub type SubscriptionInvoiceRecordBackRouterData = RouterData< | |
SubscriptionInvoiceRecordBack, | |
SubscriptionInvoiceRecordBackRequest, | |
SubscriptionInvoiceRecordBackResponse, | |
>; |
Type of Change
Description
Additional Changes
Motivation and Context
How did you test it?
Checklist
cargo +nightly fmt --all
cargo clippy