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

Change merchant category code type #245

Merged
merged 1 commit into from
Aug 23, 2024
Merged

Change merchant category code type #245

merged 1 commit into from
Aug 23, 2024

Conversation

stevecl5
Copy link
Contributor

@stevecl5 stevecl5 commented Aug 21, 2024

Summary of Changes

Changes the type of the merchantCategoryCode transaction field from String to Integer. The MCC is defined as a 4-digit number and is handled as an integer in multiple MX APIs (e.g. Platform, Nexus, Atrium) and backend services (e.g. Abacus, Sherlock).

Jira Issue

Public API Additions/Changes

In the Transaction model, the merchantCategoryCode field is now an Integer. When serialized to JSON, it will appear as a number rather than a string.

setMerchantCategoryCode(String merchantCategoryCode) is deprecated in favor of setMerchantCategoryCode(Integer merchantCategoryCode).

Downstream Consumer Impact

Going forward, accessors that populate the merchantCategoryCode field should pass the MCC as an integer to setMerchantCategoryCode. If the MCC is a String in the upstream DTO (data transfer object), it should be parsed as an Integer before assigning it to the MDX transaction.

For existing implementations, a deprecated setter that accepts a string as input is also provided in order to make this a non-breaking change. This setter will convert the input string to an integer before assigning it to merchantCategoryCode and will throw a NumberFormattingException if the string does not contain a parseable integer.

How Has This Been Tested?

I pulled a snapshot version of the changes into Ultraman to verify the new functionality. I was able to successfully use all getters and setters for merchantCategoryCode and verified that the field was serialized correctly.

Example request:

curl -X GET --location "http://localhost:3009/globalcu/users/U-00ue71zj2gXpZxcdE1d7/accounts/A-1852824-V-KRzycdxB/transactions?status=PENDING" \
    -H "Accept: application/vnd.mx.mdx.v6+json" \
    -H "Content-Type: application/vnd.mx.mdx.v6+json" \
    -H "MX-SESSION-KEY: 2f0221de-f3b3-4c76-87a3-5dbdc6e0ffa1"

Example response:

HTTP/1.1 200 
Content-Type: application/vnd.mx.mdx.v6+json;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 22 Aug 2024 20:13:32 GMT

{
  "transactions": [
    {
      "amount": 12.53,
      "description": "TBE*BRADFORD AUT",
      "id": "T-CC-19920101000000002693",
      "merchant_category_code": 5411,
      "status": "PENDING",
      "transacted_on": "1992-01-01",
      "type": "DEBIT",
      "user_id": "U-00ue71zj2gXpZxcdE1d7"
    },
    {
      "amount": 102.99,
      "description": "MACY'S EAST #649",
      "id": "T-CC-20221115000000004252",
      "merchant_category_code": 5411,
      "status": "PENDING",
      "transacted_on": "2022-11-15",
      "type": "CREDIT",
      "user_id": "U-00ue71zj2gXpZxcdE1d7"
    }
  ]
}

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@stevecl5 stevecl5 merged commit 03f53e3 into master Aug 23, 2024
4 checks passed
@stevecl5 stevecl5 deleted the scl/mcc-type branch August 23, 2024 15:51
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.

2 participants