Open Mrkbingham opened 3 months ago
Also when you get a chance @NikolaGavric94, I'm not able to run StyleCI for this repo, so granting access there would be greatly appreciated so I can clean up any syntax issues:
Hey Mark,
I will take a detailed look at this over the upcoming weekend and will get it sorted by next Tuesday, thank you for your effort and willingness to help :)
Would you be able to add the wiki page changes with the examples, notes and limitations of using fulfillments with this package in this PR?
Would you be able to add the wiki page changes with the examples, notes and limitations of using fulfillments with this package in this PR?
Definitely! I'm heading out for vacation this week, so will get to this when I return, but will be sure to add a wiki page with examples using the existing ones as a reference point.
@NikolaGavric94 After a bit of a long hiatus from looking at this, I've resumed work again! I've added quite a few more tests along with negative testing coverage. Happy to add anything more that you think is missing. I still need to add the Wiki pages, but outside of that I think everything should be ready here (other than the one open thread left above re: mail.yml
)
Okay, I've added the wiki page here: https://github.com/NikolaGavric94/laravel-square/wiki/Examples-with-Fulfillments-(coming-soon)
I will check the changes this upcoming weekend and we will see where we are at, thanks for all your hard work & effort @Mrkbingham
Would you be able to just attach the picture of passing tests here and I'll merge it. Need to get on fixing actions when PRs are made from forks
FYI @NikolaGavric94 I did make this new MR that contains part of the changes included in here. I really should have done this sooner, but in order to more easily digest some of the changes, I figured this might be helpful if we ever need to go back and do any debugging:
Okay, in addition to branching out a subset of this MR - I've also created a "master" branch in my repo called "nikolag_master" that was just synced from the current state of master of this main repo. I've created MRs in my own repo against that branch, and have linked here to this successful pipeline run: https://github.com/Mrkbingham/laravel-square/pull/25/checks
There were a few syntax issues, but those are now resolved too!
Fulfillments
This merge request seeks to add support for fulfillments and creates models that are reflective of the Square data model. Orders can have Fulfillments, which themselves have Fulfillments Details of varying types (details on the model update below). This merge request adds the following:
Square API support
This adds support via the
SquareRequestBuilder
to update and modify data on square, and ensure it's synced properly with your application. Some notable assumptions are baked in here:Model Updates
This creates a polymorphic relationship between orders via the Fulfillment model. Adding a fulfillment to an order requires both adding a Fulfillment model and a FulfillmentDetails model - which can be one of three types:
DeliveryDetails
,PickupDetails
orShipmentDetails
. These relationships are handled through the traitHasFulfillments
.Recipient Addition
The recipients have been added as a distinct model. This distinction could be useful for adding future support for additional recipient type, for example Invoice Recipients.
Adds Order ID to Payment API request (fulfilling the requirements Square has for orders to show up on the Square Dashboard):
This PR contains a minor fix for adding in the order id to the payments API request, so the payment and order are connected within Square's System. This update exposed a few bugs that have now been addressed:
Util::calculateTotalOrderCost/ByModel
were not taking in to account discounts and inclusive taxes properly. This now makes sure that Additive taxes are calculated based off the Net Price (taking in to account Discounts and Inclusive Taxes). Added a private_calculateNetPrice
method to support this.buildOrderCopyFromModel
method was not properly creating taxes at the order level. AddedConstants::DEDUCTIBLE_SCOPE_ORDER
.