Skip to content

Conversation

@dracarys18
Copy link
Contributor

Type of Change

  • Enhancement

Description

Add updated_by column to tracker tables.

Additional Changes

  • This PR modifies the database schema

Motivation and Context

Added updated_by to tracker tables to track if it was updated/created directly in DB or through drainer.

How did you test it?

  • Did a sanity test on Payment, Refund
  • Enable KV for a merchant
curl --location 'http://localhost:8080/accounts/mer_1697458132/kv' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "kv_enabled": true
}'
  • Make a payment
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_JaDYQ6HiSY9LghcTpX0xeawIdbLzuwICpZhOsBeXWfzpW2SE5o6tcFbEfzBMd8f6' \
--data-raw '{
    "amount": 600,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "HScustomer1234",
    "email": "[email protected]",
    "amount_to_capture": 600,
    "description": "Its my first payment request",
    "capture_on": "2022-09-10T10:11:12Z",
    "return_url": "https://google.com",
    "name": "Preetam",
    "phone": "999999999",
    "setup_future_usage": "off_session",
    "phone_country_code": "+65",
    "authentication_type": "no_three_ds",
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "01",
            "card_exp_year": "2026",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "connector_metadata": {
        "noon": {
            "order_category": "applepay"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "preetam",
            "last_name": "revankar"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
  • Run SELECT updated_by for payment_intent where payment_id=<payment_id>
Screenshot 2023-10-16 at 8 44 01 PM
  • Disable KV for merchant
curl --location 'http://localhost:8080/accounts/mer_1697458132/kv' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "kv_enabled": false
}'
  • Run SELECT updated_by for payment_intent where payment_id=<payment_id>
Screenshot 2023-10-16 at 8 51 12 PM

Checklist

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

@dracarys18 dracarys18 added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Oct 16, 2023
@dracarys18 dracarys18 self-assigned this Oct 16, 2023
@dracarys18 dracarys18 requested review from a team as code owners October 16, 2023 15:22
@dracarys18 dracarys18 changed the title feat: add updated_by to tracker table feat: add updated_by to tracker tables Oct 16, 2023
@dracarys18 dracarys18 added this to the October 2023 Milestone milestone Oct 17, 2023
@jarnura jarnura enabled auto-merge October 17, 2023 11:08
@jarnura jarnura added this pull request to the merge queue Oct 17, 2023
Merged via the queue into main with commit 6a74e8c Oct 17, 2023
@jarnura jarnura deleted the add_updated_by_to_trackers branch October 17, 2023 11:36
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-core Area: Core flows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants