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

refactor(connector): [Gocardless] Mask PII data #3844

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

AkshayaFoiger
Copy link
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Mask pii information passed and received in the connector request and response for Gocardless.

Test Case

  1. Create a payment intent with Gocardless
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{}}' \
--data-raw '{
    "amount": 0,
    "order_details": null,
    "currency": "USD",
    "confirm": false,
    "capture_method": "automatic",
    "authentication_type": "three_ds",
    "customer_id": "arjun",
    "email": "[email protected]",
    "description": "Hello this is description",
    "shipping": {
        "address": {
            "state": "zsaasdas",
            "city": "Banglore",
            "country": "US",
            "line1": "sdsdfsdf",
            "line2": "hsgdbhd",
            "line3": "alsksoe",
            "zip": "571201",
            "first_name": "joseph",
            "last_name": "doe"
        },
        "phone": {
            "number": "123456789",
            "country_code": "+1"
        }
    },
    "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"
        }
    },
    "metadata": {},
    "setup_future_usage": "off_session",
    "mandate_data": {
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD"
            }
        }
    }
}'

2.Confirm the mandate payment

curl --location 'http://localhost:8080/payments/pay_FXMSggPlgoGMg9r6AlpY/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_BRdlOJtJTl8WPK503hzNIbM8mTJC7Ayp1D4tiMyP9JzUXTEvR1N65YLI4uy7C2w2' \
--data-raw '{
   
   "return_url": "http://localhost:9060/completion",
   "payment_method": "bank_debit",
   "setup_future_usage": "off_session",
   "payment_method_type": "ach",
   "payment_type": "setup_mandate",
   "payment_method_data": {
       "bank_debit": {
           "ach_bank_debit": {
               "billing_details": {
                   "name": "Shivam S",
                   "email": "[email protected]",
                   "address": {
                       "line1": "123",
                       "line2": "123",
                       "city": "vjnsf",
                       "state": "Alaska",
                       "zip": "10001",
                       "country": "US"
                   }
               },
               "account_number": "27155003358",
               "bank_account_holder_name": "tests tests",
               "routing_number": "026073150",
               "bank_type": "checking"
           }
       }
   },
   "mandate_data": {
       "customer_acceptance": {
           "acceptance_type": "online",
           "accepted_at": "2023-12-07T12:16:08.622Z",
           "online": {
               "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
           }
       }
   },
   "browser_info": {
       "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
       "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8",
       "language": "en-GB",
       "color_depth": 24,
       "screen_height": 1440,
       "screen_width": 2560,
       "time_zone": -330,
       "java_enabled": true,
       "java_script_enabled": true,
       "ip_address": "0.0.0.0"
   }
}'
  1. Check if all the sensitive data in the masked_response is masked
curl --location '{{base_url}}/analytics/v1/connector_event_logs?type=Payment&payment_id={{payment_id}}' \
--header 'sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'authorization: Bearer JWT_token' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' \
--header 'Content-Type: application/json' \
--header 'Referer: https://integ.hyperswitch.io/' \
--header 'api-key: {{api-key}}' \
--header 'sec-ch-ua-platform: "macOS"'

Response should contain:

"masked_response\":\"{\\\"mandates\\\":{\\\"id\\\":\\\"*** alloc::string::String ***\\\"}}

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
  • I added a CHANGELOG entry if applicable

@AkshayaFoiger AkshayaFoiger requested a review from a team as a code owner February 27, 2024 10:00
@AkshayaFoiger AkshayaFoiger self-assigned this Feb 27, 2024
@AkshayaFoiger AkshayaFoiger added A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration C-refactor Category: Refactor labels Feb 27, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Feb 28, 2024
Merged via the queue into main with commit 2f3ec7f Feb 28, 2024
10 of 12 checks passed
@Gnanasundari24 Gnanasundari24 deleted the connector-data-masking/gocardless branch February 28, 2024 13:31
pixincreate added a commit that referenced this pull request Feb 29, 2024
…stman-runner

* 'main' of github.com:juspay/hyperswitch:
  chore(version): 2024.02.29.0
  chore(postman): update Postman collection files
  feat(analytics): add force retrieve call for force retrieve calls (#3565)
  refactor(connector): [Mollie] Mask PII data  (#3856)
  refactor(connector): [Gocardless] Mask PII data (#3844)
  feat(analytics): adding metric api for dispute analytics (#3810)
  feat(payment_methods): Add default payment method column in customers table and last used column in payment_methods table (#3790)
  fix(tests/postman/adyen): enable sepa payment method type for payout flows (#3861)
  feat(payouts): Implement Smart Retries for Payout (#3580)
  refactor(payment_link): add Miscellaneous charges in cart (#3645)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] : [Gocardless] mask pii information in connector request and response
4 participants