AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

StripeAccount.php 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace App\Models;
  3. use Carbon\CarbonInterface;
  4. use Illuminate\Database\Eloquent\Attributes\Fillable;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  7. /**
  8. * A store's own Stripe account (Stripe Connect). Shoppers' payments go straight into it.
  9. *
  10. * @property int $id
  11. * @property int $store_id
  12. * @property string $account_id Stripe's id, such as acct_1Abc...
  13. * @property bool $charges_enabled Stripe lets the account take payments
  14. * @property bool $payouts_enabled Stripe pays the money into the merchant's bank
  15. * @property bool $details_submitted The merchant finished Stripe's sign-up form
  16. * @property bool $fpx_requested FPX (online banking) was asked for
  17. * @property bool $grabpay_requested GrabPay was asked for
  18. * @property CarbonInterface|null $checked_at When we last asked Stripe
  19. * @property CarbonInterface|null $created_at
  20. * @property CarbonInterface|null $updated_at
  21. * @property-read Store $store
  22. */
  23. #[Fillable(['account_id', 'charges_enabled', 'payouts_enabled', 'details_submitted', 'fpx_requested', 'grabpay_requested', 'checked_at'])]
  24. class StripeAccount extends Model
  25. {
  26. /**
  27. * @return BelongsTo<Store, $this>
  28. */
  29. public function store(): BelongsTo
  30. {
  31. return $this->belongsTo(Store::class);
  32. }
  33. /**
  34. * Malaysian payment methods asked for on the account, by our name, with the column that remembers it.
  35. * Cards are always on.
  36. */
  37. public const array METHODS = ['fpx' => 'fpx_requested', 'grabpay' => 'grabpay_requested'];
  38. /**
  39. * The methods not asked for yet.
  40. *
  41. * @return list<string>
  42. */
  43. public function methodsToRequest(): array
  44. {
  45. return array_keys(array_filter(self::METHODS, fn (string $column) => ! $this->{$column}));
  46. }
  47. /**
  48. * @return array<string, string>
  49. */
  50. protected function casts(): array
  51. {
  52. return [
  53. 'charges_enabled' => 'boolean',
  54. 'payouts_enabled' => 'boolean',
  55. 'details_submitted' => 'boolean',
  56. 'fpx_requested' => 'boolean',
  57. 'grabpay_requested' => 'boolean',
  58. 'checked_at' => 'datetime',
  59. ];
  60. }
  61. }