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(core): Address clippy config changes #2654

Merged
merged 3 commits into from
Oct 25, 2023
Merged

fix(core): Address clippy config changes #2654

merged 3 commits into from
Oct 25, 2023

Conversation

pixincreate
Copy link
Member

@pixincreate pixincreate commented Oct 20, 2023

Type of Change

  • Refactoring

Description

Clippy was bugging me about this for a long time. This is a config change.

Motivation and Context

Just addressed clippy changes and nothing else.

How did you test it?

Compiler guided.
I doubted it might have affected tokenization flow, so I did test that:
Created a payment:

{
    "payment_id": "pay_4GsfqChjN8IsIMhudqCH",
    "merchant_id": "postman_merchant_GHAction_463458a7-2e38-47b9-b8cb-0b77bfb8e1b0",
    "status": "succeeded",
    "amount": 6540,
    "amount_capturable": 0,
    "amount_received": 6540,
    "connector": "stripe",
    "client_secret": "pay_4GsfqChjN8IsIMhudqCH_secret_WGfdnMZEcSyfKdPXjrCm",
    "created": "2023-10-20T11:21:39.968Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe"
        }
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1697800899,
        "expires": 1697804499,
        "secret": "epk_48279a02b163423f97c6d794077445cd"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3O3GlsD5R7gDAGff1iO9sYFV",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3O3GlsD5R7gDAGff1iO9sYFV",
    "payment_link": null,
    "profile_id": "pro_008sHASNrxA5zw1JAXWz",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null
}

Listed payment methods for a customer:

{
    "customer_payment_methods": [
        {
            "payment_token": "token_NFcpouwzergIRk3CRVsY",
            "customer_id": "StripeCustomer",
            "payment_method": "card",
            "payment_method_type": "credit",
            "payment_method_issuer": null,
            "payment_method_issuer_code": null,
            "recurring_enabled": false,
            "installment_payment_enabled": false,
            "payment_experience": [
                "redirect_to_url"
            ],
            "card": {
                "scheme": null,
                "issuer_country": null,
                "last4_digits": "4242",
                "expiry_month": "10",
                "expiry_year": "25",
                "card_token": null,
                "card_holder_name": "joseph Doe",
                "card_fingerprint": null,
                "nick_name": null
            },
            "metadata": null,
            "created": "2023-10-20T11:13:48.327Z",
            "bank_transfer": null,
            "requires_cvv": true
        }
    ]
}

Did a payment with the token:

curl --location 'http://Localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_XJBnXFPjfvSo8CFhtoOI8rJchOSmp4AFUvvthmdFYP3tfbLY8WX8Bvl8bG4h0xIj' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "StripeCustomer",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_token": "token_NFcpouwzergIRk3CRVsY",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "routing": {
        "type": "single",
        "data": "stripe"
    }
}'
{
    "payment_id": "pay_Zp3ss946GZJOfMLDFFtS",
    "merchant_id": "postman_merchant_GHAction_463458a7-2e38-47b9-b8cb-0b77bfb8e1b0",
    "status": "succeeded",
    "amount": 6540,
    "amount_capturable": 0,
    "amount_received": 6540,
    "connector": "stripe",
    "client_secret": "pay_Zp3ss946GZJOfMLDFFtS_secret_WTDWZYGZddeiONhDqLSz",
    "created": "2023-10-20T11:23:29.958Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe"
        }
    },
    "payment_token": "token_NFcpouwzergIRk3CRVsY",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1697801009,
        "expires": 1697804609,
        "secret": "epk_75289307094941aea31902457332dc7d"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3O3GneD5R7gDAGff1AQj63jz",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3O3GneD5R7gDAGff1AQj63jz",
    "payment_link": null,
    "profile_id": "pro_008sHASNrxA5zw1JAXWz",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null
}

Did a refund:

{
    "refund_id": "ref_3d2HNld1qJLEEdny1D33",
    "payment_id": "pay_Zp3ss946GZJOfMLDFFtS",
    "amount": 600,
    "currency": "USD",
    "reason": "Customer returned product",
    "status": "pending",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "created_at": "2023-10-20T11:25:48.884Z",
    "updated_at": "2023-10-20T11:25:48.884Z",
    "connector": "stripe",
    "profile_id": "pro_008sHASNrxA5zw1JAXWz"
}

DB:
image
image

TL;DR: A sanity test would be more than enough!

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@pixincreate pixincreate added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor labels Oct 20, 2023
@pixincreate pixincreate added this to the October 2023 Milestone milestone Oct 20, 2023
@pixincreate pixincreate self-assigned this Oct 20, 2023
@pixincreate pixincreate requested review from a team as code owners October 20, 2023 11:29
SanchithHegde
SanchithHegde previously approved these changes Oct 22, 2023
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

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

What command caused these warnings though? I'm assuming cargo clippy with no extra arguments?

@pixincreate
Copy link
Member Author

Yes

@pixincreate pixincreate added the S-needs-conflict-resolution Status: This PR needs conflicts to be resolved by the author label Oct 25, 2023
@pixincreate pixincreate removed the S-needs-conflict-resolution Status: This PR needs conflicts to be resolved by the author label Oct 25, 2023
@SanchithHegde SanchithHegde added this pull request to the merge queue Oct 25, 2023
Merged via the queue into main with commit cfe9c25 Oct 25, 2023
@SanchithHegde SanchithHegde deleted the fix-clippy branch October 25, 2023 09:48
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Oct 25, 2023
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.

3 participants