-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(router): add payments incremental authorization api #3038
Merged
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
39265ea
make core changes in payments flow to support incremental authorization
sai-harsha-vardhan 17d59d7
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] a21d9aa
check request_incremental_authorization for incremental_authorization…
sai-harsha-vardhan 11fb658
Merge branch 'add-core-changes-incremental-authorization' of github.c…
sai-harsha-vardhan 04e74a7
resolve conflicts
sai-harsha-vardhan a8df3b3
add incremental authorization api
sai-harsha-vardhan 9e97b46
resolve conflicts
sai-harsha-vardhan fcdc016
fix openapi
sai-harsha-vardhan c560b3d
resolve comments
sai-harsha-vardhan 07dbd49
Merge branch 'main' into add-incremental-authorization-api
sai-harsha-vardhan 461ab30
resolve comments
sai-harsha-vardhan 37a8bc3
Merge branch 'main' of github.com:juspay/hyperswitch into add-increme…
sai-harsha-vardhan 9c8ef52
Merge branch 'add-incremental-authorization-api' of github.com:juspay…
sai-harsha-vardhan c31712e
change authorization_status from created to processing
sai-harsha-vardhan ebbfea6
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] 83bf946
change authorizedpendingreview in cybs to success authorization staus
sai-harsha-vardhan 4a3adf5
Merge branch 'add-incremental-authorization-api' of github.com:juspay…
sai-harsha-vardhan 4408149
resolve comments
sai-harsha-vardhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ pub enum Method { | |
Post, | ||
Put, | ||
Delete, | ||
Patch, | ||
} | ||
|
||
#[derive(Deserialize, Serialize, Debug)] | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
use diesel::{AsChangeset, Identifiable, Insertable, Queryable}; | ||
use serde::{Deserialize, Serialize}; | ||
use time::PrimitiveDateTime; | ||
|
||
use crate::{enums as storage_enums, schema::authorization}; | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Serialize, Deserialize, Hash)] | ||
#[diesel(table_name = authorization)] | ||
#[diesel(primary_key(authorization_id, merchant_id))] | ||
pub struct Authorization { | ||
pub authorization_id: String, | ||
pub merchant_id: String, | ||
pub payment_id: String, | ||
pub amount: i64, | ||
#[serde(with = "common_utils::custom_serde::iso8601")] | ||
pub created_at: PrimitiveDateTime, | ||
#[serde(with = "common_utils::custom_serde::iso8601")] | ||
pub modified_at: PrimitiveDateTime, | ||
pub status: storage_enums::AuthorizationStatus, | ||
pub code: Option<String>, | ||
pub message: Option<String>, | ||
pub connector_authorization_id: Option<String>, | ||
} | ||
|
||
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize)] | ||
#[diesel(table_name = authorization)] | ||
pub struct AuthorizationNew { | ||
pub authorization_id: String, | ||
pub merchant_id: String, | ||
pub payment_id: String, | ||
pub amount: i64, | ||
pub status: storage_enums::AuthorizationStatus, | ||
pub code: Option<String>, | ||
pub message: Option<String>, | ||
pub connector_authorization_id: Option<String>, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub enum AuthorizationUpdate { | ||
StatusUpdate { | ||
status: storage_enums::AuthorizationStatus, | ||
code: Option<String>, | ||
message: Option<String>, | ||
connector_authorization_id: Option<String>, | ||
}, | ||
} | ||
|
||
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)] | ||
#[diesel(table_name = authorization)] | ||
pub struct AuthorizationUpdateInternal { | ||
pub status: Option<storage_enums::AuthorizationStatus>, | ||
pub code: Option<String>, | ||
pub message: Option<String>, | ||
pub modified_at: Option<PrimitiveDateTime>, | ||
pub connector_authorization_id: Option<String>, | ||
} | ||
|
||
impl From<AuthorizationUpdate> for AuthorizationUpdateInternal { | ||
fn from(authorization_child_update: AuthorizationUpdate) -> Self { | ||
let now = Some(common_utils::date_time::now()); | ||
match authorization_child_update { | ||
AuthorizationUpdate::StatusUpdate { | ||
status, | ||
code, | ||
message, | ||
connector_authorization_id, | ||
} => Self { | ||
status: Some(status), | ||
code, | ||
message, | ||
connector_authorization_id, | ||
modified_at: now, | ||
}, | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Is this only for
error_code
anderror_message
, or some other code and message value can be present here? Can you also add doc comments to the fields?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.
This can be any code and message sent by connector