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

OAuth SDK #118

Merged
merged 19 commits into from
Feb 29, 2024
Merged

OAuth SDK #118

merged 19 commits into from
Feb 29, 2024

Conversation

shwatang
Copy link
Contributor

@shwatang shwatang commented Feb 8, 2024

Note :- Please follow the below points while attaching test cases document link below:

- If label Tested is added then test cases document URL is mandatory.

- Link added should be a valid URL and accessible throughout the org.

- If the branch name contains hotfix / revert by default the BVT workflow check will pass.

Test Case Document URL
Please paste test case document link here....

This PR consists of changes to help Platform partners onboard to OAuth flow via SDK. Using this SDK, they can:

  1. Generate Authorize URL
  2. Generate Access Token using Auth code
  3. Generate Access Token using Refresh token
  4. Revoke Token
  5. Generate onboarding signature for Phantom prefill onboarding.
  6. Trigger Razorpay APIs using Access token.

@shwatang shwatang added the TestingNotRequired TestingNotRequired label for BVT label Feb 8, 2024
@shwatang shwatang changed the title OAuth sdk OAuth SDK Feb 13, 2024
}
}

private void ValidateNonEmptyString(Dictionary<string, object> payload, string field)

Choose a reason for hiding this comment

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

ValidateNonEmptyString and ValidateNonNull can be clubbed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO no. For some cases, we are checking that a field should exist. In some cases, field can be optional, but if passed, value cant be empty string.

{
if (statusCode >= 400 && statusCode < 500)
{
errorCode = ErrorCodes.BAD_REQUEST_ERROR.ToString();

Choose a reason for hiding this comment

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

a more detailed error would be better here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually just a mapping of error code and not defining error message, that will be passed further as it is. The above change is due to the reason that the SDK currently is tightly coupled with what we have in API monolith. Since we are calling Auth service here, we dont receive such error codes in response. Hence we are just setting errorCode based on statusCode we receive from APIs via auth service.


public string GetAuthUrl(Dictionary<string, object> data)
{
ValidateAuthUrlRequest(data);

Choose a reason for hiding this comment

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

ValidateAuthUrlRequest etc functions seems to be overhead. inside those functions there is nothing but 1 line of code to validate. we can replace that here itself

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@shwatang shwatang merged commit 48c375f into master Feb 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TestingNotRequired TestingNotRequired label for BVT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants