Skip to content
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(connector): [Novalnet] Add zero auth mandate #6631

Merged
merged 4 commits into from
Jan 10, 2025

Conversation

cookieg13
Copy link
Contributor

@cookieg13 cookieg13 commented Nov 21, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

  1. Added zero auth mandates for Novalnet
  2. Made changes so that create_webhook_url fn can accept merchant_connector_account_id instead of connector_name

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

  1. Zero auth mandate for novalnet
    Note:
    Skipping no3ds test cases as it is not supported by novalnet cc: @Likhin Bopanna
Screenshot 2024-12-05 at 13 57 38

Tested manually
https://docs.google.com/document/d/1i4SSX837Dh9ipfOz24bDwJF8osR_UPmfPLWUbLP3bh0/edit?usp=sharing

  1. Webhooks
    Webhooks working as expected for /payments. Tested locally.
Screenshot 2024-11-28 at 13 46 36

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@cookieg13 cookieg13 requested review from a team as code owners November 21, 2024 11:30
@cookieg13 cookieg13 self-assigned this Nov 21, 2024
@cookieg13 cookieg13 changed the title Add novalnet zero auth mandate feat(connector): [Novalnet] Add zero auth mandate Nov 21, 2024
@cookieg13 cookieg13 force-pushed the addNovalnetSetupMandate branch from df85bb8 to 4fdf8c1 Compare November 22, 2024 06:10
srujanchikke
srujanchikke previously approved these changes Nov 25, 2024
Comment on lines 3040 to 3589
let webhook_url = Some(helpers::create_webhook_url(
router_base_url,
&attempt.merchant_id,
connector_name,
));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Narayanbhat166 @sai-harsha-vardhan Should we consider passing MerchantConnectorAccountId here, instead of the connector name? Basically update the create_webhook_url() function as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's always recommended to use MerchantConnectorAccountId in webhook url

Copy link
Contributor Author

@cookieg13 cookieg13 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sai-harsha-vardhan @SanchithHegde I made a new fn create_webhook_url_using_mca_id ,but only used it in line 226 (crates/router/src/core/payments/transformers.rs:226) . In the other places where create_webhook_url() is currently used the MerchantConnectorAccountId value is Optional, so we cant replace connector name with simply MerchantConnectorAccountId.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will always have the merchant_connector_id when constructing the router data. So if it is not found you can raise an internal server error.

I do not see any harm in updating the existing webhook function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the existing create_webhook_url fn

SanchithHegde
SanchithHegde previously approved these changes Nov 27, 2024
crates/router/src/core/payments/helpers.rs Outdated Show resolved Hide resolved
SanchithHegde
SanchithHegde previously approved these changes Nov 27, 2024
srujanchikke
srujanchikke previously approved these changes Nov 27, 2024
@cookieg13 cookieg13 dismissed stale reviews from srujanchikke and SanchithHegde via 4c94106 November 28, 2024 08:18
@cookieg13 cookieg13 force-pushed the addNovalnetSetupMandate branch 2 times, most recently from 4c94106 to 004a8b6 Compare November 28, 2024 08:22
crates/router/src/core/payments/transformers.rs Outdated Show resolved Hide resolved
crates/router/src/core/payments/transformers.rs Outdated Show resolved Hide resolved
crates/router/src/core/payments/transformers.rs Outdated Show resolved Hide resolved
crates/router/src/core/payments/transformers.rs Outdated Show resolved Hide resolved
@cookieg13 cookieg13 force-pushed the addNovalnetSetupMandate branch from 004a8b6 to 9f96ab9 Compare December 2, 2024 09:01
@cookieg13 cookieg13 force-pushed the addNovalnetSetupMandate branch from e742315 to 62920e9 Compare January 6, 2025 08:10
@@ -32,7 +32,7 @@ pub async fn construct_relay_refund_router_data<'a, F>(
let webhook_url = Some(payments::helpers::create_webhook_url(
&state.base_url.clone(),
merchant_id,
connector_name,
&connector_account.get_id().get_string_repr().to_string(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to do to_string if we are taking only the reference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here create_webhook_url() is accepting &String , and get_string_repr() returns &str that is why used

to_string()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can update the create_webhook_url() function to accept &str, if not done already.

@cookieg13 cookieg13 force-pushed the addNovalnetSetupMandate branch from 62920e9 to a13dbf6 Compare January 6, 2025 12:06
Narayanbhat166
Narayanbhat166 previously approved these changes Jan 7, 2025
@@ -1243,15 +1243,16 @@ pub fn create_authorize_url(
pub fn create_webhook_url(
router_base_url: &String,
merchant_id: &id_type::MerchantId,
connector_name: impl std::fmt::Display,
merchant_connector_id_or_connector_name: &String,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
merchant_connector_id_or_connector_name: &String,
merchant_connector_id_or_connector_name: &str,

Then we can avoid the to_string() calls.

@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 10, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 10, 2025
Merged via the queue into main with commit 7b306a9 Jan 10, 2025
17 of 19 checks passed
@likhinbopanna likhinbopanna deleted the addNovalnetSetupMandate branch January 10, 2025 09:44
pixincreate added a commit that referenced this pull request Jan 10, 2025
…d-memory-cache

* 'main' of github.com:juspay/hyperswitch:
  feat(connector): [Novalnet] Add zero auth mandate (#6631)
  feat(router): add support for relay refund incoming webhooks (#6974)
  chore(version): 2025.01.10.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants