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(payments_v2): add payment_confirm_intent api endpoint #6263

Merged
merged 124 commits into from
Oct 24, 2024

Conversation

Narayanbhat166
Copy link
Member

@Narayanbhat166 Narayanbhat166 commented Oct 8, 2024

Type of Change

  • New feature

Description

This PR introduces the payment-confirm-intent endpoint. This is used to confirm the payment intent with payment method data.

This PR also includes changes to the payment attempt for api v2. Few columns have been added and few have been removed. The major changes that have been made to payment attempt are

  • The id type is changed to GlobalId
  • Amount related details are stored in a struct in the domain model. This is to ensure that all the operations / getters / setters related to amount are available in a single struct.
  • Few fields that have been removed as a part of backwards compatibility removal have been deleted in the database.
  • The address details have been de - normalized and stored in the payment attempt table. This is because we will not be reusing the address.

This PR contains only the minimum changes that are required to call the connector.

  • There is a bare minimum implementation of routing which is based on the fallback connector config of the business profile.
  • There is no surcharge, decision manager, tokenization and other features. These would be refactored and slowly added to the v2 feature set.
  • There is no implementation to save the card. These features would eventually be added to v2.

Additional Changes

  • This PR modifies the API contract
    Add new api endpoint to payments. The openapi reference has been generated.
Screenshot 2024-10-11 at 11 00 15 AM
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

  • Create the payment intent
  • Confirm the payment intent.
curl --location 'http://localhost:8080/v2/payments/12345_pay_0192b430fb0272b2a4ef5efdbfb06f68/confirm-intent' \
--header 'x-profile-id: pro_an7sjopN2AXVvhEEYvSm' \
--header 'x-client-secret: 12345_pay_0192b430fb0272b2a4ef5efdbfb06f68_secret_0192b430fb0272b2a4ef5f08095c2b1b' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_78d1c87dc958419587490ece50cbfd0c' \
--data '{
    "payment_method_data": {
            "card": {
                "card_number": "4242424242424242",
                "card_exp_month": "01",
                "card_exp_year": "27",
                "card_holder_name": "John Doe",
                "card_cvc": "100"
            }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit"
}'

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

Comment on lines +77 to +81
// // status: self.status,
// // error_message: self.error_message,
// // surcharge_amount: self.surcharge_amount,
// // tax_amount: self.tax_amount,
// // payment_method_id: self.payment_method_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

having two set of comment // is redundant?

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Oct 24, 2024
Merged via the queue into main with commit c7c1e1a Oct 24, 2024
16 of 17 checks passed
@Gnanasundari24 Gnanasundari24 deleted the payment_confirm_api branch October 24, 2024 11:08
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 M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants