Skip to content

Conversation

mrudulvajpayee4935
Copy link
Contributor

@mrudulvajpayee4935 mrudulvajpayee4935 commented Feb 5, 2025

Type of Change

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

Description

Add create and update, bulk update APIs for cards_info table. These APIs will be used to update card bin details stored in cards_info table.

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?

Cypress tests not needed, Tests should be done using below added curls.

Curl to test migration-btach

curl --location 'http://localhost:8080/cards/update-batch' \
--header 'api-key: test_admin' \
--form 'file=@"/Users/mrudul.vajpayee/Downloads/visa_test.csv"'

Curl to test update card-info entry

curl --location 'http://localhost:8080/cards/update' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
        "card_iin": "222705",
        "card_network": "Mastercard",
        "card_type": "DEBIT",
        "card_subtype": "STANDARD",
        "card_issuing_country": "BANGLADESH",
        "migration_status": "Success"
}'

Curl to test create card-info entry

curl --location 'http://localhost:8080/cards/create' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
        "card_iin": "222105",
        "card_network": "Mastercard",
        "card_type": "DEBIT",
        "card_subtype": "STANDARD",
        "card_issuing_country": "BANGLADESH",
        "migration_status": "Success"
}'

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

@mrudulvajpayee4935 mrudulvajpayee4935 requested review from a team as code owners February 5, 2025 11:00
Copy link

semanticdiff-com bot commented Feb 5, 2025

@mrudulvajpayee4935 mrudulvajpayee4935 self-assigned this Feb 5, 2025
@mrudulvajpayee4935 mrudulvajpayee4935 added M-api-contract-changes Metadata: This PR involves API contract changes A-core Area: Core flows labels Feb 5, 2025
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label Feb 5, 2025
kashif-m
kashif-m previously approved these changes Feb 18, 2025
Copy link
Contributor

@kashif-m kashif-m left a comment

Choose a reason for hiding this comment

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

Added nitpicks

Comment on lines 553 to 569
CreateCardsInfo,
/// Update Cards Info flow
UpdateCardsInfo,
/// Cards Info migrate flow
CardsInfoMigrate,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - use single naming convention

Suggested change
CreateCardsInfo,
/// Update Cards Info flow
UpdateCardsInfo,
/// Cards Info migrate flow
CardsInfoMigrate,
CardsInfoCreate,
/// Update Cards Info flow
CardsInfoUpdate,
/// Cards Info migrate flow
CardsInfoMigrate,

Comment on lines 78 to 81
let cards_info_api_types::CardInfoUpdateRequest {
card_iin,
card_issuer,
card_network,
card_type,
card_subtype,
card_issuing_country,
bank_code_id,
bank_code,
country_code,
last_updated_provider,
..
} = card_info_request;
CardsInfoInterface::update_card_info(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - better to use a transformer? We can add a From impl

@@ -21,3 +29,23 @@ pub struct CardInfo {
pub last_updated: Option<PrimitiveDateTime>,
pub last_updated_provider: Option<String>,
}

impl ApiEventMetric for CardInfo {}
Copy link
Member

Choose a reason for hiding this comment

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

Is CardInfo and UpdateCardInfo are API models?

If these are API models we need to create separate types in API Models and implement ApiEventMetric there and not in diesel_models

@mrudulvajpayee4935 mrudulvajpayee4935 changed the title feat(payments):Card bin Update feat(core): Add support for cards bin update Feb 26, 2025
kashif-m
kashif-m previously approved these changes Feb 27, 2025
dgeee13
dgeee13 previously approved these changes Feb 27, 2025
use utoipa::ToSchema;

use crate::enums as storage_enums;
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
use crate::enums as storage_enums;
use crate::enums;

@likhinbopanna likhinbopanna added this pull request to the merge queue Mar 4, 2025
Merged via the queue into main with commit 8e922d3 Mar 4, 2025
26 of 32 checks passed
@likhinbopanna likhinbopanna deleted the card-bin-update branch March 4, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants