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: added client_source, client_version in payment_attempt from payments confirm request headers #4657

Merged
merged 3 commits into from
May 17, 2024

Conversation

vsrivatsa-juspay
Copy link
Contributor

@vsrivatsa-juspay vsrivatsa-juspay commented May 15, 2024

Type of Change

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

Description

Added client_source, client_version in payment_attempt from PaymentsConfirm request headers
Both the above columns are of Option type.
Can be used to collect information from client request headers - X-Client-Source and X-Client-Version

Additional Changes

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

Motivation and Context

closes #4656

How did you test it?

  1. Create a payment intent. Pass confirm: false
    curl --location 'localhost:8080/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: some_api_key' \ --data-raw '{ "amount": 6540, "currency": "USD", "confirm" : false, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": 6540, "customer_id": "cus_udst2tfldj6upmye2reztkmm4i", "email": "guest@example.com", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "description": "Its my first payment request", "authentication_type": "no_three_ds", "payment_method": "card", "payment_method_data": { "card": { "card_number": "4242424242424242", "card_exp_month": "10", "card_exp_year": "35", "card_holder_name": "John Doe", "card_cvc": "123" } }, "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } }'

  2. Confirm the payment, pass the X_CLIENT_VERSION and X_CLIENT_SOURCE headers
    curl --location 'localhost:8080/payments/pay_YleHqfzluDmuEX7394l7/confirm' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: some_api_key' \ --data '{}'

  3. Check the values in the client_version and client_source columns for the payment

Screenshot 2024-05-16 at 7 08 41 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

@vsrivatsa-juspay vsrivatsa-juspay requested review from a team as code owners May 15, 2024 14:54
@vsrivatsa-juspay vsrivatsa-juspay self-assigned this May 15, 2024
@vsrivatsa-juspay vsrivatsa-juspay force-pushed the feat/client_cols_in_payment_attempts branch from 2b9bb55 to 476166f Compare May 15, 2024 15:39
@vsrivatsa-juspay vsrivatsa-juspay changed the title feat: added client_source, client_version in payment_attempt from PaymentsConfirm request headers feat: added client_source, client_version in payment_attempt from payments confirm request headers May 15, 2024
@vsrivatsa-juspay vsrivatsa-juspay force-pushed the feat/client_cols_in_payment_attempts branch from 0526edf to b6718d2 Compare May 16, 2024 13:37
@vsrivatsa-juspay vsrivatsa-juspay force-pushed the feat/client_cols_in_payment_attempts branch from b6718d2 to 64fc200 Compare May 16, 2024 13:53
Copy link
Contributor

@hrithikesh026 hrithikesh026 left a comment

Choose a reason for hiding this comment

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

LGTM

@Narayanbhat166 Narayanbhat166 added C-feature Category: Feature request or enhancement M-database-changes Metadata: This PR involves database schema changes labels May 17, 2024
Copy link
Contributor

@apoorvdixit88 apoorvdixit88 left a comment

Choose a reason for hiding this comment

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

Dashboard specific changes look fine!

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 17, 2024
Merged via the queue into main with commit 7e44bbc May 17, 2024
10 checks passed
@Gnanasundari24 Gnanasundari24 deleted the feat/client_cols_in_payment_attempts branch May 17, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: Feature request or enhancement M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Include client source and client version to identify where a payment attempt originated from
6 participants