juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
12.19k stars 1.3k forks source link

[PLUGIN] - WooCommerce - Refactor Code for Clarity #6172

Open sakksham7 opened 1 week ago

sakksham7 commented 1 week ago

The WooCommerce-Payments-Plugin connect with multiple payment processors with a single API to improve payment conversions, reduce costs and ops. It supports multiple currencies, offers fraud protection, and provides an easy-to-use dashboard for managing transactions and tracking sales.

Getting started

  1. Get familiar with Php and Javascript.
  2. Check the README.md for project structure and setup instructions.
  3. To setup locally, follow the steps provided here

Description:

You are provided with a code snippet that performs a specific function. Your task is to refactor the code to improve its readability, performance, and maintainability. Consider applying best practices such as input validation, descriptive variable naming, reducing complexity, and handling edge cases. The goal is to make the code more efficient, cleaner, and easier to understand while maintaining its core functionality.

Code Snippet -

This provided code snippet is a part of WooCommerce-Plugin.

function colorStringToHex(colorString) {
  if (colorString.startsWith("rgb(")) {
    const values = colorString
      .substring(4, colorString.length - 1)
      .split(",")
      .map((val) => parseInt(val));
    return rgbToHex(values[0], values[1], values[2]);
  } else if (colorString.startsWith("rgba(")) {
    const values = colorString
      .substring(5, colorString.length - 1)
      .split(",")
      .map((val) => parseFloat(val));
    return rgbaToHex(values[0], values[1], values[2], values[3]);
  } else if (colorString.startsWith("#")) {
    return hexToHex(colorString);
  } else {
    throw new Error("Invalid color string");
  }
}

Contribution Guidelines:


Helpful Resources:

Submission Process:

Refer here for Terms and conditions for the contest.

If you have any questions or need help getting started, feel free to ask in the comments!

TheMarvelFan commented 1 week ago

Hi, is anyone working on this issue? If not, I would like to take it up.

AviGawande commented 1 week ago

hello @sakksham7 i want to contribute to this fix this issue,could you please assign me this issue.

aashish-1904 commented 1 week ago

hello @sakksham7, I'd like to work on this issue

SlaydeSequeira commented 1 week ago

i am interested in contributing to this issue.

gorakhnathy7 commented 1 week ago

Hey All, Thanks for your interest. Assigning this issue to @TheMarvelFan to maintain fairness(first come first serve) Kindly pick issues from here

TheMarvelFan commented 1 week ago

Hi @gorakhnathy7 ,

Thanks for assigning this issue to me. I have created a PR that resolves it. Please review the changes and let me know if any modifications are required.

Thanks!

gorakhnathy7 commented 1 week ago

Hey @TheMarvelFan Thanks for your effort, can you please link the issue and PR.

TheMarvelFan commented 1 week ago

Hi @gorakhnathy7 ,

I have linked the PR with this issue

gorakhnathy7 commented 1 week ago

Thanks, it will be reviewed soon.