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(cypress): add 2 more payout connectors and bank transfer support for payout #4993

Merged
merged 9 commits into from
Jun 20, 2024

Conversation

pixincreate
Copy link
Member

@pixincreate pixincreate commented Jun 13, 2024

Type of Change

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

Description

This PR modifies Payout tests. Notably, 2 more connectors has been added namely, Adyen Platform and Wise.
Adyen Platform and Wise payout connectors only support Bank Transfers unlike Adyen which supports cards as well. Hence, for connectors that does not support a payment method, we throw 501 by leveraging Common.js (except for Wise that has a different error message for 501 unlike other connectors -- this will optimized and refactored in the coming refactor).

Flow is as below:

  • Bank Transfer
    • ACH (Not implemented)
    • BACS (Not implemented)
    • SEPA
      • Auto fulfill and Auto confirm
      • Auto fulfill and Manual confirm
      • Manual fulfill and Auto confirm
      • Manual fulfill and Manual confirm
  • Saved Payouts
    • Card
      • Onboard customer prior to transaction
      • Save payment method after successful transaction
    • Bank Transfer
      • Onboard customer prior to transaction
      • Save payment method after successful transaction

Upcoming refactor will remove duplicate connector Create commands (we currently have 3 connector create commands in commands.js) by making it more generic and reusable. The same has to be done for confirm calls as well.

Additionally, configs for prettier has been added just to maintain consistency across all environments.
To run auto-formatting, execute the below command in terminal:

prettier . --write

Note

8c72275 removes KV support in Payouts. We'll be coming back to this later in future. Added here for reference

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

More tests

How did you test it?

Adyen Adyen Platform Wise
image image image

BACS, ACH not implemented yet.

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

- Add 2 more payout connectors:
  - Adyen Platform
  - Wise
- Add Bank Transfers
  - SEPA

- Refactor Payouts to accommodate these changes
@pixincreate pixincreate added A-CI-CD Area: Continuous Integration/Deployment S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jun 13, 2024
@pixincreate pixincreate added this to the May 2024 Release milestone Jun 13, 2024
@pixincreate pixincreate self-assigned this Jun 13, 2024
@pixincreate pixincreate requested review from a team as code owners June 13, 2024 10:15
…outs

* 'main' of github.com:juspay/hyperswitch:
  feat(router): include the pre-routing connectors in Apple Pay retries (#4952)
  fix(cypress): Add `jwt_token` and `cookie` for routing test (#4953)
  feat(connectors): [Iatapay] add payment methods (#4968)
  chore(version): 2024.06.13.0
  feat(payouts): make payout_type optional in payouts table (#4954)
  feat(connector): [BOA/CYB] Make billTo fields optional (#4951)
  fix(core): fix the multitenancy prefix  in routing cache (#4963)
  refactor(connector): [Mifinity]Move destination_account_number from pmd to Mifinity Metadata (#4962)
  refactor(payment_methods): Enable deletion of default Payment Methods (#4942)
Comment on lines +149 to +157
let sourceBalanceAccount = null;
if (authDetails && typeof authDetails === "object") {
// Specific to `AdyenPlatform` payout connector
// If the connector has source_balance_account in creds file, set it in the body and remove it from authDetails
sourceBalanceAccount = authDetails.source_balance_account;
delete authDetails.source_balance_account;
}
authDetails = authDetails;

Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be refactored such that metadata is handled while fetching credentials rather that hardcoding each value of metadata for MCA. Raise a seperate pr for the implementation

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this was hardcoded and is specific to adyenplatform connector (mentioned in comments as well) as sourceBalanceAccount is being passed as a value to metadata. It is a secret value which cannot be made public (can be treated as key1)

For context, above is a temporary change and I'll be modifying get_value_by_key to accommodate below mentioned change:

  • get_value_by_key() has been duplicated in multiple places, this can be unified
    • Can be 2 copies, one with merger (logic that merges common.js and connector.js files into one) and the other one being the legacy one. Will look into it
  • format of creds will have to be modified first:
     // from
     {
     	"connector": {
     		"auth_type": "KeyType",
     		"api_key": "api_key",
     		"key1": "key1",
     		// other kv pairs
     	},
     	// another one
     }
     // to something like, will be decided later when picked up
     {
     	"connector": {
     		"auth_type": "KeyType",
     		"api_key": "api_key",
     		"key1": "key1",
     		// other kv pairs
     		"metadata": {
     			"key": "value",
     			// other kv pairs
     		}
     	},
     }
  • Any key that lies outside of auth_info (auth_type, api_key, key1, key2, and api_secret) should be treated as metadata

cypress-tests/cypress/support/commands.js Outdated Show resolved Hide resolved
cypress-tests/cypress/support/commands.js Outdated Show resolved Hide resolved
prettier config have been added to maintain consistency across all
environments.

can be run using `prettier . --write` in `cypress-tests` directory
we will getting back to this later in future
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 20, 2024
Merged via the queue into main with commit 45a908b Jun 20, 2024
11 checks passed
@Gnanasundari24 Gnanasundari24 deleted the cypress-payouts branch June 20, 2024 09:44
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jun 20, 2024
pixincreate added a commit that referenced this pull request Jun 20, 2024
…ress-skip

* 'main' of github.com:juspay/hyperswitch: (27 commits)
  feat(cypress): add 2 more payout connectors and bank transfer support for payout (#4993)
  chore(version): 2024.06.20.0
  Refactor(core): reverts the payment method list filtering using constraint graph (#5044)
  feat(router): add payment method type duplication check for `google_pay` (#5023)
  refactor(storage): remove `id` from payment intent, attempt and remove datamodel ext from payment intent (#4923)
  fix(events): Correct parsing of API events with user event_type for Clickhouse (#5022)
  fix(connector):  add local bank redirect type in compatibility layer, default the country to AT for Local Bank Redirect and add creds_identifier in access token  (#5038)
  refactor(connector): add amount conversion framework for noon (#4843)
  fix(logging): fix stack overflow on recording restricted keys (#4423)
  feat(core): Add logger for sessions call failure (#5036)
  chore(version): 2024.06.19.0
  fix(opensearch): handle index not present errors in search api (#4965)
  feat(multitenancy): add tenant_id as a field for data pipeline and support individual database for clickhouse  (#4867)
  refactor: add basic counter metrics for IMC (#5006)
  fix(payment_methods): populate card fields while saving card again during metadata change condition (#5019)
  feat(router): Override the `setup_future_usage` to `on_session` based on the merchant config (#5016)
  chore(docker-compose): pass correct configuration values for running SDK demo app  (#5012)
  refactor: Move trait ConnectorIntegration to crate hyperswitch_interfaces (#4946)
  chore(version): 2024.06.17.0
  chore(process_tracker): use `const` instead of `String` for `business_status` (#4849)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI-CD Area: Continuous Integration/Deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants