-
Notifications
You must be signed in to change notification settings - Fork 4.2k
refactor(merchant_connector_account): change unique constraint to connector label #3091
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d6293c9
refactor: change unique constraint of mca to connector label
Narayanbhat166 9bad99f
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] 1644259
Merge branch 'main' into change_mca_constraint
Narayanbhat166 021e9af
Merge branch 'main' into change_mca_constraint
Narayanbhat166 88fc392
chore: make migrations to be rerun
Narayanbhat166 c5ce093
Merge branch 'main' into change_mca_constraint
Narayanbhat166 ae8a6af
chore: add test cases
Narayanbhat166 84c6164
chore: cargo clippy
Narayanbhat166 209263d
chore: cargo clippy
Narayanbhat166 6ec48f7
chore: create index before deleting previous index
Narayanbhat166 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
migrations/2023-12-06-060216_change_primary_key_for_mca/down.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- This file should undo anything in `up.sql` | ||
CREATE UNIQUE INDEX IF NOT EXISTS "merchant_connector_account_profile_id_connector_id_index" ON merchant_connector_account (profile_id, connector_name); | ||
|
||
ALTER TABLE merchant_connector_account DROP CONSTRAINT IF EXISTS "merchant_connector_account_profile_id_connector_label_key"; |
5 changes: 5 additions & 0 deletions
5
migrations/2023-12-06-060216_change_primary_key_for_mca/up.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Your SQL goes here | ||
ALTER TABLE merchant_connector_account | ||
ADD UNIQUE (profile_id, connector_label); | ||
|
||
DROP INDEX IF EXISTS "merchant_connector_account_profile_id_connector_id_index"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...entConnectors/Payment Connector - Create Multiple/Create First Connector/.event.meta.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"eventOrder": ["event.test.js"] | ||
} |
47 changes: 47 additions & 0 deletions
47
...aymentConnectors/Payment Connector - Create Multiple/Create First Connector/event.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Validate status 2xx | ||
pm.test( | ||
"[POST]::/accounts/:account_id/connectors - Status code is 2xx", | ||
function () { | ||
pm.response.to.be.success; | ||
}, | ||
); | ||
|
||
// Validate if response header has matching content-type | ||
pm.test( | ||
"[POST]::/accounts/:account_id/connectors - Content-Type is application/json", | ||
function () { | ||
pm.expect(pm.response.headers.get("Content-Type")).to.include( | ||
"application/json", | ||
); | ||
}, | ||
); | ||
|
||
// Set response object as internal variable | ||
let jsonData = {}; | ||
try { | ||
jsonData = pm.response.json(); | ||
} catch (e) { } | ||
|
||
// pm.collectionVariables - Set merchant_connector_id as variable for jsonData.merchant_connector_id | ||
if (jsonData?.merchant_connector_id) { | ||
pm.collectionVariables.set( | ||
"merchant_connector_id", | ||
jsonData.merchant_connector_id, | ||
); | ||
console.log( | ||
"- use {{merchant_connector_id}} as collection variable for value", | ||
jsonData.merchant_connector_id, | ||
); | ||
} else { | ||
console.log( | ||
"INFO - Unable to assign variable {{merchant_connector_id}}, as jsonData.merchant_connector_id is undefined.", | ||
); | ||
} | ||
|
||
// Validate if the connector label is the one that is passed in the request | ||
pm.test( | ||
"[POST]::/accounts/:account_id/connectors - connector_label is the same as that is passed in the request", | ||
function () { | ||
pm.expect(jsonData.connector_label).to.eql("first_stripe") | ||
}, | ||
); |
123 changes: 123 additions & 0 deletions
123
...PaymentConnectors/Payment Connector - Create Multiple/Create First Connector/request.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"auth": { | ||
"type": "apikey", | ||
"apikey": [ | ||
{ | ||
"key": "value", | ||
"value": "{{admin_api_key}}", | ||
"type": "string" | ||
}, | ||
{ | ||
"key": "key", | ||
"value": "api-key", | ||
"type": "string" | ||
}, | ||
{ | ||
"key": "in", | ||
"value": "header", | ||
"type": "string" | ||
} | ||
] | ||
}, | ||
"method": "POST", | ||
"header": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json" | ||
}, | ||
{ | ||
"key": "Accept", | ||
"value": "application/json" | ||
} | ||
], | ||
"body": { | ||
"mode": "raw", | ||
"options": { | ||
"raw": { | ||
"language": "json" | ||
} | ||
}, | ||
"raw_json_formatted": { | ||
"connector_type": "fiz_operations", | ||
"connector_name": "stripe", | ||
"business_country": "US", | ||
"business_label": "default", | ||
"connector_label": "first_stripe", | ||
"connector_account_details": { | ||
"auth_type": "HeaderKey", | ||
"api_key": "{{connector_api_key}}" | ||
}, | ||
"test_mode": false, | ||
"disabled": false, | ||
"payment_methods_enabled": [ | ||
{ | ||
"payment_method": "card", | ||
"payment_method_types": [ | ||
{ | ||
"payment_method_type": "credit", | ||
"card_networks": ["Visa", "Mastercard"], | ||
"minimum_amount": 1, | ||
"maximum_amount": 68607706, | ||
"recurring_enabled": true, | ||
"installment_payment_enabled": true | ||
}, | ||
{ | ||
"payment_method_type": "debit", | ||
"card_networks": ["Visa", "Mastercard"], | ||
"minimum_amount": 1, | ||
"maximum_amount": 68607706, | ||
"recurring_enabled": true, | ||
"installment_payment_enabled": true | ||
} | ||
] | ||
}, | ||
{ | ||
"payment_method": "pay_later", | ||
"payment_method_types": [ | ||
{ | ||
"payment_method_type": "klarna", | ||
"payment_experience": "redirect_to_url", | ||
"minimum_amount": 1, | ||
"maximum_amount": 68607706, | ||
"recurring_enabled": true, | ||
"installment_payment_enabled": true | ||
}, | ||
{ | ||
"payment_method_type": "affirm", | ||
"payment_experience": "redirect_to_url", | ||
"minimum_amount": 1, | ||
"maximum_amount": 68607706, | ||
"recurring_enabled": true, | ||
"installment_payment_enabled": true | ||
}, | ||
{ | ||
"payment_method_type": "afterpay_clearpay", | ||
"payment_experience": "redirect_to_url", | ||
"minimum_amount": 1, | ||
"maximum_amount": 68607706, | ||
"recurring_enabled": true, | ||
"installment_payment_enabled": true | ||
} | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"city": "NY", | ||
"unit": "245" | ||
} | ||
} | ||
}, | ||
"url": { | ||
"raw": "{{baseUrl}}/account/:account_id/connectors", | ||
"host": ["{{baseUrl}}"], | ||
"path": ["account", ":account_id", "connectors"], | ||
"variable": [ | ||
{ | ||
"key": "account_id", | ||
"value": "{{merchant_id}}", | ||
"description": "(Required) The unique identifier for the merchant account" | ||
} | ||
] | ||
}, | ||
"description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc." | ||
} |
1 change: 1 addition & 0 deletions
1
...aymentConnectors/Payment Connector - Create Multiple/Create First Connector/response.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
3 changes: 3 additions & 0 deletions
3
...ntConnectors/Payment Connector - Create Multiple/Create Second Connector/.event.meta.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"eventOrder": ["event.test.js"] | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Add the new index before deleting the old one, in case it fails.