Skip to content
Merged
Show file tree
Hide file tree
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 .stats.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
configured_endpoints: 239
openapi_spec_hash: d691eb2845a0108278fe81faa111d29f
openapi_spec_hash: 85e424bee4fe449466ceada88117613e
config_hash: 1ca082e374ef7000e2a5971e8da740e0
2 changes: 1 addition & 1 deletion scripts/mock

Large diffs are not rendered by default.

81 changes: 36 additions & 45 deletions src/Accounts/AccountCreateParams/Loan.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*
* @phpstan-type LoanShape = array{
* creditLimit: int,
* gracePeriodDays: int,
* statementDayOfMonth: int,
* statementPaymentType: StatementPaymentType|value-of<StatementPaymentType>,
* gracePeriodDays?: int|null,
* maturityDate?: string|null,
* statementDayOfMonth?: int|null,
* statementPaymentType?: null|StatementPaymentType|value-of<StatementPaymentType>,
* }
*/
final class Loan implements BaseModel
Expand All @@ -35,50 +35,41 @@ final class Loan implements BaseModel
/**
* The number of days after the statement date that the Account can be past due before being considered delinquent.
*/
#[Required('grace_period_days')]
public int $gracePeriodDays;
#[Optional('grace_period_days')]
public ?int $gracePeriodDays;

/**
* The date on which the loan matures.
*/
#[Optional('maturity_date')]
public ?string $maturityDate;

/**
* The day of the month on which the loan statement is generated.
*/
#[Required('statement_day_of_month')]
public int $statementDayOfMonth;
#[Optional('statement_day_of_month')]
public ?int $statementDayOfMonth;

/**
* The type of statement payment for the account.
*
* @var value-of<StatementPaymentType> $statementPaymentType
* @var value-of<StatementPaymentType>|null $statementPaymentType
*/
#[Required('statement_payment_type', enum: StatementPaymentType::class)]
public string $statementPaymentType;

/**
* The date on which the loan matures.
*/
#[Optional('maturity_date')]
public ?string $maturityDate;
#[Optional('statement_payment_type', enum: StatementPaymentType::class)]
public ?string $statementPaymentType;

/**
* `new Loan()` is missing required properties by the API.
*
* To enforce required parameters use
* ```
* Loan::with(
* creditLimit: ...,
* gracePeriodDays: ...,
* statementDayOfMonth: ...,
* statementPaymentType: ...,
* )
* Loan::with(creditLimit: ...)
* ```
*
* Otherwise ensure the following setters are called
*
* ```
* (new Loan)
* ->withCreditLimit(...)
* ->withGracePeriodDays(...)
* ->withStatementDayOfMonth(...)
* ->withStatementPaymentType(...)
* (new Loan)->withCreditLimit(...)
* ```
*/
public function __construct()
Expand All @@ -91,23 +82,23 @@ public function __construct()
*
* You must use named parameters to construct any parameters with a default value.
*
* @param StatementPaymentType|value-of<StatementPaymentType> $statementPaymentType
* @param StatementPaymentType|value-of<StatementPaymentType>|null $statementPaymentType
*/
public static function with(
int $creditLimit,
int $gracePeriodDays,
int $statementDayOfMonth,
StatementPaymentType|string $statementPaymentType,
?int $gracePeriodDays = null,
?string $maturityDate = null,
?int $statementDayOfMonth = null,
StatementPaymentType|string|null $statementPaymentType = null,
): self {
$self = new self;

$self['creditLimit'] = $creditLimit;
$self['gracePeriodDays'] = $gracePeriodDays;
$self['statementDayOfMonth'] = $statementDayOfMonth;
$self['statementPaymentType'] = $statementPaymentType;

null !== $gracePeriodDays && $self['gracePeriodDays'] = $gracePeriodDays;
null !== $maturityDate && $self['maturityDate'] = $maturityDate;
null !== $statementDayOfMonth && $self['statementDayOfMonth'] = $statementDayOfMonth;
null !== $statementPaymentType && $self['statementPaymentType'] = $statementPaymentType;

return $self;
}
Expand All @@ -134,6 +125,17 @@ public function withGracePeriodDays(int $gracePeriodDays): self
return $self;
}

