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

feat(connector): [Bambora APAC] add mandate flow #5376

Merged
merged 3 commits into from
Jul 26, 2024

Conversation

Sakilmostak
Copy link
Contributor

Type of Change

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

Description

CIT (Setup mandate flow and mandate creation with payment) is added for bambora apac. MIT is also implementated

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?

Tested through Postman:

  1. Mandate creation with payment
  • create a payment with setup_future_usage as off_session:
{
    "amount": 10000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "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",
    "setup_future_usage": "off_session",
    "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": "127.0.0.1"
    },
    "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"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "payment_type": "new_mandate",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4005550000000001",
            "card_exp_month": "02",
            "card_exp_year": "26",
            "card_holder_name": "Joseph Doe",
            "card_cvc": "999"
        }
    },
    "billing": {
        "address": {
            "line1": "8th block",
            "line2": "8th block",
            "line3": "8th block",
            "city": "Bengaluru",
            "state": "Karnataka",
            "zip": "560095",
            "country": "IN",
            "first_name": "Sakil",
            "last_name": "Mostak"
        }
    },
    "mandate_data": {
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "125.0.0.1",
                "user_agent": "amet irure esse"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 8000,
                "currency": "USD"
            }
        }
    }
}
  • the status should be successful and mandate id should be present in the response
  • Use the mandate id to do a MIT:
{
    "amount": 6000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "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",
    "setup_future_usage": "on_session",
    "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": "127.0.0.1"
    },
    "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"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "billing": {
        "address": {
            "line1": "8th block",
            "line2": "8th block",
            "line3": "8th block",
            "city": "Bengaluru",
            "state": "Karnataka",
            "zip": "560095",
            "country": "IN",
            "first_name": "Sakil",
            "last_name": "Mostak"
        }
    },
    "mandate_id": "man_O8XZ4SIgIui5QOKCBhxw",
    "off_session": true
}
  • the status should be successful
  1. Setup mandate and then create a payment
  • Do a setup mandate call:
{
    "amount": 0,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "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",
    "setup_future_usage": "off_session",
    "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": "127.0.0.1"
    },
    "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"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "payment_type": "setup_mandate",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4005550000000001",
            "card_exp_month": "02",
            "card_exp_year": "26",
            "card_holder_name": "Joseph Doe",
            "card_cvc": "999"
        }
    },
    "billing": {
        "address": {
            "line1": "8th block",
            "line2": "8th block",
            "line3": "8th block",
            "city": "Bengaluru",
            "state": "Karnataka",
            "zip": "560095",
            "country": "IN",
            "first_name": "Sakil",
            "last_name": "Mostak"
        }
    },
    "mandate_data": {
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "125.0.0.1",
                "user_agent": "amet irure esse"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 8000,
                "currency": "USD"
            }
        }
    }
}
  • the status should be successful and mandate id should be present
  • do a MIT call with given mandate id
{
    "amount": 6000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "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",
    "setup_future_usage": "on_session",
    "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": "127.0.0.1"
    },
    "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"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "billing": {
        "address": {
            "line1": "8th block",
            "line2": "8th block",
            "line3": "8th block",
            "city": "Bengaluru",
            "state": "Karnataka",
            "zip": "560095",
            "country": "IN",
            "first_name": "Sakil",
            "last_name": "Mostak"
        }
    },
    "mandate_id": "man_O8XZ4SIgIui5QOKCBhxw",
    "off_session": true
}
  • the status should be successful

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

@Sakilmostak Sakilmostak added the A-connector-integration Area: Connector integration label Jul 19, 2024
@Sakilmostak Sakilmostak added this to the July 2024 Release milestone Jul 19, 2024
@Sakilmostak Sakilmostak self-assigned this Jul 19, 2024
@Sakilmostak Sakilmostak requested review from a team as code owners July 19, 2024 11:32
@@ -30,7 +30,7 @@ airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
bambora.base_url = "https://api.na.bambora.com"
bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api/dts.asmx"
bamboraapac.base_url = "https://demo.ippayments.com.au/interface/api"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do this change for prod baseUrl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

zero auth mandate requires different endpoint both in sandbox and production i.e sipp.asmx thus this change was made

AkshayaFoiger
AkshayaFoiger previously approved these changes Jul 25, 2024
.submit_single_payment_result
.response
.credit_card_token
.ok_or(errors::ConnectorError::MissingConnectorMandateID)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this error to recurring mandate flow.

Comment on lines 453 to 458
.token
.map(|token| -> types::MandateReference {
types::MandateReference {
connector_mandate_id: Some(token),
payment_method_id: None,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Throw missing mandate id error for failure case

) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = bamboraapac::get_setup_mandate_body(req)?;

Ok(RequestContent::RawBytes(connector_req))
Copy link
Member

Choose a reason for hiding this comment

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

For longer term though, we may want to use a different variant specific for SOAP requests.

@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 26, 2024
Merged via the queue into main with commit dbfa006 Jul 26, 2024
14 checks passed
@likhinbopanna likhinbopanna deleted the bambora_apac_mandate branch July 26, 2024 13:40
@pixincreate pixincreate added the C-feature Category: Feature request or enhancement label Jul 26, 2024
pixincreate added a commit that referenced this pull request Jul 30, 2024
* 'main' of github.com:juspay/hyperswitch:
  refactor(router): remove `connector_account_details` and `connector_webhook_details` in merchant_connector_account list response (#5457)
  feat: add env variable for enable key manager service (#5442)
  chore(version): 2024.07.29.0
  feat(payments): support sort criteria in payments list (#5389)
  refactor(connector):  add amount conversion framework to placetopay (#4988)
  feat(connector): [Bambora APAC] add mandate flow (#5376)
  ci: set code owners for payment methods files (#5453)
  refactor(opensearch): Add Error Handling for Empty Query and Filters in Request (#5432)
  chore: address Rust 1.80 clippy lints (#5447)
  feat(connector): [FISERV] Move connector to hyperswitch_connectors (#5441)
  ci: add support for just hack_v2 check for PRs (#5426)
  fix: added created at and modified at keys in PaymentAttemptResponse (#5412)
  refactor(merchant_account_v2): recreate id for `merchant_account` v2  (#5439)
  chore(version): 2024.07.26.0
  feat(events): forward the tenant configuration as part of the kafka message (#5224)
  refactor(connector):  add amount conversion framework to payone (#4981)
  refactor(user_roles): make org and merchant id nullable (#5353)
  fix(euclid): change the address taken in SessionFlowRouting from shipping to billing address (#5435)
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-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants