Skip to content

Conversation

@andrewalkermo
Copy link
Collaborator

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive credit card management capabilities for customers, including methods to retrieve, delete, and set default credit cards. The implementation follows a consistent pattern of refactoring gateway methods to accept model objects instead of ID strings, improving type safety and API consistency.

Key changes include:

  • Added getCard(), deleteCard(), and setDefaultCard() methods to the MultiPayment class and facade
  • Refactored the get() method in Model base class to accept model instances instead of ID strings
  • Introduced a refresh() method for reloading model data from gateways
  • Added corresponding methods to the MultiPaymentTrait for easy integration with customer models

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
tests/Unit/MultiPaymentTest.php Added comprehensive test cases for credit card retrieval, deletion, and default card setting functionality
tests/Unit/Builders/InvoiceBuilderTest.php Updated to use new refresh() method instead of get() for reloading invoice data
tests/Unit/Builders/CreditCardBuilderTest.php Refactored to use refresh() method and moved createCustomer helper to base TestCase class
tests/TestCase.php Added shared createCustomer() helper method for reuse across test classes
src/Traits/MultiPaymentTrait.php Added three new methods for credit card management: setDefaultCreditCard(), deleteCreditCard(), and defaultCreditCard()
src/MultiPayment.php Added getCard(), deleteCard(), and setDefaultCard() public methods, refactored getInvoice() and getCustomer() to use model objects
src/Models/Model.php Changed get() from static to instance method accepting gateway parameter, added delete() and refresh() methods
src/Models/Customer.php Added setDefaultCard(), getCreditCard(), and deleteCreditCard() methods for managing customer credit cards
src/Gateways/IuguGateway.php Implemented gateway methods for credit card operations, refactored parsing logic, updated getInvoice() and getCustomer() signatures
src/Facades/MultiPayment.php Added PHPDoc annotations for new credit card management methods (with some missing)
src/Exceptions/GatewayException.php Improved error message handling to avoid appending empty error strings
src/Contracts/InvoiceContract.php Updated getInvoice() signature to accept Invoice object instead of ID string
src/Contracts/CustomerContract.php Updated getCustomer() signature and added setCustomerDefaultCard() method
src/Contracts/CreditCardContract.php Added getCreditCard() and deleteCreditCard() method signatures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

andrewalkermo and others added 8 commits November 28, 2025 21:47
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@andrewalkermo andrewalkermo merged commit 9e890b1 into main Nov 29, 2025
1 check passed
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.

2 participants