Add methods to manage credit cards for customers#46
Merged
andrewalkermo merged 10 commits intomainfrom Nov 29, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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(), andsetDefaultCard()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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.