Skip to content

Conversation

prajjwalkumar17
Copy link
Member

@prajjwalkumar17 prajjwalkumar17 commented Jul 9, 2024

Type of Change

  • Refactoring

Description

Made create_encrypted_data to accept T and refactored the previous function into create_encrypted_data_optional, which takes Option<T>. This also improves the error propogation of this function.

Additional Changes

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

Motivation and Context

How did you test it?

Payment create request with some random cus_id and name

Response should be populated like this

"customer_id": "id_12343",
"customer": {
    "id": null,
    "name": "Light",
    "email": null,
    "phone": null,
    "phone_country_code": null
},
curl --location 'http://127.0.0.1:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:xxxxx' \
--data-raw '
{
    "amount": 6540,
    "currency": "USD",
    "confirm": false,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
   "customer_id": "id_12343",
    "name": "Light",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "setup_future_usage": "on_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
'

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

@prajjwalkumar17 prajjwalkumar17 added A-core Area: Core flows C-refactor Category: Refactor labels Jul 9, 2024
@prajjwalkumar17 prajjwalkumar17 added this to the July 2024 Release milestone Jul 9, 2024
@prajjwalkumar17 prajjwalkumar17 self-assigned this Jul 9, 2024
@prajjwalkumar17 prajjwalkumar17 requested a review from a team as a code owner July 9, 2024 08:59
@prajjwalkumar17 prajjwalkumar17 linked an issue Jul 9, 2024 that may be closed by this pull request
2 tasks
Narayanbhat166
Narayanbhat166 previously approved these changes Jul 12, 2024
@prajjwalkumar17 prajjwalkumar17 requested a review from jarnura July 12, 2024 05:20
jarnura
jarnura previously approved these changes Jul 12, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 12, 2024
Merged via the queue into main with commit 6ee1cad Jul 12, 2024
@likhinbopanna likhinbopanna deleted the refactor/create_encrypted_data branch July 12, 2024 13:25
pixincreate added a commit that referenced this pull request Jul 16, 2024
* 'main' of github.com:juspay/hyperswitch: (25 commits)
  fix(logs): ignore request headers while logging (#5273)
  feat(webhooks): add support for custom outgoing webhook http headers (#5275)
  fix(payment_methods): set `requires_cvv` to false when either `connector_mandate_details` or `network_transaction_id` is present during MITs (#5331)
  chore: create justfile for running commands for v1 and v2 migrations (#5325)
  fix(routing): do not update `perform_session_flow_routing` output if the `SessionRoutingChoice` is none (#5336)
  fix(database): modified_at updated for every state change for Payment Attempts (#5312)
  feat(mca): Added recipient connector call for open banking connectors (#3758)
  chore(version): 2024.07.16.0
  refactor(connector): [Mifinity] add a field language_preference in payment request for mifinity payment method data (#5326)
  fix(router): store `customer_acceptance` in payment_attempt, use it in confirm flow for delayed authorizations like external 3ds flow (#5308)
  feat(proxy): add support to pass proxy bypass urls from configs (#5322)
  Docs: Updating Error codes in API-ref (#5296)
  feat(core): [Payouts] Add retrieve flow for payouts (#4936)
  fix(connector): [AUTHORIZEDOTNET] Populate error reason for failure transactions (#5319)
  chore(version): 2024.07.15.0
  feat(logging): Emit a setup error when a restricted keys are used for logging default keys (#5185)
  feat(payment_methods): add support to migrate existing customer PMs from processor to hyperswitch (#5306)
  feat(connector): [DATATRANS] Implement card payments (#5028)
  chore: making of function create_encrypted_data (#5251)
  fix(payments): populate merchant order ref id in list (#5310)
  ...
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-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR]: Removal of create_encrypted_data_optional function
5 participants