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

fix: conditionally add reverse lookup in update mandate #4387

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

akshay-97
Copy link
Contributor

@akshay-97 akshay-97 commented Apr 17, 2024

Type of Change

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

Description

there might be a chance that for same mandate entry , reverse lookup for connector mandate id is attempted to be inserted twice, causing an error in the second reverse lookup insert

adding a condition in update mandate to add reverse lookup only when existing object doesnt have the value

Additional Changes

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

Motivation and Context

there might be a chance that for same mandate entry , reverse lookup for connector mandate id is attempted to be inserted twice, causing an error in the second reverse lookup insert

adding a condition in update mandate to add reverse lookup only when existing object doesnt have the value

How did you test it?

create mandate
curl --location 'http://localhost:8080/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key:**' \ --data-raw '{ "amount": 0, "currency": "USD", "confirm": true, "capture_method": "manual", "capture_on": "2022-09-10T10:11:12Z", "customer_id": "customer0977", "email": "guest@example.com", "name": "John Doe", "phone": "999999999", "phone_country_code": "+65", "description": "Its my first payment request", "authentication_type": "no_three_ds", "return_url": "https://duck.com", "payment_method": "card", "payment_method_type": "debit", "payment_method_data": { "card": { "card_number": "4242424242424242", "card_exp_month": "10", "card_exp_year": "25", "card_holder_name": "joseph Doe", "card_cvc": "123" } }, "setup_future_usage": "off_session", "mandate_data": { "customer_acceptance": { "acceptance_type": "offline", "accepted_at": "1963-05-03T04:07:52.723Z", "online": { "ip_address": "127.0.0.1", "user_agent": "amet irure esse" } }, "mandate_type": { "single_use": { "amount": 8000, "currency": "USD" } } }, "payment_type":"new_mandate", "billing": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "john", "last_name": "Doe" } }, "shipping": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "john", "last_name": "Doe" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" }, "browser_info": { "ip_address": "129.0.0.1", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", "language": "en-US", "color_depth": 30, "screen_height": 1117, "screen_width": 1728, "time_zone": -330, "java_enabled": true, "java_script_enabled": true } }'

recur
curl --location 'http://localhost:8080/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: dev_uU1CMrJwVpVNLZsX1l02Oguxxi3JI0iT8b9BQBizGDDwxNJ8asfhRwZWrNJUFdeW' \ --data ' { "amount": 999, "currency": "USD", "confirm": true, "customer_id" : "customer0977", "return_url": "https://google.com", "payment_method":"card", "recurring_details": { "type": "mandate_id", "data": "man_9oDWRDlfip0f6lBNSGxo" }, "off_session": true }'

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
  • I added a CHANGELOG entry if applicable

@akshay-97 akshay-97 requested a review from a team as a code owner April 17, 2024 12:12
@akshay-97 akshay-97 self-assigned this Apr 17, 2024
@akshay-97 akshay-97 changed the title relax reverse lookup mandate fix: relax reverse lookup mandate Apr 17, 2024
@akshay-97 akshay-97 force-pushed the relax_reverse_lookup_mandate branch from 4fa427b to ac8c9c9 Compare April 17, 2024 13:02
@akshay-97 akshay-97 changed the title fix: relax reverse lookup mandate fix: conditionally add reverse lookup in update mandate Apr 18, 2024
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.

None yet

2 participants