Skip to content

Conversation

tsdk02
Copy link
Contributor

@tsdk02 tsdk02 commented Jul 1, 2024

Type of Change

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

Description

  • metadata is marked as pii::SecretSerdeValue, now changed it to serde_json::Value to remove the masking.
  • Added the metadata field for hyperswitch-payment-intent-events (type - String).

Additional Changes

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

Motivation and Context

Adding the metadata to the payment-intent-event helps in providing better information about the event.

How did you test it?

Make a normal payment through Postman by following the steps:

  • Merchant Account - Create
  • API Key - Create
  • Payment Connector - Create
  • Payments - Create

You should now be able to see the metadata field in hyperswitch-payment-intent-events when viewed in kafka-ui.
Screenshot 2024-07-01 at 6 57 29 PM
And can also be searched using global search in the dashboard.
Screenshot 2024-07-02 at 1 06 11 PM
Screenshot 2024-07-02 at 1 06 54 PM

Metadata is of type - String
Screenshot 2024-07-02 at 3 55 37 PM

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

@tsdk02 tsdk02 self-assigned this Jul 1, 2024
@tsdk02 tsdk02 requested review from a team as code owners July 1, 2024 13:39
@tsdk02 tsdk02 linked an issue Jul 1, 2024 that may be closed by this pull request
@tsdk02 tsdk02 requested review from lsampras and ivor11 July 1, 2024 13:40
lsampras
lsampras previously approved these changes Jul 2, 2024
@tsdk02 tsdk02 requested a review from Abhitator216 July 2, 2024 08:03
Abhitator216
Abhitator216 previously approved these changes Jul 2, 2024
@Narayanbhat166
Copy link
Contributor

metadata is marked as pii::SecretSerdeValue, now changed it to serde_json::Value to remove the masking

@tsdk02 why do we need to remove the masking for serde json value?

Narayanbhat166
Narayanbhat166 previously approved these changes Jul 2, 2024
@tsdk02
Copy link
Contributor Author

tsdk02 commented Jul 2, 2024

metadata is marked as pii::SecretSerdeValue, now changed it to serde_json::Value to remove the masking

@tsdk02 why do we need to remove the masking for serde json value?

We wanted to use the metadata field for global_search as well for generating events, we're removing the constraint on metadata being pii sensitive since it is being sent out of the code for global search

@tsdk02 tsdk02 dismissed stale reviews from Narayanbhat166, Abhitator216, and lsampras via 2087869 July 2, 2024 10:28
@tsdk02 tsdk02 requested review from a team as code owners July 2, 2024 10:28
lsampras
lsampras previously approved these changes Jul 2, 2024
@@ -664,7 +664,7 @@ host = "https://localhost:9200"
[opensearch.auth]
auth = "basic"
username = "admin"
password = "admin"
Copy link
Contributor

Choose a reason for hiding this comment

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

can you revert this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually this is a required change for running opensearch locally.

@@ -382,6 +382,7 @@ services:
environment:
- "discovery.type=single-node"
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=0penS3arc#
- LOG_LEVEL=DEBUG
Copy link
Contributor

Choose a reason for hiding this comment

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

is this intended change here?

Copy link
Contributor Author

@tsdk02 tsdk02 Jul 2, 2024

Choose a reason for hiding this comment

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

Yes, as it helps in better logging and debugging

Narayanbhat166
Narayanbhat166 previously approved these changes Jul 3, 2024
lsampras
lsampras previously approved these changes Jul 3, 2024
@tsdk02 tsdk02 requested a review from SanchithHegde July 3, 2024 14:09
@@ -453,7 +453,7 @@ pub struct PaymentsRequest {

/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
#[schema(value_type = Option<Object>, example = r#"{ "udf1": "some-value", "udf2": "some-value" }"#)]
pub metadata: Option<pii::SecretSerdeValue>,
pub metadata: Option<serde_json::Value>,
Copy link
Member

Choose a reason for hiding this comment

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

We'd intentionally kept this a Secret since this was a field provided by the merchant, and to not expose possible sensitive information in application logs. If we're now removing the Secret, we may have to consider masking possible sensitive information to our best efforts, both in application logs and in ClickHouse events.

Copy link
Contributor

Choose a reason for hiding this comment

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

adding an issue for this #5227 .
we need to add consistency for this,
either by masking/hashing/encrypting it everywhere and deciding on a proper way for this

@SanchithHegde SanchithHegde requested a review from jarnura July 3, 2024 17:58
@lsampras lsampras dismissed stale reviews from Narayanbhat166 and themself via ee20600 July 5, 2024 13:27
lsampras
lsampras previously approved these changes Jul 5, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 5, 2024
Merged via the queue into main with commit 5ebfbaf Jul 5, 2024
@likhinbopanna likhinbopanna deleted the add-metadata-payment-intent-events branch July 5, 2024 15:04
pixincreate added a commit that referenced this pull request Jul 8, 2024
…ify-cypress

* 'main' of github.com:juspay/hyperswitch:
  chore(version): 2024.07.08.0
  fix(connector): [adyen] remove browser info for mit and [paypal] add refund key in headers (#5225)
  chore(version): 2024.07.06.0
  feat(router): Pass the shipping email whenever the billing details are included in the session token response (#5228)
  fix(cypress): fix metadata missing while creating connector if not in auth (#5215)
  refactor: fix unit and documentation tests (#4754)
  feat(events): add hashed customer_email and feature_metadata (#5220)
  feat(events): Add payment metadata to hyperswitch-payment-intent-events (#5170)
  fix(analytics): using HashSet to represent the returned metrics (#5179)
  feat(core): billing_details inclusion in Payment Intent (#5090)
  feat(router): pass fields to indicate if the customer address details to be connector from wallets (#5210)
  fix(refunds): Add aliases on refund status for backwards compatibility (#5216)
  Feat(connector): [BRAINTREE] Implement Card Mandates (#5204)
Narayanbhat166 added a commit that referenced this pull request Jul 8, 2024
…ts (#5170)

Co-authored-by: Narayan Bhat <[email protected]>
Co-authored-by: Sampras Lopes <[email protected]>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
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.

feat(events): add payment metadata to the payment intent events
6 participants