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

Update payment.md #778

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/payment.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Item extends Model implements ProductLimitedInterface
```

I do not recommend using the limited interface when working with a shopping cart.
If you are working with a shopping cart, then you should override the `PurchaseServiceInterface` interface.
If you are working with a shopping cart, then you should override the `ProductLimitedInterface` with the `PurchaseServiceInterface` interface.
Copy link
Member

Choose a reason for hiding this comment

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

I will answer here immediately for all three PRs. It is not correct. You are confusing the service contract and the model contract.

This talks about the public contract of the service that works with purchases. The service has one single method that returns a list of transfers for making a refund.

$transfers = app(PurchaseServiceInterface::class)->already($this, $basketDto, $gifts);
if (count($transfers) !== $basketDto->total()) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add how to override this in the documentation will be of great help. Or documenting what the PurchaseServiceInterface actually does

Copy link
Member

Choose a reason for hiding this comment

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

The laravel documentation answers your question:
https://laravel.com/docs/10.x/container#binding

No one asks about it. There are two options: everything is clear or no one uses it. I'm sticking with the second option.

With it, you can check the availability of all products with one request, there will be no N-queries in the database.

## Proceed to purchase
Expand Down