hyperswitch
hyperswitch copied to clipboard
fix(frm): restrict enabled mca for frm connectors
Type of Change
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
FRM connectors doesn't have connector disable/enable feature. This PR adds support to enable disable FRM connector.
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?
step1 : create merchant account
curl --location 'http://localhost:8080/accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
"merchant_id": "merchant_1722830346",
"merchant_name": "NewAge Retailer",
"return_url": "https://chrome.google.com/",
"enable_payment_response_hash": false,
"payment_response_hash_key": null,
"redirect_to_merchant_with_http_post": false,
"merchant_details": {
"primary_contact_person": "joseph Test",
"primary_phone": "veniam aute officia ullamco esse",
"primary_email": "[email protected]",
"secondary_contact_person": "joseph Test2",
"secondary_phone": "proident adipisicing officia nulla",
"secondary_email": "[email protected]",
"website": "https://www.example.com",
"about_business": "Online Retail with a wide selection of organic products for North America",
"address": {
"city": "San Fransico",
"country": null,
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"zip": "94122",
"state": "California",
"first_name": null,
"last_name": null
}
},
"webhook_details": {
"webhook_version": "1.0.1",
"webhook_username": "ekart_retail",
"webhook_password": "password_ekart@123",
"webhook_url": "https://webhook.site/59a32096-539b-4be2-bd8e-308475615c0f",
"payment_created_enabled": true,
"payment_succeeded_enabled": true,
"payment_failed_enabled": true
},
"payout_routing_algorithm": null,
"sub_merchants_enabled": false,
"parent_merchant_id": null,
"publishable_key": "pk_snd_3b33cd9404234113804aa1accaabe22f",
"metadata": {
"city": "NY",
"unit": "245"
},
"locker_id": "m0010",
"primary_business_details": [
{
"country": "US",
"business": "default"
}
],
"frm_routing_algorithm": {
"type": "single",
"data": "signifyd"
},
"organization_id": null
}'
step 2 : create api key for merchant step 3 : create stripe merchant connector account step 4 : create signifyd merchant connector account.
{
"connector_type": "payment_vas",
"connector_account_details": {
"auth_type": "HeaderKey",
"api_key": "{{signifyd_api_key}}"
},
"disabled": true,
"frm_configs": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "debit",
"card_networks": null,
"flow": "pre",
"action": "cancel_txn"
},
{
"payment_method_type": "credit",
"card_networks": null,
"flow": "pre",
"action": "cancel_txn"
}
],
"flow": null
}
]
}
step 5 : create a payment
{
"amount": 1000,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 1000,
"customer_id": "StripeCustomer2",
"email": "[email protected]",
"name": "Bob Smith",
"phone": "999999999",
"phone_country_code": "+91",
"description": "Its my first payment request",
"authentication_type": "no_three_ds",
"return_url": "https://google.com",
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "IN",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
// "shipping": {
// "address": {
// "line1": "1467",
// "line2": "31 Sherwood Gardens",
// "line3": "31 Sherwood Gardens",
// "city": "London",
// "state": "Manchester",
// "zip": "E14 9wn",
// "country": "GB",
// "first_name": "Bob",
// "last_name": "Smith"
// },
// "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"
},
"order_details" : [{
"product_name" : "gillete creme",
"quantity" : 2,
"amount" : 600,
"product_id" : "{{random_number}}",
"category" : "clothes",
"sub_category" : "tees",
"product_type" : "digital"
},
{
"product_name" : "fake",
"quantity" : 1000,
"amount" : 300,
"product_id" : "{{random_number}}",
"category" : "shoes",
"sub_category" : "jordans",
"product_type" : "physical"
}],
"frm_metadata" : {
"fulfillment_method" : "delivery", // These are added to provide
"coverage_request" : "fraud",
"total_shipping_cost" : 240,
"order_channel" : "web"
}
}
Checklist
- [x] I formatted the code
cargo +nightly fmt --all
- [x] I addressed lints thrown by
cargo clippy
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible