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] Add custom parameter sets for FedEx and UPS account creation #509

Merged
merged 2 commits into from
Aug 29, 2023

Conversation

nwithan8
Copy link
Member

@nwithan8 nwithan8 commented Aug 28, 2023

Description

Re: #365

This PR introduces custom parameter sets for creating FedEx and UPS carrier accounts, as these two require different payload schemas than other carrier account types. These parameter sets (CreateFedEx, CreateUps) helps end-users know what parameters are required for these two specific carrier accounts compared to other carrier accounts, and handles elements such as parameter placement during serialization (standard for all parameter set objects) and auto-populating the carrier account type parameter.

These custom parameter sets can be used in the normal Create function. One step further, an exception will be raised if the user attempts to use the generic Create parameter set with, e.g. "FedExAccount" as its type (will force users to only use the CreateFedEx parameter set if they are attempting to make a FedEx carrier account (same for UPS)).

The parameter sets for FedEx and UPS have a number of required parameters that, if not completed, will raise a local exception during pre-request serialization (standard feature for parameter sets). This will additionally insure that users are not only using the proper parameter set for, eg., creating a FedEx account, but that all required data is being provided, all before the request is actually attempted.

Testing

  • New unit test for confirming new custom workflow parameter sets work versus generic ones
  • New unit test to confirm user is barred from using generic parameter set for a custom-workflow-enabled carrier account
  • New unit test to confirm missing required parameters raises an exception during serialization/validation.

Pull Request Type

Please select the option(s) that are relevant to this PR.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement (fixing a typo, updating readme, renaming a variable name, etc)

- Prevent users from using generic account creation parameter set for FedEx and UPS
- Add unit tests, cassettes to confirm required/optional parameter set validation, confirm custom workflow carrier account parameter set usage
- Add custom message option in MissingParameter exception
@nwithan8 nwithan8 requested a review from a team as a code owner August 28, 2023 21:00
@nwithan8 nwithan8 marked this pull request as draft August 28, 2023 21:02
@nwithan8 nwithan8 marked this pull request as ready for review August 28, 2023 21:05
Copy link

@dcaballeroc dcaballeroc left a comment

Choose a reason for hiding this comment

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

Looks solid

Copy link
Member

@Justintime50 Justintime50 left a comment

Choose a reason for hiding this comment

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

Looks good!

EasyPost/Services/CarrierAccountService.cs Show resolved Hide resolved
@nwithan8 nwithan8 merged commit 15143b5 into master Aug 29, 2023
14 checks passed
@nwithan8 nwithan8 deleted the carrier_account_parameters branch August 29, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants