Skip to content

Conversation

@rishavkar
Copy link
Contributor

@rishavkar rishavkar commented Apr 11, 2023

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates

Description

We need to accept frm_configs from the dashboard. So needed to do development for accepting new fields for endpoint: /account/:account_id/connectors

Additional Changes

  • This PR modifies the database schema : ALTER TABLE "merchant_connector_account" ADD COLUMN frm_configs jsonb;
  • This PR modifies application configuration/environment variables

Motivation and Context

It a new feature...we are going to integrate FRM services into hyperswitch, for which we required additional fields for create connector request.
This PR will accept frm_configs field for create connector request, and accordingly persist in the db.

How did you test it?

Following are the steps:

  • Adding an extra field to the request body, to existing curl of the create connector request body.
  • Getting 200 and Expecting this same body in response.
"frm_configs" : {
"frm_enabled_pms" : ["card"],
"frm_enabled_pm_types" : ["credit"],
"frm_enabled_gateways" : ["stripe"],
"frm_action": "cancel_txn",
"frm_preferred_flow_type" : "pre"
}
  • Also this is an optional field...without this field also (previous request format), we will get a success

Checklist

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

Assignee

@rishavkar rishavkar requested review from a team, ashokkjag and jarnura as code owners April 11, 2023 11:15
@shakthi-22 shakthi-22 added the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Apr 14, 2023
@shakthi-22 shakthi-22 removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Apr 14, 2023
@shakthi-22 shakthi-22 added the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Apr 14, 2023
@shakthi-22 shakthi-22 requested a review from jarnura April 14, 2023 10:16
@rishavkar rishavkar self-assigned this Apr 14, 2023
@jarnura jarnura added this to the April'23 release milestone Apr 14, 2023
@jarnura jarnura added S-waiting-on-author Status: This PR is incomplete or needs to address review comments M-api-contract-changes Metadata: This PR involves API contract changes and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Apr 17, 2023
@jarnura jarnura requested a review from SamraatBansal April 17, 2023 09:48
@jarnura jarnura added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed and removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments labels Apr 17, 2023
@jarnura jarnura added S-ready-for-merge and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Apr 17, 2023
@jarnura jarnura added this pull request to the merge queue Apr 17, 2023
Merged via the queue into main with commit bc38bc4 Apr 17, 2023
@SanchithHegde SanchithHegde deleted the frm_integration_with_hyperswitch branch April 17, 2023 19:27
pub payment_methods_enabled: Option<Vec<serde_json::Value>>,
pub connector_type: storage_enums::ConnectorType,
pub metadata: Option<pii::SecretSerdeValue>,
pub frm_configs: Option<Secret<serde_json::Value>>, //Option<FrmConfigs>
Copy link
Member

Choose a reason for hiding this comment

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

Hey @rishavkar, I understand this is a PR that's already merged, but wanted to bring this to your attention.

Whenever you're adding fields to a struct corresponding to a database table, please add it at the last, so that it is in correspondence with how the database has it. When we do a diesel migration run, Postgres adds the column to the end of the table, and diesel updates the schema.rs file to match the database table state, thus adding frm_configs to the end. Because of how diesel handles queries, it expects the column order in schema.rs and the field order in the struct here to be the same. If that is not the case, we'd end up having unexpected behavior (such as data for one column being populated in another) when running our application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M-api-contract-changes Metadata: This PR involves API contract changes

Projects

No open projects
Status: Merged

Development

Successfully merging this pull request may close these issues.

6 participants