Repository navigation
Staff finance and refunds (Phase 4 M) - #11
Merged
Merged
Conversation
…youts and billing APIs (Phase 4 K, L, M)
…d sale pricing; document the instance checkout contract
…m-side Stripe failures, highlight the selected organization on Billing
…voke the licence, staff licence management, return URLs on the instance host, members see licences
…otals, monthly CSV, refunds through Stripe, and the Finance page (Phase 4 M)
…inance # Conflicts: # routes/api.php
…fter re-registering or clearing its cache
…st/{version} behind the licence gate, and dist size, sha256 and builtAgainst on catalog and update releases
…ich sticks to later requests
# Conflicts: # app/Models/Instance.php
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.
Stacked on #10 (
feat/commerce). Finishes Phase 4 Workstream M: the staff finance view and refunds that the plan deferred.What's in it
Finance API (
/v1/admin/finance, behind the sameauth:token,web,scope:reviewandstaffmiddleware as the other admin routes)GET /v1/admin/finance?from=&to=returnstotalsper currency,monthsper month and currency, andpublishersper organization and currency (highest fee revenue first). Without a range it covers the last 12 months, including this one.GET /v1/admin/finance/purchases?from=&to=&status=&publisher=&extension=&page=lists purchases with the publisher, customer, fee, refunds,refundable(what is left to refund), the dispute and the Stripe ids.GET /v1/admin/finance/monthly.csv?from=&to=[&by=publisher]gives one row per month and currency, or per month, publisher and currency.purchases(fee_amount,net_amount,status,meta.amount_refunded,meta.dispute), not from Stripe, so the view works without Stripe.fee_refundedis the fee in proportion to the amount refunded, which is whatrefund_application_feereturns.publisher_netsubtracts the publisher's share of refunds (the reversed transfer). Disputes are counted but not subtracted.Refunds:
POST /v1/admin/purchases/{id}/refundtakes{amount?, reason?, note?}.refunds->createwithpayment_intent,reverse_transfer: trueandrefund_application_fee: true. The idempotency key covers the purchase's refunded-so-far and the request, so a double click returns the same refund.purchase.refund_requestedEvent with the staff member, the amount, the reason and the note, and answers 202. Revoking the licence is still left to the existingcharge.refundedwebhook.Finance page at
/review/finance, with a Finance tab in the review console:Notes
recordedSale()moved fromPayoutsAndBillingTest.phptotests/Helpers/commerce.phpso both test files can use it.POST /v1/refundsfrom the newtests/Fixtures/stripe/refund.json.Tests
feat/commerce(cae865f) (8 new tests intests/Feature/Commerce/FinanceTest.php)resources/js/components/review/Finance.test.jsx)