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

Illiar/fix/mastercard plugin data structure #2668

Merged
merged 3 commits into from
Sep 2, 2024

Conversation

alonp99
Copy link
Collaborator

@alonp99 alonp99 commented Sep 2, 2024

Summary by CodeRabbit

  • New Features

    • The vendor field in the Merchant Screening Plugin schema is now optional, allowing for more flexible data input.
  • Improvements

    • Streamlined address information extraction in the Mastercard Merchant Screening Plugin for better clarity and reduced error risk.
    • Improved organization of import statements across various plugins for better code maintainability.

Copy link

changeset-bot bot commented Sep 2, 2024

⚠️ No Changeset found

Latest commit: 9051dbe

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Sep 2, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes involve modifications to the TypeScript schema and plugin files, focusing on the MerchantScreeningPluginSchema, ApiPlugin, and MastercardMerchantScreeningPlugin. Key updates include making the vendor field optional, reorganizing import statements, changing how HTTP methods are referenced, and simplifying address extraction in the invoke method. These updates enhance clarity and maintainability across the affected components.

Changes

File Path Change Summary
packages/common/src/schemas/documents/... The vendor field in MerchantScreeningPluginSchema was changed from a required literal type to an optional field, allowing for more flexible data inputs. Import statements were also reordered.
packages/workflow-core/src/lib/plugins/external-plugin/... In the ApiPlugin class, import statements were reorganized. The reference to the HTTP method was changed from this.method to a local variable method, which may affect its scope and context.
packages/workflow-core/src/lib/plugins/external-plugin/... The invoke method in MastercardMerchantScreeningPlugin was refactored to simplify address extraction from entity.data.address, improving code clarity. Import statements were also reordered.

Sequence Diagram(s)

sequenceDiagram
    participant A as Client
    participant B as ApiPlugin
    participant C as MastercardMerchantScreeningPlugin

    A->>B: Send request
    B->>C: Invoke plugin with context
    C->>C: Set HTTP method to 'POST'
    C->>C: Extract address from entity
    C-->>B: Return response
    B-->>A: Send response back
Loading

🐇 "Oh, what a change, so bright and new,
The vendor's now optional, it's true!
With imports all tidy, and methods refined,
The code leaps and dances, oh how it’s aligned!
Address extraction is simple, oh what a delight,
In this world of plugins, everything feels right!" 🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
Early access features: disabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
packages/workflow-core/src/lib/plugins/external-plugin/api-plugin.ts (1)

152-159: Potential issue with method variable usage.

The change from this.method to method in the code may lead to issues if the method variable is not properly defined or assigned within the local scope. Please ensure that the method variable is correctly initialized before use in the updated code.

  • Check the assignment of the method variable in packages/workflow-core/src/lib/plugins/external-plugin/api-plugin.ts.
Analysis chain

Verify the usage of the method variable.

The change from this.method to method may introduce differences in scope or context. Please ensure that the method variable is correctly defined and assigned in the context where it is used.

Run the following script to verify the usage of the method variable:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition and assignment of the `method` variable.

# Test: Search for the definition and assignment of the `method` variable. Expect: The variable is correctly defined and assigned.
rg --type typescript -A 5 $'method\s*='

Length of output: 75


Script:

#!/bin/bash
# Description: Verify the definition and assignment of the `method` variable.

# Test: Search for the definition and assignment of the `method` variable. Expect: The variable is correctly defined and assigned.
rg -A 5 'method\s*='

Length of output: 4183

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 040e685 and 896efff.

Files selected for processing (3)
  • packages/common/src/schemas/documents/merchant-screening-plugin-schema.ts (2 hunks)
  • packages/workflow-core/src/lib/plugins/external-plugin/api-plugin.ts (2 hunks)
  • packages/workflow-core/src/lib/plugins/external-plugin/mastercard-merchant-screening-plugin.ts (2 hunks)
Additional comments not posted (4)
packages/workflow-core/src/lib/plugins/external-plugin/mastercard-merchant-screening-plugin.ts (2)

12-15: LGTM!

The code changes are approved. Explicitly setting the HTTP method to 'POST' in the constructor enhances clarity and ensures consistency in the plugin's operations.


42-49: LGTM, but verify the assumption about the address structure.

The code changes are approved. The refactor streamlines the code and aligns the data extraction with a more straightforward structure, potentially reducing the risk of errors related to undefined properties.

However, please verify the assumption that the entity.data.address structure is always present and contains the required fields. If this assumption is not always true, it could lead to runtime errors.

Run the following script to verify the assumption:

packages/workflow-core/src/lib/plugins/external-plugin/api-plugin.ts (1)

3-4: LGTM!

The reordering of import statements improves the organization of the file without affecting the functionality.

packages/common/src/schemas/documents/merchant-screening-plugin-schema.ts (1)

441-441: LGTM!

The code changes are approved.

Verify the impact of this change on the codebase by running the following script:

@alonp99 alonp99 merged commit e154494 into dev Sep 2, 2024
9 checks passed
@alonp99 alonp99 deleted the illiar/fix/mastercard-plugin-data-structure branch September 2, 2024 18:22
Omri-Levy added a commit that referenced this pull request Sep 2, 2024
* fix: custom rule (#2626)

* WIP - Move report components to common packages (#2625)

* feat(*): checkpoint

* feat(*): checkpoint

* fix(*): fixed mistakes in pr

* fix(*): fixed sentry version

* feat(*): updated common and ui

* Update packages version (#2628)

* feat(*): checkpoint

* feat(*): checkpoint

* fix(*): fixed mistakes in pr

* fix(*): fixed sentry version

* feat(*): updated common and ui

* chore(*): update changeset version

* chore(*): updated all packages

* chore: reverting the condition to run release action before publish work-flow service (#2629)

Co-authored-by: Chirag Sharma IAMOPS <chirag.sharma@billrun.com>

* fix(ui): fixed filtering of boolean fields (#2630)

* Fix boolean fields (#2631)

* fix(ui): fixed filtering of boolean fields

* revert(*): reverted adapter change

* revert(*): reverted adapter change

* Fix boolean fields (#2632)

* fix(ui): fixed filtering of boolean fields

* revert(*): reverted adapter change

* revert(*): reverted adapter change

* fix(*): boolean fields

* feat(*): update backoffice

* revert(backoffice-v2): reverted mock

* fix: adds missing env in docker compose files (#2633)

Co-authored-by: Rituraj <rituraj@Riturajs-MBP.lan>

* fix(docs): dead links

* fix(docs): webhook section

* fix(docs): webhook section

* refactor(backoffice-v2): improved readability on condition (#2638)

* fix(*): added a wait step for workflows service db (#2639)

* Replaced pagination component (#2642)

* feat(backoffice-v2): replaced pagination component and added last page button

* revert(backoffice-v2): removed unused isEmptyArray util

* fix(backoffice-v2): removed sleep added by mistake

* fix(docs): fixed path to md file and in-progress page content (#2640)

* feat(*): added merchant screening plugin to swagger (#2647)

* feat(docs): added webhook auth

* feat(docs): added webhook auth

* chore(docs): adding programming languages tabs, more examples to hmac signature verification (#2648)

* Illiar/feat/tag input and fixes (#2646)

* feat: added default values to array input & fixed render

* feat: added tags input

* fix: bugfixes

* feat: reworked tag input

* feat: implemented value apply plugin & cleanup

* fix: added ballerine entity id assignment

* fixed child workflows handling (#2651)

* fix(*): fixed child workflow handling

* refactor(workflow-runner): updated log text

* fix: migration

---------

Co-authored-by: Illia Rudniev <cheskmr@gmail.com>

* fix: fixed type

* feat: refactor

* fix: added raio input to fix styles & ui bump

* fix: refactor

* fix: refactor

* fix: lock fix

* feat: tags input add on blur update

* fix(kyb-app): tags input now displays placeholder (#2654)

---------

Co-authored-by: Omri Levy <61207713+Omri-Levy@users.noreply.github.com>

* Added merchant screening (#2649)

* feat(backoffice-v2): replaced pagination component and added last page button

* revert(backoffice-v2): removed unused isEmptyArray util

* fix(backoffice-v2): removed sleep added by mistake

* feat(*): moved merchant screening processing to the unified api

* feat(*): updated packages

* refactor(*): removed empty file

* refactor(workflow-core): updated merchant screening plugin

* chore(*): addressed pr comments

* bal 2663 fix transaction monitoring alert (#2653)

* fix(ui): changed tsconfig (#2655)

* Dev 318/workflow on demand migration (#2637)

* Added merchant screening to proccess tracker (#2657)

* feat(backoffice-v2): replaced pagination component and added last page button

* revert(backoffice-v2): removed unused isEmptyArray util

* fix(backoffice-v2): removed sleep added by mistake

* feat(*): moved merchant screening processing to the unified api

* feat(*): updated packages

* refactor(*): removed empty file

* refactor(workflow-core): updated merchant screening plugin

* chore(*): addressed pr comments

* feat(backoffice-v2): added merchant screening to proccess tracker

* Feature/create multi merchant csv import (#2652)

* feat: created the endpoint and functionality to create business reports as batch in a csv

* feat: added batch processing logic functionaltiy

* feat: fixed controller swagger

* updated the parse csv logic - upload file do  not work

* feat: finalized functionality of batch processing

* feat: test

* feat: tests fix

* feat: added withQualityControl to Batch reports Unified-API call

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* feat(*): update report ui (#2660)

* fix(wf-def): disallow template editing (#2661)

* Added local only secrets (#2663)

* feat(*): added local only secrets

* refactor(workflows-service): renamed secrets variable

* Batch report upload (#2662)

* feat: batch report upload

* feat: pr comments fixes

* feat: pr comments fixes

* feat: pr comment fix

* feat: conflict fix

* fix(*): schema, optionals, and super on method (#2665)

* fix(*): in memories (#2666)

* fix(*): plugin headers (#2667)

* Illiar/fix/mastercard plugin data structure (#2668)

* fix: updated schema & changed address source

* fix: fixed data structure and method bug

---------

Co-authored-by: Illia Rudniev <cheskmr@gmail.com>

* fix(mm): change ongoing montoring sttings to optional

* version bump

* version bump

* version bump

* version bump

---------

Co-authored-by: liorzam <6435752+liorzam@users.noreply.github.com>
Co-authored-by: Chirag <134513193+codechirag123@users.noreply.github.com>
Co-authored-by: Chirag Sharma IAMOPS <chirag.sharma@billrun.com>
Co-authored-by: riturajgc <65999719+riturajgc@users.noreply.github.com>
Co-authored-by: Rituraj <rituraj@Riturajs-MBP.lan>
Co-authored-by: Alon Peretz <8467965+alonp99@users.noreply.github.com>
Co-authored-by: Illia Rudniev <cheskmr@gmail.com>
Co-authored-by: Daniel Blokh <35891501+Blokh@users.noreply.github.com>
Co-authored-by: Tomer Shvadron <tomers@ballerine.com>
@Omri-Levy Omri-Levy mentioned this pull request Nov 4, 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.

3 participants