/**
* The date on which the loan matures.
*/
public function withMaturityDate(string $maturityDate): self
{
$self = clone $this;
$self['maturityDate'] = $maturityDate;

return $self;
}

/**
* The day of the month on which the loan statement is generated.
*/
Expand All @@ -158,15 +160,4 @@ public function withStatementPaymentType(

return $self;
}

/**
* The date on which the loan matures.
*/
public function withMaturityDate(string $maturityDate): self
{
$self = clone $this;
$self['maturityDate'] = $maturityDate;

return $self;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ enum EventCategory: string

case PHYSICAL_CHECK_UPDATED = 'physical_check.updated';

case PLAID_PROCESSOR_TOKEN_CREATED = 'plaid_processor_token.created';

case CHECKBOOK_CREATED = 'checkbook.created';

case CHECKBOOK_UPDATED = 'checkbook.updated';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ enum EventCategory: string

case PHYSICAL_CHECK_UPDATED = 'physical_check.updated';

case PLAID_PROCESSOR_TOKEN_CREATED = 'plaid_processor_token.created';

case CHECKBOOK_CREATED = 'checkbook.created';

case CHECKBOOK_UPDATED = 'checkbook.updated';
Expand Down
2 changes: 2 additions & 0 deletions src/Events/Event/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ enum Category: string

case PHYSICAL_CHECK_UPDATED = 'physical_check.updated';

case PLAID_PROCESSOR_TOKEN_CREATED = 'plaid_processor_token.created';

case CHECKBOOK_CREATED = 'checkbook.created';

case CHECKBOOK_UPDATED = 'checkbook.updated';
Expand Down
2 changes: 2 additions & 0 deletions src/Events/EventListParams/Category/In.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ enum In: string

case PHYSICAL_CHECK_UPDATED = 'physical_check.updated';

case PLAID_PROCESSOR_TOKEN_CREATED = 'plaid_processor_token.created';

case CHECKBOOK_CREATED = 'checkbook.created';

case CHECKBOOK_UPDATED = 'checkbook.updated';
Expand Down
2 changes: 2 additions & 0 deletions src/Events/UnwrapWebhookEvent/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ enum Category: string

case PHYSICAL_CHECK_UPDATED = 'physical_check.updated';

case PLAID_PROCESSOR_TOKEN_CREATED = 'plaid_processor_token.created';

case CHECKBOOK_CREATED = 'checkbook.created';

case CHECKBOOK_UPDATED = 'checkbook.updated';
Expand Down
4 changes: 2 additions & 2 deletions src/PendingTransactions/PendingTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final class PendingTransaction implements BaseModel
public string $accountID;

/**
* The Pending Transaction amount in the minor unit of its currency. For dollars, for example, this is cents. This amount does not change after the Pending Transaction is created. If a card authorization settles for a different amount, the settled amount is available on the resulting Transaction and on the Card Payment's `state.settled_amount`.
* The Pending Transaction amount in the minor unit of its currency. For dollars, for example, this is cents. For a card authorization this is the amount still held: it decreases when the merchant reverses part of the authorization. The amount that settled is available on the resulting Transaction and on the Card Payment's `state.settled_amount`.
*/
#[Required]
public int $amount;
Expand Down Expand Up @@ -239,7 +239,7 @@ public function withAccountID(string $accountID): self
}

/**
* The Pending Transaction amount in the minor unit of its currency. For dollars, for example, this is cents. This amount does not change after the Pending Transaction is created. If a card authorization settles for a different amount, the settled amount is available on the resulting Transaction and on the Card Payment's `state.settled_amount`.
* The Pending Transaction amount in the minor unit of its currency. For dollars, for example, this is cents. For a card authorization this is the amount still held: it decreases when the merchant reverses part of the authorization. The amount that settled is available on the resulting Transaction and on the Card Payment's `state.settled_amount`.
*/
public function withAmount(int $amount): self
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Services/AccountsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public function testCreateWithOptionalParams(): void
loan: [
'creditLimit' => 0,
'gracePeriodDays' => 0,
'maturityDate' => '2019-12-27',
'statementDayOfMonth' => 1,
'statementPaymentType' => 'balance',
'maturityDate' => '2019-12-27',
],
programID: 'program_i2v2os4mwza1oetokh9i',
);
Expand Down