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(recon): make recon status optional in merchant account #4654

Merged
merged 8 commits into from
May 16, 2024

Conversation

srujanchikke
Copy link
Contributor

@srujanchikke srujanchikke commented May 15, 2024

Type of Change

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

Description

Previously when merchant account is updated recon status is updating to not_requested. This PR makes recon status optional field in merchant_update_internal so that even if we use default it will not update to not_requested.

Additional Changes

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

Motivation and Context

Default value of recon status is not_requested. When we try to call merchant_update, it will update the recon status to not_requested every time. So to remove this default implementation make recon status optional, so it won't get updated every time we update merchant_account.

Steps to recreate this bug :

  1. Create merchant_account
  2. Update the recon status to active by calling /recon_update
  3. call merchant_account_update - recon status will be updated to not_requested

How did you test it?

Using Postman(yet to be added).

Test case 1 :
create merchant account :

{
    "merchant_id": "merchant_{{$timestamp}}",
    "locker_id": "m0010",
    "merchant_name": "NewAge Retailer",
    "merchant_details": {
        "primary_contact_person": "John Test",
        "primary_email": "JohnTest@test.com",
        "primary_phone": "sunt laborum",
        "secondary_contact_person": "John Test2",
        "secondary_email": "JohnTest2@test.com",
        "secondary_phone": "cillum do dolor id",
        "website": "www.example.com",
        "about_business": "Online Retail with a wide selection of organic products for North America",
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "IN"
        }
    },
    "return_url": "https://google.com/success",
    "webhook_details": {
        "webhook_url": "https://enz8u459xx5j.x.pipedream.net/",
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "metadata": {
        "account_name": "transaction_processing",
        "city": "NY",
        "unit": "245"
    },
    "primary_business_details": [
        {
            "country": "IN",
            "business": "default"
        }
    ]
}
  1. update recon status :
curl --location --request POST '{{baseUrl}}/recon/update_merchant' \
--header 'api-key: RECON_ADMIN_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "merchant_id": "{{merchant_id}}",
    "user_email": "chikke.srujan@juspay.in",
    "is_recon_enabled": true,
    "recon_status": "active"
}'
  1. update merchant account :
curl --location --request POST '{{baseUlr}}/accounts/merchant_1715783699' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:ADMIN_API_KEY' \
--data-raw '{
    "merchant_id": "{{mechant_id}}",
    "locker_id": "m0010",
    "merchant_name": "NewAge Retailer"
}'

response :

{
    "merchant_id": "merchant_1715783699",
    "merchant_name": "NewAge Retailer",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "ghoA12wBwXcE30TLhIp3u0WQEBobdEHKnHCHSmeJdLbAiyf8upORCzW3RqYtS207",
    "redirect_to_merchant_with_http_post": false,
    "merchant_details": {
        "primary_contact_person": "John Test",
        "primary_phone": "sunt laborum",
        "primary_email": "JohnTest@test.com",
        "secondary_contact_person": "John Test2",
        "secondary_phone": "cillum do dolor id",
        "secondary_email": "JohnTest2@test.com",
        "website": "www.example.com",
        "about_business": "Online Retail with a wide selection of organic products for North America",
        "address": {
            "city": "San Fransico",
            "country": "IN",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": null,
            "last_name": null
        }
    },
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://enz8u459xx5j.x.pipedream.net/",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "payout_routing_algorithm": null,
    "sub_merchants_enabled": false,
    "parent_merchant_id": null,
    "publishable_key": "pk_dev_6db53c7f3700486984cbb503cd69cd40",
    "metadata": {
        "city": "NY",
        "unit": "245",
        "account_name": "transaction_processing",
        "compatible_connector": null
    },
    "locker_id": "m0010",
    "primary_business_details": [
        {
            "country": "IN",
            "business": "default"
        }
    ],
    "frm_routing_algorithm": null,
    "intent_fulfillment_time": null,
    "organization_id": "org_RRXxcvElvtCfRfqNJiOD",
    "is_recon_enabled": false,
    "default_profile": "pro_aHVsXf2QlL0L01oZMrds",
    "recon_status": "active"
}

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

@srujanchikke srujanchikke added A-core Area: Core flows C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels May 15, 2024
@srujanchikke srujanchikke self-assigned this May 15, 2024
@srujanchikke srujanchikke requested review from a team as code owners May 15, 2024 14:34
@srujanchikke srujanchikke changed the title fix(Recon): make recon status optional in merchant account fix(recon): make recon status optional in merchant account May 15, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue May 16, 2024
Merged via the queue into main with commit 84cb2bc May 16, 2024
10 checks passed
@likhinbopanna likhinbopanna deleted the recon_update branch May 16, 2024 14:16
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label May 19, 2024
kashif-m pushed a commit that referenced this pull request May 20, 2024
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
A-core Area: Core flows C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants