Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(core): Add support for card network tokenization #5599

Merged
merged 80 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
0b1e232
insert required fields in merchant account, payment method table
prasunna09 Jul 24, 2024
a64d5c1
add support for network tokenization
prasunna09 Jul 29, 2024
038f541
move from api_models to domain_models
prasunna09 Jul 31, 2024
85061f2
fix clippy
prasunna09 Aug 1, 2024
55eaaae
fix formatting
prasunna09 Aug 1, 2024
7b4a415
Merge main
prasunna09 Aug 3, 2024
210575a
merge add-network-token-data-in-domain-models branch into this branch
prasunna09 Aug 3, 2024
b4c55d2
add network tokenization support for cybersource
prasunna09 Aug 4, 2024
d230f97
fix cit repeat
prasunna09 Aug 5, 2024
3d4707f
add token_payment_method_data in pm table, add delete api for token d…
prasunna09 Aug 12, 2024
1b2329b
merge main
prasunna09 Aug 13, 2024
b7f9735
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Aug 13, 2024
27ddfe6
fix clippy errors
prasunna09 Aug 13, 2024
d00e866
Merge branch 'add-card-network-tokenization' of github.com:juspay/hyp…
prasunna09 Aug 13, 2024
95dd43d
chore: run formatter
hyperswitch-bot[bot] Aug 13, 2024
bd9e6da
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Aug 13, 2024
079cc3d
code refactoring
prasunna09 Aug 13, 2024
3543839
code refactoring
prasunna09 Aug 13, 2024
500fd86
code refactoring
prasunna09 Aug 16, 2024
069ced9
code refactoring
prasunna09 Aug 18, 2024
e23f2c7
tokenize the card when the card network is in the list of network_tok…
prasunna09 Aug 18, 2024
ac2c2e7
Merge main
prasunna09 Aug 18, 2024
5f64f6e
Merge Main
prasunna09 Aug 20, 2024
0a3d45e
chore: run formatter
hyperswitch-bot[bot] Aug 20, 2024
ab5db97
add support for token status check
prasunna09 Aug 20, 2024
482eea7
resolve conflicts
prasunna09 Aug 20, 2024
2df9150
chore: run formatter
hyperswitch-bot[bot] Aug 20, 2024
3b7e2cc
add check_token_status_url in dev toml
prasunna09 Aug 20, 2024
ec62e2e
Merge branch 'add-card-network-tokenization' of github.com:juspay/hyp…
prasunna09 Aug 20, 2024
1f46ecb
resolve pr comments - rename the variable name
prasunna09 Aug 20, 2024
2e7a9fd
chore: run formatter
hyperswitch-bot[bot] Aug 20, 2024
20331b0
fix NT + NTI flow for mandates
prasunna09 Aug 22, 2024
e953c7b
branch rebase
prasunna09 Aug 22, 2024
34bac1b
chore: run formatter
hyperswitch-bot[bot] Aug 22, 2024
39de00b
resolve pr comments
prasunna09 Aug 23, 2024
6605c41
branch rebase
prasunna09 Aug 23, 2024
5bafdd7
fix formatting
prasunna09 Aug 23, 2024
4cb720b
remove unnecessary comments
prasunna09 Aug 23, 2024
b553c3d
code refactoring
prasunna09 Aug 27, 2024
3a15643
remove logging
prasunna09 Aug 27, 2024
238cf80
code refactoring
prasunna09 Aug 27, 2024
d690b9d
fix formatting
prasunna09 Aug 27, 2024
51f17cf
fix clippy warnings
prasunna09 Aug 27, 2024
f287f73
resolve pr comments
prasunna09 Aug 28, 2024
10c26a2
code refactoring
prasunna09 Aug 28, 2024
d05e727
merge main
prasunna09 Aug 28, 2024
4d6e5cf
chore: run formatter
hyperswitch-bot[bot] Aug 28, 2024
c39e34f
resolve pr comments
prasunna09 Aug 28, 2024
e6e7051
Merge branch 'add-card-network-tokenization' of github.com:juspay/hyp…
prasunna09 Aug 28, 2024
5b77ecc
fix ci check for schema.rs and resolve pr comments
prasunna09 Aug 29, 2024
d329609
chore: run formatter
hyperswitch-bot[bot] Aug 29, 2024
4acd4b5
add loggers for req and response
prasunna09 Aug 29, 2024
d11ad55
Merge branch 'add-card-network-tokenization' of github.com:juspay/hyp…
prasunna09 Aug 29, 2024
7505437
Merge main
prasunna09 Sep 2, 2024
93bbd53
chore: run formatter
hyperswitch-bot[bot] Sep 2, 2024
4c5368f
move the is_network_tokenization_enabled field from merchant_account …
prasunna09 Sep 2, 2024
8698710
Merge branch 'add-card-network-tokenization' of github.com:juspay/hyp…
prasunna09 Sep 2, 2024
0fde02d
fix formatting
prasunna09 Sep 2, 2024
2217b27
fix clippy
prasunna09 Sep 2, 2024
d3ffc79
code refactoring
prasunna09 Sep 3, 2024
3520578
remove unnecessary logs
prasunna09 Sep 3, 2024
f8b4287
resolve pr comments
prasunna09 Sep 5, 2024
d64f869
resolve pr comments
prasunna09 Sep 9, 2024
8c9671c
Merge main
prasunna09 Sep 10, 2024
f4e58b1
chore: run formatter
hyperswitch-bot[bot] Sep 10, 2024
461e878
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Sep 10, 2024
a4c8f1f
resolve pr comments
prasunna09 Sep 11, 2024
74bc511
resolve pr comments
prasunna09 Sep 11, 2024
21a8721
merge main
prasunna09 Sep 11, 2024
60fb2d6
code refactoring
prasunna09 Sep 11, 2024
9a67d49
fix spell check
prasunna09 Sep 11, 2024
732fdd0
resolve pr commits
prasunna09 Sep 12, 2024
2516514
add alias amex to american express card network
prasunna09 Sep 12, 2024
5d64fc4
fix clippy_v2
prasunna09 Sep 15, 2024
8377697
Merge main
prasunna09 Sep 15, 2024
a3fd0da
chore: run formatter
hyperswitch-bot[bot] Sep 15, 2024
86dd665
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Sep 15, 2024
1ee4b3d
fix clippy_v2
prasunna09 Sep 15, 2024
cb345ce
Merge branch 'add-card-network-tokenization' of github.com:juspay/hyp…
prasunna09 Sep 15, 2024
f3268af
merge main
prasunna09 Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -12167,6 +12167,9 @@
}
],
"nullable": true
},
"is_network_tokenization_enabled": {
"type": "boolean"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -12262,7 +12265,8 @@
"primary_business_details",
"organization_id",
"is_recon_enabled",
"recon_status"
"recon_status",
"is_network_tokenization_enabled"
],
"properties": {
"merchant_id": {
Expand Down Expand Up @@ -12400,6 +12404,9 @@
}
],
"nullable": true
},
"is_network_tokenization_enabled": {
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -12528,6 +12535,10 @@
}
],
"nullable": true
},
"is_network_tokenization_enabled": {
"type": "boolean",
"nullable": true
}
},
"additionalProperties": false
Expand Down
5 changes: 4 additions & 1 deletion config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -718,4 +718,7 @@ public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "p
encryption_key = "" # Encryption key used for encrypting data in user_authentication_methods table

[locker_based_open_banking_connectors]
connector_list = ""
connector_list = ""

[network_tokenization_supported_card_networks]
card_networks = "visa" # Supported card networks for network tokenization
10 changes: 10 additions & 0 deletions config/deployments/env_specific.toml
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,13 @@ public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "p

[user_auth_methods]
encryption_key = "user_auth_table_encryption_key" # Encryption key used for encrypting data in user_authentication_methods table

[network_tokenization_service]
prasunna09 marked this conversation as resolved.
Show resolved Hide resolved
generate_token_url= ""
fetch_token_url= ""
token_service_api_key= ""
public_key= ""
private_key= ""
key_id= ""
delete_token_url= ""
check_token_status_url= ""
3 changes: 3 additions & 0 deletions config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,6 @@ sdk_eligible_payment_methods = "card"

[locker_based_open_banking_connectors]
connector_list = ""

[network_tokenization_supported_card_networks]
card_networks = "visa"
3 changes: 3 additions & 0 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,6 @@ sdk_eligible_payment_methods = "card"

[locker_based_open_banking_connectors]
connector_list = ""

[network_tokenization_supported_card_networks]
card_networks = "visa"
13 changes: 13 additions & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -722,3 +722,16 @@ encryption_key = "A8EF32E029BC3342E54BF2E172A4D7AA43E8EF9D2C3A624A9F04E2EF79DC69

[locker_based_open_banking_connectors]
connector_list = ""

[network_tokenization_supported_card_networks]
card_networks = "Visa"
prasunna09 marked this conversation as resolved.
Show resolved Hide resolved

[network_tokenization_service]
generate_token_url= ""
fetch_token_url= ""
token_service_api_key= ""
public_key= ""
private_key= ""
key_id= ""
delete_token_url= ""
check_token_status_url= ""
prasunna09 marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 13 additions & 0 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -581,3 +581,16 @@ ach = { country = "US", currency = "USD" }

[locker_based_open_banking_connectors]
connector_list = ""

[network_tokenization_supported_card_networks]
card_networks = "Visa"

[network_tokenization_service]
generate_token_url= ""
fetch_token_url= ""
token_service_api_key= ""
public_key= ""
private_key= ""
key_id= ""
delete_token_url= ""
check_token_status_url= ""
7 changes: 7 additions & 0 deletions crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ pub struct MerchantAccountCreate {
/// Default payment method collect link config
#[schema(value_type = Option<BusinessCollectLinkConfig>)]
pub pm_collect_link_config: Option<BusinessCollectLinkConfig>,

#[serde(default)]
pub is_network_tokenization_enabled: bool,
prasunna09 marked this conversation as resolved.
Show resolved Hide resolved
}

#[cfg(all(
Expand Down Expand Up @@ -336,6 +339,8 @@ pub struct MerchantAccountUpdate {
/// Default payment method collect link config
#[schema(value_type = Option<BusinessCollectLinkConfig>)]
pub pm_collect_link_config: Option<BusinessCollectLinkConfig>,

pub is_network_tokenization_enabled: Option<bool>,
}

#[cfg(all(
Expand Down Expand Up @@ -535,6 +540,8 @@ pub struct MerchantAccountResponse {
/// Default payment method collect link config
#[schema(value_type = Option<BusinessCollectLinkConfig>)]
pub pm_collect_link_config: Option<BusinessCollectLinkConfig>,

pub is_network_tokenization_enabled: bool,
}

#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
Expand Down
10 changes: 9 additions & 1 deletion crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,15 @@ pub struct MandateIds {
#[derive(Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone)]
pub enum MandateReferenceId {
ConnectorMandateId(ConnectorMandateReferenceId), // mandate_id send by connector
NetworkMandateId(String), // network_txns_id send by Issuer to connector, Used for PG agnostic mandate txns
NetworkMandateId(String), // network_txns_id send by Issuer to connector, Used for PG agnostic mandate txns along with card data
NetworkTokenWithNTI(NetworkTokenWithNTIRef), // network_txns_id send by Issuer to connector, Used for PG agnostic mandate txns along with network token data
}

#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, Eq, PartialEq)]
pub struct NetworkTokenWithNTIRef {
pub network_transaction_id: String,
pub token_exp_month: Option<Secret<String>>,
pub token_exp_year: Option<Secret<String>>,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, Eq, PartialEq)]
Expand Down
10 changes: 10 additions & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1756,16 +1756,26 @@ pub enum MandateStatus {
)]
#[router_derive::diesel_enum(storage_type = "text")]
pub enum CardNetwork {
#[serde(alias = "VISA")]
prasunna09 marked this conversation as resolved.
Show resolved Hide resolved
Visa,
#[serde(alias = "MASTERCARD")]
Mastercard,
#[serde(alias = "AMERICANEXPRESS")]
AmericanExpress,
JCB,
#[serde(alias = "DINERSCLUB")]
DinersClub,
#[serde(alias = "DISCOVER")]
Discover,
#[serde(alias = "CARTRSBANCAIRES")]
CartesBancaires,
prasunna09 marked this conversation as resolved.
Show resolved Hide resolved
#[serde(alias = "UNIONPAY")]
UnionPay,
#[serde(alias = "INTERAC")]
Interac,
#[serde(alias = "RUPAY")]
RuPay,
#[serde(alias = "MAESTRO")]
Maestro,
}

Expand Down
5 changes: 5 additions & 0 deletions crates/diesel_models/src/merchant_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub struct MerchantAccount {
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
pub version: common_enums::ApiVersion,
pub is_network_tokenization_enabled: bool,
}

#[cfg(all(
Expand Down Expand Up @@ -92,6 +93,7 @@ pub struct MerchantAccountSetter {
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
pub version: common_enums::ApiVersion,
pub is_network_tokenization_enabled: bool,
}

#[cfg(all(
Expand Down Expand Up @@ -129,6 +131,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
payment_link_config: item.payment_link_config,
pm_collect_link_config: item.pm_collect_link_config,
version: item.version,
is_network_tokenization_enabled: item.is_network_tokenization_enabled,
}
}
}
Expand Down Expand Up @@ -246,6 +249,7 @@ pub struct MerchantAccountNew {
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
pub version: common_enums::ApiVersion,
pub is_network_tokenization_enabled: bool,
}

#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
Expand Down Expand Up @@ -310,4 +314,5 @@ pub struct MerchantAccountUpdateInternal {
pub recon_status: Option<storage_enums::ReconStatus>,
pub payment_link_config: Option<serde_json::Value>,
pub pm_collect_link_config: Option<serde_json::Value>,
pub is_network_tokenization_enabled: Option<bool>,
}
Loading
Loading