mirror of
https://github.com/anikeen-com/id.git
synced 2026-11-04 22:59:41 +00:00
Bring the package up to date with the Anikeen ID API
Fixed (called endpoints that don't exist):
- charge(): POST v1/billing/charge (Stripe options aren't passed through anymore)
- Invoice::getInvoiceTemporaryUrl(): GET instead of a non-existent PUT
- OrderItems::create(): POST v1/orders/{order}/items
- createUser() / isEmailExisting(): admin endpoints with the app token
- sshKeysByUserId(): app endpoint; no longer returns the first user's keys for every user
- createOrderPreview(): country_iso goes into billing_address as the API expects
- public endpoints (products, order preview) work without a token
- SshKeys::find() results can be deleted
Added:
- Billable: sshKeys() (create, update, delete), billingOverview(), PaymentMethod::delete()
- AnikeenId: products(), boxes(), shipping labels (list, show, pdf, issue, ship, price list),
createOrderForUser(), createTransactionForUser(), findOrCreateSocialiteUser()
Requirements: PHP 8.2+, Laravel 11-13 (Laravel 10 and PHP 8.1 are end of life).
Docs generator handles union types; README regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8de737641e
commit
9613d31a8d
22 files changed
+720
-108
No files matched your search
@@ -30,21 +30,31 @@ trait ManagesBalance
|
||||
}
|
||||
|
||||
/**
|
||||
* Charge given amount from bank to current user.
|
||||
* Billing overview of the current user: current_balance, current_charges, vat_rate,
|
||||
* has_billing_address, has_default_payment_method, open_orders.
|
||||
*
|
||||
* @param float $amount Amount to charge in euros.
|
||||
* @param string $paymentMethodId Payment method ID.
|
||||
* @param array $options Additional options for the charge.
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function charge(float $amount, string $paymentMethodId, array $options = []): Transaction
|
||||
public function billingOverview(): object
|
||||
{
|
||||
return $this->anikeenId()->request('GET', 'v1/billing')->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Charge given amount (deposit) from one of the current user's payment methods.
|
||||
*
|
||||
* @param float|string $amount Amount in euros (0.50 to 10,000, at most 2 decimals).
|
||||
* @param string $paymentMethodId Stripe payment method ID (pm_…).
|
||||
* @param array $options Ignored; Stripe options can no longer be passed through.
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function charge(float|string $amount, string $paymentMethodId, array $options = []): Transaction
|
||||
{
|
||||
return (new Transaction(fn() => $this->anikeenId()
|
||||
->request('POST', 'billing/charge', [
|
||||
->request('POST', 'v1/billing/charge', [
|
||||
'amount' => $amount,
|
||||
'payment_method_id' => $paymentMethodId,
|
||||
'options' => $options,
|
||||
])))
|
||||
->setBillable($this);
|
||||
}
|
||||
}
|
||||
}␍
|
||||
Reference in new issue
Block a user