-
Notifications
You must be signed in to change notification settings - Fork 3
Add methods to manage credit cards for customers #46
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
Conversation
There was a problem hiding this 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(), 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>
No description provided.