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): [Itau Bank] Add payment and sync flow for Pix #5342

Merged
merged 21 commits into from
Jul 22, 2024

Conversation

Sakilmostak
Copy link
Contributor

@Sakilmostak Sakilmostak commented Jul 16, 2024

Type of Change

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

Description

Add payment and sync flow for Itau Bank connector

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?

Through Cypress:
image

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

@Sakilmostak Sakilmostak added A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement labels Jul 16, 2024
@Sakilmostak Sakilmostak added this to the July 2024 Release milestone Jul 16, 2024
@Sakilmostak Sakilmostak self-assigned this Jul 16, 2024
@Sakilmostak Sakilmostak requested review from a team as code owners July 16, 2024 19:44
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Jul 17, 2024
@Sakilmostak Sakilmostak changed the base branch from main to itau_template July 17, 2024 08:48
@Sakilmostak Sakilmostak requested review from a team as code owners July 17, 2024 08:48
@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Jul 17, 2024
@Sakilmostak Sakilmostak changed the base branch from itau_template to main July 17, 2024 08:48
@hyperswitch-bot hyperswitch-bot bot removed the M-database-changes Metadata: This PR involves database schema changes label Jul 17, 2024
@Sakilmostak Sakilmostak removed the request for review from a team July 17, 2024 08:49
})
}
_ => Err(
errors::ConnectorError::NotImplemented("Payment methods".to_string())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
errors::ConnectorError::NotImplemented("Payment methods".to_string())
errors::ConnectorError::NotImplemented("Payment method".to_string())

devedor,
})
}
_ => Err(
Copy link
Contributor

Choose a reason for hiding this comment

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

can we not use _=> instead do a match on all payment method types?

srujanchikke
srujanchikke previously approved these changes Jul 18, 2024
Copy link
Contributor

@SamraatBansal SamraatBansal left a comment

Choose a reason for hiding this comment

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

Please add cypress test cases

),
(
headers::USER_AGENT.to_string(),
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36".to_string().into(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should not be hard_coded, can take this from browser_info, if a required field

),
(
headers::ACCEPT.to_string(),
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.".to_string().into(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Does all these types are required to mentioned?

@pixincreate pixincreate added the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jul 19, 2024
@Sakilmostak Sakilmostak removed the request for review from a team July 22, 2024 06:32
),
(
headers::ACCEPT.to_string(),
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.".to_string().into(),
Copy link
Member

Choose a reason for hiding this comment

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

We probably don't need all these types. And this doesn't seem to have JSON included here?

@@ -414,6 +414,7 @@ pub struct PaymentsSyncData {
pub payment_method_type: Option<storage_enums::PaymentMethodType>,
pub currency: storage_enums::Currency,
pub payment_experience: Option<common_enums::PaymentExperience>,
pub browser_info: Option<BrowserInformation>,
Copy link
Member

Choose a reason for hiding this comment

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

Let's not use this browser information object, let's hard-code the user agent instead.

CC: @Narayanbhat166

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we should attach the user agent of our reqwest client here and not the one that we receive from the user

let req = Some(
services::RequestBuilder::new()
.method(services::Method::Post)
.headers(types::RefreshTokenType::get_headers(self, req, connectors)?)
Copy link
Member

Choose a reason for hiding this comment

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

Can we attach default headers as well?

) -> CustomResult<String, errors::ConnectorError> {
Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
Ok(format!(
"{}itau-ep9-gtw-pix-recebimentos-ext-v2/v2/cob",
Copy link
Member

Choose a reason for hiding this comment

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

Hard-coding this part of the URL can require us significant build time if and when we are required to update this URL. Can we have this part of the URL being read from configs?

@SanchithHegde SanchithHegde requested a review from a team July 22, 2024 10:20
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 22, 2024
card_pm: {
ZeroAuthMandate: {
Response: {
status: 500,
Copy link
Member

Choose a reason for hiding this comment

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

Is this intentional? 4xx is expected here if I'm not wrong. Also, this can be picked from defaults which is in commons.js

country_code: "+91",
},
},
currency: "BRL",
Copy link
Member

Choose a reason for hiding this comment

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

Since currency is passed in payment intent, this can be removed.

break;
default:
verifyReturnUrl(redirection_url, expected_url, true);
// expected_redirection can be used here to handle other payment methods
Copy link
Member

Choose a reason for hiding this comment

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

please check the lints

switch (payment_method_type) {
case "pix":
fetchAndParseImageData(redirection_url).then((qrCodeData) => {
console.log("Imaage_data>>>>>>>>>", qrCodeData)
Copy link
Member

Choose a reason for hiding this comment

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

console.log() can be removed as it is no longer necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since these are minor changes, Im putting them in the subsequent pr for refund

@pixincreate pixincreate removed this pull request from the merge queue due to a manual request Jul 22, 2024
@pixincreate pixincreate added this pull request to the merge queue Jul 22, 2024
Merged via the queue into main with commit 3fef96e Jul 22, 2024
13 checks passed
@pixincreate pixincreate deleted the itau_bank branch July 22, 2024 11:00
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jul 22, 2024
pixincreate added a commit that referenced this pull request Jul 24, 2024
* 'main' of github.com:juspay/hyperswitch: (27 commits)
  refactor(connector): added amount conversion framework for billwerk (#4972)
  feat(connector): [Itaubank] Add refund and rsync flow  (#5420)
  feat: create additional columns in organization table (#5380)
  refactor(merchant_id): create domain type for `merchant_id` (#5408)
  fix(euclid): remove business_profile routing feature flag (#5430)
  feat: add create retrieve and update api endpoints for organization resource (#5361)
  chore(version): 2024.07.24.0
  refactor(connector): [Itaubank] add dynamic fields for pix (#5419)
  Feat(connector): [WELLSFARGO] Add template code (#5333)
  fix(connector): [Datatrans] Handling for 4-Digit YYYY input and Correct 3DS Routing to no_3ds (#5410)
  refactor(connector):  add amount conversion framework to volt (#4985)
  chore(users): email templates footer icon style enhance (#5375)
  feat(customer): customer v2 refactor for customer create end point (#5350)
  chore(version): 2024.07.23.0
  fix(router): store `network_transaction_id` in stripe `authorize` flow (#5399)
  ci: handle packages to run are being empty (#5403)
  chore: add customer, shipping and billing details to payment_response for payment list api (#5401)
  refactor(dashboard_metadata): alter query for merchant scoped metadata (#5397)
  refactor(connector): Add billing_country in klarna dynamic fields (#5373)
  feat(connector): [Itau Bank] Add payment and sync flow for Pix (#5342)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants