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): make the original_authorized_amount optional for MITs with connector_mandate_details #5311

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

ShankarSinghC
Copy link
Contributor

@ShankarSinghC ShankarSinghC commented Jul 12, 2024

Type of Change

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

Description

During the MITs with the connector_mandate_details the original_authorized_amount is made optional.

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?

-> Create cybersource merchant connector account
-> Create mandate

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_FZ5RdQNZ944E16z8uT6DrqlkCa2TsEnGBFxdFu6uuNgbwi68PJlvfpYGXmqLFlJa' \
--header 'Content-Type: application/json' \
--data-raw '{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "cu_1720965634",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "name name",
            "card_cvc": "737"
        }
    },
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {},
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 0,
            "account_name": "transaction_processing"
        }
    ]
}'
image image

-> Create a payment with confirm false

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'api-key: dev_FZ5RdQNZ944E16z8uT6DrqlkCa2TsEnGBFxdFu6uuNgbwi68PJlvfpYGXmqLFlJa' \
--header 'Content-Type: application/json' \
--data '{
    "amount": 10000,
    "currency": "USD",
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "confirm": false,
    "off_session": true,
    "customer_id": "cu_1720964758"
}'
image

-> List payment methods with client_secret

curl --location 'http://localhost:8080/customers/payment_methods?client_secret=pay_bkfuNbw8xifVm7NLOOyt_secret_xZOreIvw2iJPM39q7u6d' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_a4f83cc1e4d345ae8fc5ccf9db82cc2b'
image

-> Confirm the payment with the above listed token

curl --location 'http://localhost:8080/payments/pay_bkfuNbw8xifVm7NLOOyt/confirm' \
--header 'api-key: pk_dev_a4f83cc1e4d345ae8fc5ccf9db82cc2b' \
--header 'Content-Type: application/json' \
--data '{
   "payment_token": "token_s5u8wLyMPGvKIRmV6EfU",
   "client_secret": "pay_bkfuNbw8xifVm7NLOOyt_secret_xZOreIvw2iJPM39q7u6d",
   "payment_method": "card",
   "billing": {
       "address": {
           "line1": "1467",
           "line2": "Harrison Street",
           "line3": "Harrison Street",
           "city": "San Fransico",
           "state": "California",
           "zip": "94122",
           "country": "US",
           "first_name": "PiX",
           "last_name": "ss"
       }
   }
}'
image

-> Make the "original_payment_authorized_currency": "USD" and "original_payment_authorized_amount": 1000, null for testing
image

-> List payment methods for customer and make a payment, verified original_authorized_amount being sent as null form logs
image|
image
image
image

-> Perform the same steps with Discover card
image
image
image

image image image

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

@ShankarSinghC ShankarSinghC added A-connector-integration Area: Connector integration C-refactor Category: Refactor labels Jul 12, 2024
@ShankarSinghC ShankarSinghC self-assigned this Jul 12, 2024
@ShankarSinghC ShankarSinghC requested a review from a team as a code owner July 12, 2024 12:12
@ShankarSinghC ShankarSinghC changed the title refactor(connector): make the original_authorized_amount mandatory only for discover cards refactor(connector): make the original_authorized_amount optional for MITs with connector_mandate_details Jul 14, 2024
@pixincreate pixincreate added this pull request to the merge queue Jul 19, 2024
Merged via the queue into main with commit a8e2f3e Jul 19, 2024
19 of 21 checks passed
@pixincreate pixincreate deleted the recurring/cybersource branch July 19, 2024 08:54
pixincreate added a commit that referenced this pull request Jul 19, 2024
* 'main' of github.com:juspay/hyperswitch: (26 commits)
  refactor(core): change primary keys in user, user_roles and roles tables (#5374)
  chore(version): 2024.07.19.1
  refactor(connector): make the `original_authorized_amount` optional for MITs with `connector_mandate_details` (#5311)
  feat(connector): Plaid connector Integration (#3952)
  feat: encryption service integration to support batch encryption and decryption (#5164)
  refactor(core): change primary key of refund table (#5367)
  chore(version): 2024.07.19.0
  chore(postman): update Postman collection files
  Docs: Updating Error codes for documentation purposes (#5314)
  fix(core): [payouts] failure of payout retrieve when token is expired (#5362)
  build: remove unused dependencies (#5343)
  refactor(blocklist): change primary key of blocklist table (#5356)
  chore: Increasing log coverage for payment method list (#5042)
  refactor(routing): Remove backwards compatibility for the routing crate (#3015)
  refactor(merchant_account): change primary key for merchant account (#5327)
  refactor(router): remove id dependency from merchant connector account, dispute and mandate (#5330)
  feat(connector): [Itau Bank] Template for payment flows (#5304)
  chore(version): 2024.07.18.0
  refactor(router): Remove the locker call in the psync flow (#5348)
  feat(router): Add support for passing the domain dynamically in the session call (#5347)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make the original_authorized_amount optional for MITs with connector_mandate_details
4 participants