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

[Part 5] Networking Refactor - CardPayment unit tests #193

Merged
merged 37 commits into from
Sep 5, 2023

Conversation

scannillo
Copy link
Collaborator

@scannillo scannillo commented Aug 30, 2023

Reason for changes

This PR re-writes our CardPaymentsTests based on the source code changes introduced in this series of networking layer refactor PRs.

Summary of changes

  • Add tests for:
    • CheckoutOrdersAPI
    • VaultPaymentsTokenAPI
  • Update tests for:
    • CardClient (now relies on mocked <PPassAPI> classes to stub network responses)
    • ConfirmPaymentSourceRequest (now it's only a model type, versus before it had many functions)
  • Move mocks into CardPaymentTests/Mocks dir
  • Add mocks for:
    • CheckoutOrdersAPI and VaultPaymentTokensAPI for use in CardClient_Tests
    • Repurpose CardResponses file of sample JSON responses to be raw ConfirmPaymentSourceReponse types

Next

  • We can merge to main now! Tests are passing 😎
  • Follow ups which can happen on main:
    • Encapsulate JSONEncoder functionality into wrapper class
    • Rename APIClient --> NetworkingClient
    • Re-organize file structure
    • Align naming convention for request model types

Checklist

  • Added a changelog entry

Authors

@scannillo

paypalsdk and others added 30 commits August 24, 2023 17:34
* vault without purchase

* clean up cardClient initializer

* Use associatedType for variables for GraphQLQuery protocol

* moving setuptoken call to demo app

* use APIRequest for merchantServer setupToken request

* use enum for PaymentSourceInput for different payment options

* get request for setup token details

* move graphQL request, responses from Core to Card module

* remove APIRequest use in demo app

* Add VaultCardDelegate for VaultCardResult

* Add payment token creation in demo app

* remove duplicate UpdateSetupTokenQuery.swift

* rename UpdateSetupTokenRequest to UpdateSetupTokenQuery

* added newly named file reference to project

* add mocks for unit tests, pr feedback

* disable swiftlint for multiline query, target for card test

* correct target for MockGraphQLClient

* CardClient vault error tests

* docStrings and CHANGELOG

* PR feedback

* PR feedback

* PR feedback nodoc String for GraphQLQuery requestBody()

* spacing in paymentTokenRequest

* PR feedback

* PR feedback from Jax 8/16/23

* PR feedback from Jax cleanup
…r data in GraphQL request types to prevent double encoding
@scannillo scannillo changed the title [Part 4] Networking Refactor - CardPayment unit tests [Part 5] Networking Refactor - CardPayment unit tests Aug 30, 2023
@scannillo scannillo changed the title [Part 5] Networking Refactor - CardPayment unit tests [DO NOT REVIEW] [Part 5] Networking Refactor - CardPayment unit tests Aug 30, 2023
@scannillo scannillo marked this pull request as ready for review August 30, 2023 01:54
@scannillo scannillo requested a review from a team as a code owner August 30, 2023 01:54
@scannillo scannillo changed the title [DO NOT REVIEW] [Part 5] Networking Refactor - CardPayment unit tests [Part 5] Networking Refactor - CardPayment unit tests Aug 30, 2023
Base automatically changed from networking-refactor-tests-rebased to networking-refactor September 5, 2023 15:28
@scannillo scannillo merged commit 71c80fc into networking-refactor Sep 5, 2023
4 checks passed
@scannillo scannillo deleted the networking-refactor-card-module-tests branch September 5, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants