diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8935e93..b8dda9b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.28.0" + ".": "0.29.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 625e421..d4eadd5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-cff24fe63c8cb06a46048b355f873c22def0798a38de892671d379e58d98bc03.yml -openapi_spec_hash: 4f7ae65440fefa73441023480d6ac9a4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-845aba046473ba39ae898570153537fb31dd6f8cb260dd8478a14fd4275ca97f.yml +openapi_spec_hash: 8afbe65f9d6614f0960f141ae0de0c39 config_hash: 27e44ed36b9c5617b580ead7231a594a diff --git a/CHANGELOG.md b/CHANGELOG.md index 326f3d7..2143678 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.29.0 (2026-02-07) + +Full Changelog: [v0.28.0...v0.29.0](https://github.com/Increase/increase-php/compare/v0.28.0...v0.29.0) + +### Features + +* **api:** api update ([91ee39f](https://github.com/Increase/increase-php/commit/91ee39f28a93655a31f351c982317ce4cabcd645)) + ## 0.28.0 (2026-02-06) Full Changelog: [v0.27.0...v0.28.0](https://github.com/Increase/increase-php/compare/v0.27.0...v0.28.0) diff --git a/README.md b/README.md index 9a56439..473d94f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ``` -composer require "increase/increase 0.28.0" +composer require "increase/increase 0.29.0" ``` diff --git a/src/ACHTransfers/ACHTransfer/Addenda.php b/src/ACHTransfers/ACHTransfer/Addenda.php index d0daae8..c693511 100644 --- a/src/ACHTransfers/ACHTransfer/Addenda.php +++ b/src/ACHTransfers/ACHTransfer/Addenda.php @@ -7,6 +7,7 @@ use Increase\ACHTransfers\ACHTransfer\Addenda\Category; use Increase\ACHTransfers\ACHTransfer\Addenda\Freeform; use Increase\ACHTransfers\ACHTransfer\Addenda\PaymentOrderRemittanceAdvice; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -19,8 +20,8 @@ * * @phpstan-type AddendaShape = array{ * category: Category|value-of, - * freeform: null|Freeform|FreeformShape, - * paymentOrderRemittanceAdvice: null|PaymentOrderRemittanceAdvice|PaymentOrderRemittanceAdviceShape, + * freeform?: null|Freeform|FreeformShape, + * paymentOrderRemittanceAdvice?: null|PaymentOrderRemittanceAdvice|PaymentOrderRemittanceAdviceShape, * } */ final class Addenda implements BaseModel @@ -39,13 +40,13 @@ final class Addenda implements BaseModel /** * Unstructured `payment_related_information` passed through with the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?Freeform $freeform; /** * Structured ASC X12 820 remittance advice records. Please reach out to [support@increase.com](mailto:support@increase.com) for more information. */ - #[Required('payment_order_remittance_advice')] + #[Optional('payment_order_remittance_advice', nullable: true)] public ?PaymentOrderRemittanceAdvice $paymentOrderRemittanceAdvice; /** @@ -53,16 +54,13 @@ final class Addenda implements BaseModel * * To enforce required parameters use * ``` - * Addenda::with(category: ..., freeform: ..., paymentOrderRemittanceAdvice: ...) + * Addenda::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Addenda) - * ->withCategory(...) - * ->withFreeform(...) - * ->withPaymentOrderRemittanceAdvice(...) + * (new Addenda)->withCategory(...) * ``` */ public function __construct() @@ -81,14 +79,15 @@ public function __construct() */ public static function with( Category|string $category, - Freeform|array|null $freeform, - PaymentOrderRemittanceAdvice|array|null $paymentOrderRemittanceAdvice, + Freeform|array|null $freeform = null, + PaymentOrderRemittanceAdvice|array|null $paymentOrderRemittanceAdvice = null, ): self { $self = new self; $self['category'] = $category; - $self['freeform'] = $freeform; - $self['paymentOrderRemittanceAdvice'] = $paymentOrderRemittanceAdvice; + + null !== $freeform && $self['freeform'] = $freeform; + null !== $paymentOrderRemittanceAdvice && $self['paymentOrderRemittanceAdvice'] = $paymentOrderRemittanceAdvice; return $self; } diff --git a/src/ACHTransfers/ACHTransfer/CreatedBy.php b/src/ACHTransfers/ACHTransfer/CreatedBy.php index 4af82f2..2a5c7e3 100644 --- a/src/ACHTransfers/ACHTransfer/CreatedBy.php +++ b/src/ACHTransfers/ACHTransfer/CreatedBy.php @@ -8,6 +8,7 @@ use Increase\ACHTransfers\ACHTransfer\CreatedBy\Category; use Increase\ACHTransfers\ACHTransfer\CreatedBy\OAuthApplication; use Increase\ACHTransfers\ACHTransfer\CreatedBy\User; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -20,10 +21,10 @@ * @phpstan-import-type UserShape from \Increase\ACHTransfers\ACHTransfer\CreatedBy\User * * @phpstan-type CreatedByShape = array{ - * apiKey: null|APIKey|APIKeyShape, * category: Category|value-of, - * oauthApplication: null|OAuthApplication|OAuthApplicationShape, - * user: null|User|UserShape, + * apiKey?: null|APIKey|APIKeyShape, + * oauthApplication?: null|OAuthApplication|OAuthApplicationShape, + * user?: null|User|UserShape, * } */ final class CreatedBy implements BaseModel @@ -31,12 +32,6 @@ final class CreatedBy implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * If present, details about the API key that created the transfer. - */ - #[Required('api_key')] - public ?APIKey $apiKey; - /** * The type of object that created this transfer. * @@ -45,16 +40,22 @@ final class CreatedBy implements BaseModel #[Required(enum: Category::class)] public string $category; + /** + * If present, details about the API key that created the transfer. + */ + #[Optional('api_key', nullable: true)] + public ?APIKey $apiKey; + /** * If present, details about the OAuth Application that created the transfer. */ - #[Required('oauth_application')] + #[Optional('oauth_application', nullable: true)] public ?OAuthApplication $oauthApplication; /** * If present, details about the User that created the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?User $user; /** @@ -62,17 +63,13 @@ final class CreatedBy implements BaseModel * * To enforce required parameters use * ``` - * CreatedBy::with(apiKey: ..., category: ..., oauthApplication: ..., user: ...) + * CreatedBy::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new CreatedBy) - * ->withAPIKey(...) - * ->withCategory(...) - * ->withOAuthApplication(...) - * ->withUser(...) + * (new CreatedBy)->withCategory(...) * ``` */ public function __construct() @@ -85,49 +82,50 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param APIKey|APIKeyShape|null $apiKey * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey * @param OAuthApplication|OAuthApplicationShape|null $oauthApplication * @param User|UserShape|null $user */ public static function with( - APIKey|array|null $apiKey, Category|string $category, - OAuthApplication|array|null $oauthApplication, - User|array|null $user, + APIKey|array|null $apiKey = null, + OAuthApplication|array|null $oauthApplication = null, + User|array|null $user = null, ): self { $self = new self; - $self['apiKey'] = $apiKey; $self['category'] = $category; - $self['oauthApplication'] = $oauthApplication; - $self['user'] = $user; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $oauthApplication && $self['oauthApplication'] = $oauthApplication; + null !== $user && $self['user'] = $user; return $self; } /** - * If present, details about the API key that created the transfer. + * The type of object that created this transfer. * - * @param APIKey|APIKeyShape|null $apiKey + * @param Category|value-of $category */ - public function withAPIKey(APIKey|array|null $apiKey): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['apiKey'] = $apiKey; + $self['category'] = $category; return $self; } /** - * The type of object that created this transfer. + * If present, details about the API key that created the transfer. * - * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey */ - public function withCategory(Category|string $category): self + public function withAPIKey(APIKey|array|null $apiKey): self { $self = clone $this; - $self['category'] = $category; + $self['apiKey'] = $apiKey; return $self; } diff --git a/src/AccountTransfers/AccountTransfer/CreatedBy.php b/src/AccountTransfers/AccountTransfer/CreatedBy.php index c8ce474..7d542e8 100644 --- a/src/AccountTransfers/AccountTransfer/CreatedBy.php +++ b/src/AccountTransfers/AccountTransfer/CreatedBy.php @@ -8,6 +8,7 @@ use Increase\AccountTransfers\AccountTransfer\CreatedBy\Category; use Increase\AccountTransfers\AccountTransfer\CreatedBy\OAuthApplication; use Increase\AccountTransfers\AccountTransfer\CreatedBy\User; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -20,10 +21,10 @@ * @phpstan-import-type UserShape from \Increase\AccountTransfers\AccountTransfer\CreatedBy\User * * @phpstan-type CreatedByShape = array{ - * apiKey: null|APIKey|APIKeyShape, * category: Category|value-of, - * oauthApplication: null|OAuthApplication|OAuthApplicationShape, - * user: null|User|UserShape, + * apiKey?: null|APIKey|APIKeyShape, + * oauthApplication?: null|OAuthApplication|OAuthApplicationShape, + * user?: null|User|UserShape, * } */ final class CreatedBy implements BaseModel @@ -31,12 +32,6 @@ final class CreatedBy implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * If present, details about the API key that created the transfer. - */ - #[Required('api_key')] - public ?APIKey $apiKey; - /** * The type of object that created this transfer. * @@ -45,16 +40,22 @@ final class CreatedBy implements BaseModel #[Required(enum: Category::class)] public string $category; + /** + * If present, details about the API key that created the transfer. + */ + #[Optional('api_key', nullable: true)] + public ?APIKey $apiKey; + /** * If present, details about the OAuth Application that created the transfer. */ - #[Required('oauth_application')] + #[Optional('oauth_application', nullable: true)] public ?OAuthApplication $oauthApplication; /** * If present, details about the User that created the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?User $user; /** @@ -62,17 +63,13 @@ final class CreatedBy implements BaseModel * * To enforce required parameters use * ``` - * CreatedBy::with(apiKey: ..., category: ..., oauthApplication: ..., user: ...) + * CreatedBy::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new CreatedBy) - * ->withAPIKey(...) - * ->withCategory(...) - * ->withOAuthApplication(...) - * ->withUser(...) + * (new CreatedBy)->withCategory(...) * ``` */ public function __construct() @@ -85,49 +82,50 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param APIKey|APIKeyShape|null $apiKey * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey * @param OAuthApplication|OAuthApplicationShape|null $oauthApplication * @param User|UserShape|null $user */ public static function with( - APIKey|array|null $apiKey, Category|string $category, - OAuthApplication|array|null $oauthApplication, - User|array|null $user, + APIKey|array|null $apiKey = null, + OAuthApplication|array|null $oauthApplication = null, + User|array|null $user = null, ): self { $self = new self; - $self['apiKey'] = $apiKey; $self['category'] = $category; - $self['oauthApplication'] = $oauthApplication; - $self['user'] = $user; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $oauthApplication && $self['oauthApplication'] = $oauthApplication; + null !== $user && $self['user'] = $user; return $self; } /** - * If present, details about the API key that created the transfer. + * The type of object that created this transfer. * - * @param APIKey|APIKeyShape|null $apiKey + * @param Category|value-of $category */ - public function withAPIKey(APIKey|array|null $apiKey): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['apiKey'] = $apiKey; + $self['category'] = $category; return $self; } /** - * The type of object that created this transfer. + * If present, details about the API key that created the transfer. * - * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey */ - public function withCategory(Category|string $category): self + public function withAPIKey(APIKey|array|null $apiKey): self { $self = clone $this; - $self['category'] = $category; + $self['apiKey'] = $apiKey; return $self; } diff --git a/src/CardDisputes/CardDispute/Visa/NetworkEvent.php b/src/CardDisputes/CardDispute/Visa/NetworkEvent.php index b23af3d..050958d 100644 --- a/src/CardDisputes/CardDispute/Visa/NetworkEvent.php +++ b/src/CardDisputes/CardDispute/Visa/NetworkEvent.php @@ -19,6 +19,7 @@ use Increase\CardDisputes\CardDispute\Visa\NetworkEvent\UserPrearbitrationSubmitted; use Increase\CardDisputes\CardDispute\Visa\NetworkEvent\UserPrearbitrationTimedOut; use Increase\CardDisputes\CardDispute\Visa\NetworkEvent\UserWithdrawalSubmitted; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -42,21 +43,21 @@ * @phpstan-type NetworkEventShape = array{ * attachmentFiles: list, * category: Category|value-of, - * chargebackAccepted: null|ChargebackAccepted|ChargebackAcceptedShape, - * chargebackSubmitted: null|ChargebackSubmitted|ChargebackSubmittedShape, - * chargebackTimedOut: null|ChargebackTimedOut|ChargebackTimedOutShape, * createdAt: \DateTimeInterface, * disputeFinancialTransactionID: string|null, - * merchantPrearbitrationDeclineSubmitted: null|MerchantPrearbitrationDeclineSubmitted|MerchantPrearbitrationDeclineSubmittedShape, - * merchantPrearbitrationReceived: null|MerchantPrearbitrationReceived|MerchantPrearbitrationReceivedShape, - * merchantPrearbitrationTimedOut: null|MerchantPrearbitrationTimedOut|MerchantPrearbitrationTimedOutShape, - * represented: null|Represented|RepresentedShape, - * representmentTimedOut: null|RepresentmentTimedOut|RepresentmentTimedOutShape, - * userPrearbitrationAccepted: null|UserPrearbitrationAccepted|UserPrearbitrationAcceptedShape, - * userPrearbitrationDeclined: null|UserPrearbitrationDeclined|UserPrearbitrationDeclinedShape, - * userPrearbitrationSubmitted: null|UserPrearbitrationSubmitted|UserPrearbitrationSubmittedShape, - * userPrearbitrationTimedOut: null|UserPrearbitrationTimedOut|UserPrearbitrationTimedOutShape, - * userWithdrawalSubmitted: null|UserWithdrawalSubmitted|UserWithdrawalSubmittedShape, + * chargebackAccepted?: null|ChargebackAccepted|ChargebackAcceptedShape, + * chargebackSubmitted?: null|ChargebackSubmitted|ChargebackSubmittedShape, + * chargebackTimedOut?: null|ChargebackTimedOut|ChargebackTimedOutShape, + * merchantPrearbitrationDeclineSubmitted?: null|MerchantPrearbitrationDeclineSubmitted|MerchantPrearbitrationDeclineSubmittedShape, + * merchantPrearbitrationReceived?: null|MerchantPrearbitrationReceived|MerchantPrearbitrationReceivedShape, + * merchantPrearbitrationTimedOut?: null|MerchantPrearbitrationTimedOut|MerchantPrearbitrationTimedOutShape, + * represented?: null|Represented|RepresentedShape, + * representmentTimedOut?: null|RepresentmentTimedOut|RepresentmentTimedOutShape, + * userPrearbitrationAccepted?: null|UserPrearbitrationAccepted|UserPrearbitrationAcceptedShape, + * userPrearbitrationDeclined?: null|UserPrearbitrationDeclined|UserPrearbitrationDeclinedShape, + * userPrearbitrationSubmitted?: null|UserPrearbitrationSubmitted|UserPrearbitrationSubmittedShape, + * userPrearbitrationTimedOut?: null|UserPrearbitrationTimedOut|UserPrearbitrationTimedOutShape, + * userWithdrawalSubmitted?: null|UserWithdrawalSubmitted|UserWithdrawalSubmittedShape, * } */ final class NetworkEvent implements BaseModel @@ -81,93 +82,93 @@ final class NetworkEvent implements BaseModel public string $category; /** - * A Card Dispute Chargeback Accepted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `chargeback_accepted`. Contains the details specific to a chargeback accepted Visa Card Dispute Network Event, which represents that a chargeback has been accepted by the merchant. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Visa Card Dispute Network Event was created. */ - #[Required('chargeback_accepted')] - public ?ChargebackAccepted $chargebackAccepted; + #[Required('created_at')] + public \DateTimeInterface $createdAt; /** - * A Card Dispute Chargeback Submitted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `chargeback_submitted`. Contains the details specific to a chargeback submitted Visa Card Dispute Network Event, which represents that a chargeback has been submitted to the network. + * The dispute financial transaction that resulted from the network event, if any. */ - #[Required('chargeback_submitted')] - public ?ChargebackSubmitted $chargebackSubmitted; + #[Required('dispute_financial_transaction_id')] + public ?string $disputeFinancialTransactionID; /** - * A Card Dispute Chargeback Timed Out Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `chargeback_timed_out`. Contains the details specific to a chargeback timed out Visa Card Dispute Network Event, which represents that the chargeback has timed out in the user's favor. + * A Card Dispute Chargeback Accepted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `chargeback_accepted`. Contains the details specific to a chargeback accepted Visa Card Dispute Network Event, which represents that a chargeback has been accepted by the merchant. */ - #[Required('chargeback_timed_out')] - public ?ChargebackTimedOut $chargebackTimedOut; + #[Optional('chargeback_accepted', nullable: true)] + public ?ChargebackAccepted $chargebackAccepted; /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Visa Card Dispute Network Event was created. + * A Card Dispute Chargeback Submitted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `chargeback_submitted`. Contains the details specific to a chargeback submitted Visa Card Dispute Network Event, which represents that a chargeback has been submitted to the network. */ - #[Required('created_at')] - public \DateTimeInterface $createdAt; + #[Optional('chargeback_submitted', nullable: true)] + public ?ChargebackSubmitted $chargebackSubmitted; /** - * The dispute financial transaction that resulted from the network event, if any. + * A Card Dispute Chargeback Timed Out Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `chargeback_timed_out`. Contains the details specific to a chargeback timed out Visa Card Dispute Network Event, which represents that the chargeback has timed out in the user's favor. */ - #[Required('dispute_financial_transaction_id')] - public ?string $disputeFinancialTransactionID; + #[Optional('chargeback_timed_out', nullable: true)] + public ?ChargebackTimedOut $chargebackTimedOut; /** * A Card Dispute Merchant Pre-Arbitration Decline Submitted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_decline_submitted`. Contains the details specific to a merchant prearbitration decline submitted Visa Card Dispute Network Event, which represents that the user has declined the merchant's request for a prearbitration request decision in their favor. */ - #[Required('merchant_prearbitration_decline_submitted')] + #[Optional('merchant_prearbitration_decline_submitted', nullable: true)] public ?MerchantPrearbitrationDeclineSubmitted $merchantPrearbitrationDeclineSubmitted; /** * A Card Dispute Merchant Pre-Arbitration Received Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_received`. Contains the details specific to a merchant prearbitration received Visa Card Dispute Network Event, which represents that the merchant has issued a prearbitration request in the user's favor. */ - #[Required('merchant_prearbitration_received')] + #[Optional('merchant_prearbitration_received', nullable: true)] public ?MerchantPrearbitrationReceived $merchantPrearbitrationReceived; /** * A Card Dispute Merchant Pre-Arbitration Timed Out Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_timed_out`. Contains the details specific to a merchant prearbitration timed out Visa Card Dispute Network Event, which represents that the user has timed out responding to the merchant's prearbitration request. */ - #[Required('merchant_prearbitration_timed_out')] + #[Optional('merchant_prearbitration_timed_out', nullable: true)] public ?MerchantPrearbitrationTimedOut $merchantPrearbitrationTimedOut; /** * A Card Dispute Re-presented Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `represented`. Contains the details specific to a re-presented Visa Card Dispute Network Event, which represents that the merchant has declined the user's chargeback and has re-presented the payment. */ - #[Required] + #[Optional(nullable: true)] public ?Represented $represented; /** * A Card Dispute Re-presentment Timed Out Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `representment_timed_out`. Contains the details specific to a re-presentment time-out Visa Card Dispute Network Event, which represents that the user did not respond to the re-presentment by the merchant within the time limit. */ - #[Required('representment_timed_out')] + #[Optional('representment_timed_out', nullable: true)] public ?RepresentmentTimedOut $representmentTimedOut; /** * A Card Dispute User Pre-Arbitration Accepted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration_accepted`. Contains the details specific to a user prearbitration accepted Visa Card Dispute Network Event, which represents that the merchant has accepted the user's prearbitration request in the user's favor. */ - #[Required('user_prearbitration_accepted')] + #[Optional('user_prearbitration_accepted', nullable: true)] public ?UserPrearbitrationAccepted $userPrearbitrationAccepted; /** * A Card Dispute User Pre-Arbitration Declined Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration_declined`. Contains the details specific to a user prearbitration declined Visa Card Dispute Network Event, which represents that the merchant has declined the user's prearbitration request. */ - #[Required('user_prearbitration_declined')] + #[Optional('user_prearbitration_declined', nullable: true)] public ?UserPrearbitrationDeclined $userPrearbitrationDeclined; /** * A Card Dispute User Pre-Arbitration Submitted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration_submitted`. Contains the details specific to a user prearbitration submitted Visa Card Dispute Network Event, which represents that the user's request for prearbitration has been submitted to the network. */ - #[Required('user_prearbitration_submitted')] + #[Optional('user_prearbitration_submitted', nullable: true)] public ?UserPrearbitrationSubmitted $userPrearbitrationSubmitted; /** * A Card Dispute User Pre-Arbitration Timed Out Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration_timed_out`. Contains the details specific to a user prearbitration timed out Visa Card Dispute Network Event, which represents that the merchant has timed out responding to the user's prearbitration request. */ - #[Required('user_prearbitration_timed_out')] + #[Optional('user_prearbitration_timed_out', nullable: true)] public ?UserPrearbitrationTimedOut $userPrearbitrationTimedOut; /** * A Card Dispute User Withdrawal Submitted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `user_withdrawal_submitted`. Contains the details specific to a user withdrawal submitted Visa Card Dispute Network Event, which represents that the user's request to withdraw the dispute has been submitted to the network. */ - #[Required('user_withdrawal_submitted')] + #[Optional('user_withdrawal_submitted', nullable: true)] public ?UserWithdrawalSubmitted $userWithdrawalSubmitted; /** @@ -178,21 +179,8 @@ final class NetworkEvent implements BaseModel * NetworkEvent::with( * attachmentFiles: ..., * category: ..., - * chargebackAccepted: ..., - * chargebackSubmitted: ..., - * chargebackTimedOut: ..., * createdAt: ..., * disputeFinancialTransactionID: ..., - * merchantPrearbitrationDeclineSubmitted: ..., - * merchantPrearbitrationReceived: ..., - * merchantPrearbitrationTimedOut: ..., - * represented: ..., - * representmentTimedOut: ..., - * userPrearbitrationAccepted: ..., - * userPrearbitrationDeclined: ..., - * userPrearbitrationSubmitted: ..., - * userPrearbitrationTimedOut: ..., - * userWithdrawalSubmitted: ..., * ) * ``` * @@ -202,21 +190,8 @@ final class NetworkEvent implements BaseModel * (new NetworkEvent) * ->withAttachmentFiles(...) * ->withCategory(...) - * ->withChargebackAccepted(...) - * ->withChargebackSubmitted(...) - * ->withChargebackTimedOut(...) * ->withCreatedAt(...) * ->withDisputeFinancialTransactionID(...) - * ->withMerchantPrearbitrationDeclineSubmitted(...) - * ->withMerchantPrearbitrationReceived(...) - * ->withMerchantPrearbitrationTimedOut(...) - * ->withRepresented(...) - * ->withRepresentmentTimedOut(...) - * ->withUserPrearbitrationAccepted(...) - * ->withUserPrearbitrationDeclined(...) - * ->withUserPrearbitrationSubmitted(...) - * ->withUserPrearbitrationTimedOut(...) - * ->withUserWithdrawalSubmitted(...) * ``` */ public function __construct() @@ -248,41 +223,42 @@ public function __construct() public static function with( array $attachmentFiles, Category|string $category, - ChargebackAccepted|array|null $chargebackAccepted, - ChargebackSubmitted|array|null $chargebackSubmitted, - ChargebackTimedOut|array|null $chargebackTimedOut, \DateTimeInterface $createdAt, ?string $disputeFinancialTransactionID, - MerchantPrearbitrationDeclineSubmitted|array|null $merchantPrearbitrationDeclineSubmitted, - MerchantPrearbitrationReceived|array|null $merchantPrearbitrationReceived, - MerchantPrearbitrationTimedOut|array|null $merchantPrearbitrationTimedOut, - Represented|array|null $represented, - RepresentmentTimedOut|array|null $representmentTimedOut, - UserPrearbitrationAccepted|array|null $userPrearbitrationAccepted, - UserPrearbitrationDeclined|array|null $userPrearbitrationDeclined, - UserPrearbitrationSubmitted|array|null $userPrearbitrationSubmitted, - UserPrearbitrationTimedOut|array|null $userPrearbitrationTimedOut, - UserWithdrawalSubmitted|array|null $userWithdrawalSubmitted, + ChargebackAccepted|array|null $chargebackAccepted = null, + ChargebackSubmitted|array|null $chargebackSubmitted = null, + ChargebackTimedOut|array|null $chargebackTimedOut = null, + MerchantPrearbitrationDeclineSubmitted|array|null $merchantPrearbitrationDeclineSubmitted = null, + MerchantPrearbitrationReceived|array|null $merchantPrearbitrationReceived = null, + MerchantPrearbitrationTimedOut|array|null $merchantPrearbitrationTimedOut = null, + Represented|array|null $represented = null, + RepresentmentTimedOut|array|null $representmentTimedOut = null, + UserPrearbitrationAccepted|array|null $userPrearbitrationAccepted = null, + UserPrearbitrationDeclined|array|null $userPrearbitrationDeclined = null, + UserPrearbitrationSubmitted|array|null $userPrearbitrationSubmitted = null, + UserPrearbitrationTimedOut|array|null $userPrearbitrationTimedOut = null, + UserWithdrawalSubmitted|array|null $userWithdrawalSubmitted = null, ): self { $self = new self; $self['attachmentFiles'] = $attachmentFiles; $self['category'] = $category; - $self['chargebackAccepted'] = $chargebackAccepted; - $self['chargebackSubmitted'] = $chargebackSubmitted; - $self['chargebackTimedOut'] = $chargebackTimedOut; $self['createdAt'] = $createdAt; $self['disputeFinancialTransactionID'] = $disputeFinancialTransactionID; - $self['merchantPrearbitrationDeclineSubmitted'] = $merchantPrearbitrationDeclineSubmitted; - $self['merchantPrearbitrationReceived'] = $merchantPrearbitrationReceived; - $self['merchantPrearbitrationTimedOut'] = $merchantPrearbitrationTimedOut; - $self['represented'] = $represented; - $self['representmentTimedOut'] = $representmentTimedOut; - $self['userPrearbitrationAccepted'] = $userPrearbitrationAccepted; - $self['userPrearbitrationDeclined'] = $userPrearbitrationDeclined; - $self['userPrearbitrationSubmitted'] = $userPrearbitrationSubmitted; - $self['userPrearbitrationTimedOut'] = $userPrearbitrationTimedOut; - $self['userWithdrawalSubmitted'] = $userWithdrawalSubmitted; + + null !== $chargebackAccepted && $self['chargebackAccepted'] = $chargebackAccepted; + null !== $chargebackSubmitted && $self['chargebackSubmitted'] = $chargebackSubmitted; + null !== $chargebackTimedOut && $self['chargebackTimedOut'] = $chargebackTimedOut; + null !== $merchantPrearbitrationDeclineSubmitted && $self['merchantPrearbitrationDeclineSubmitted'] = $merchantPrearbitrationDeclineSubmitted; + null !== $merchantPrearbitrationReceived && $self['merchantPrearbitrationReceived'] = $merchantPrearbitrationReceived; + null !== $merchantPrearbitrationTimedOut && $self['merchantPrearbitrationTimedOut'] = $merchantPrearbitrationTimedOut; + null !== $represented && $self['represented'] = $represented; + null !== $representmentTimedOut && $self['representmentTimedOut'] = $representmentTimedOut; + null !== $userPrearbitrationAccepted && $self['userPrearbitrationAccepted'] = $userPrearbitrationAccepted; + null !== $userPrearbitrationDeclined && $self['userPrearbitrationDeclined'] = $userPrearbitrationDeclined; + null !== $userPrearbitrationSubmitted && $self['userPrearbitrationSubmitted'] = $userPrearbitrationSubmitted; + null !== $userPrearbitrationTimedOut && $self['userPrearbitrationTimedOut'] = $userPrearbitrationTimedOut; + null !== $userWithdrawalSubmitted && $self['userWithdrawalSubmitted'] = $userWithdrawalSubmitted; return $self; } @@ -313,6 +289,29 @@ public function withCategory(Category|string $category): self return $self; } + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Visa Card Dispute Network Event was created. + */ + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * The dispute financial transaction that resulted from the network event, if any. + */ + public function withDisputeFinancialTransactionID( + ?string $disputeFinancialTransactionID + ): self { + $self = clone $this; + $self['disputeFinancialTransactionID'] = $disputeFinancialTransactionID; + + return $self; + } + /** * A Card Dispute Chargeback Accepted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `chargeback_accepted`. Contains the details specific to a chargeback accepted Visa Card Dispute Network Event, which represents that a chargeback has been accepted by the merchant. * @@ -355,29 +354,6 @@ public function withChargebackTimedOut( return $self; } - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Visa Card Dispute Network Event was created. - */ - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - /** - * The dispute financial transaction that resulted from the network event, if any. - */ - public function withDisputeFinancialTransactionID( - ?string $disputeFinancialTransactionID - ): self { - $self = clone $this; - $self['disputeFinancialTransactionID'] = $disputeFinancialTransactionID; - - return $self; - } - /** * A Card Dispute Merchant Pre-Arbitration Decline Submitted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_decline_submitted`. Contains the details specific to a merchant prearbitration decline submitted Visa Card Dispute Network Event, which represents that the user has declined the merchant's request for a prearbitration request decision in their favor. * diff --git a/src/CardDisputes/CardDispute/Visa/UserSubmission.php b/src/CardDisputes/CardDispute/Visa/UserSubmission.php index 26c266e..cb2463f 100644 --- a/src/CardDisputes/CardDispute/Visa/UserSubmission.php +++ b/src/CardDisputes/CardDispute/Visa/UserSubmission.php @@ -10,6 +10,7 @@ use Increase\CardDisputes\CardDispute\Visa\UserSubmission\MerchantPrearbitrationDecline; use Increase\CardDisputes\CardDispute\Visa\UserSubmission\Status; use Increase\CardDisputes\CardDispute\Visa\UserSubmission\UserPrearbitration; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -25,15 +26,15 @@ * amount: int|null, * attachmentFiles: list, * category: Category|value-of, - * chargeback: null|Chargeback|ChargebackShape, * createdAt: \DateTimeInterface, * explanation: string|null, * furtherInformationRequestedAt: \DateTimeInterface|null, * furtherInformationRequestedReason: string|null, - * merchantPrearbitrationDecline: null|MerchantPrearbitrationDecline|MerchantPrearbitrationDeclineShape, * status: Status|value-of, * updatedAt: \DateTimeInterface, - * userPrearbitration: null|UserPrearbitration|UserPrearbitrationShape, + * chargeback?: null|Chargeback|ChargebackShape, + * merchantPrearbitrationDecline?: null|MerchantPrearbitrationDecline|MerchantPrearbitrationDeclineShape, + * userPrearbitration?: null|UserPrearbitration|UserPrearbitrationShape, * } */ final class UserSubmission implements BaseModel @@ -69,12 +70,6 @@ final class UserSubmission implements BaseModel #[Required(enum: Category::class)] public string $category; - /** - * A Visa Card Dispute Chargeback User Submission Chargeback Details object. This field will be present in the JSON response if and only if `category` is equal to `chargeback`. Contains the details specific to a Visa chargeback User Submission for a Card Dispute. - */ - #[Required] - public ?Chargeback $chargeback; - /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Visa Card Dispute User Submission was created. */ @@ -99,12 +94,6 @@ final class UserSubmission implements BaseModel #[Required('further_information_requested_reason')] public ?string $furtherInformationRequestedReason; - /** - * A Visa Card Dispute Merchant Pre-Arbitration Decline User Submission object. This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_decline`. Contains the details specific to a merchant prearbitration decline Visa Card Dispute User Submission. - */ - #[Required('merchant_prearbitration_decline')] - public ?MerchantPrearbitrationDecline $merchantPrearbitrationDecline; - /** * The status of the Visa Card Dispute User Submission. * @@ -119,10 +108,22 @@ final class UserSubmission implements BaseModel #[Required('updated_at')] public \DateTimeInterface $updatedAt; + /** + * A Visa Card Dispute Chargeback User Submission Chargeback Details object. This field will be present in the JSON response if and only if `category` is equal to `chargeback`. Contains the details specific to a Visa chargeback User Submission for a Card Dispute. + */ + #[Optional(nullable: true)] + public ?Chargeback $chargeback; + + /** + * A Visa Card Dispute Merchant Pre-Arbitration Decline User Submission object. This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_decline`. Contains the details specific to a merchant prearbitration decline Visa Card Dispute User Submission. + */ + #[Optional('merchant_prearbitration_decline', nullable: true)] + public ?MerchantPrearbitrationDecline $merchantPrearbitrationDecline; + /** * A Visa Card Dispute User-Initiated Pre-Arbitration User Submission object. This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration`. Contains the details specific to a user-initiated pre-arbitration Visa Card Dispute User Submission. */ - #[Required('user_prearbitration')] + #[Optional('user_prearbitration', nullable: true)] public ?UserPrearbitration $userPrearbitration; /** @@ -135,15 +136,12 @@ final class UserSubmission implements BaseModel * amount: ..., * attachmentFiles: ..., * category: ..., - * chargeback: ..., * createdAt: ..., * explanation: ..., * furtherInformationRequestedAt: ..., * furtherInformationRequestedReason: ..., - * merchantPrearbitrationDecline: ..., * status: ..., * updatedAt: ..., - * userPrearbitration: ..., * ) * ``` * @@ -155,15 +153,12 @@ final class UserSubmission implements BaseModel * ->withAmount(...) * ->withAttachmentFiles(...) * ->withCategory(...) - * ->withChargeback(...) * ->withCreatedAt(...) * ->withExplanation(...) * ->withFurtherInformationRequestedAt(...) * ->withFurtherInformationRequestedReason(...) - * ->withMerchantPrearbitrationDecline(...) * ->withStatus(...) * ->withUpdatedAt(...) - * ->withUserPrearbitration(...) * ``` */ public function __construct() @@ -178,9 +173,9 @@ public function __construct() * * @param list $attachmentFiles * @param Category|value-of $category + * @param Status|value-of $status * @param Chargeback|ChargebackShape|null $chargeback * @param MerchantPrearbitrationDecline|MerchantPrearbitrationDeclineShape|null $merchantPrearbitrationDecline - * @param Status|value-of $status * @param UserPrearbitration|UserPrearbitrationShape|null $userPrearbitration */ public static function with( @@ -188,15 +183,15 @@ public static function with( ?int $amount, array $attachmentFiles, Category|string $category, - Chargeback|array|null $chargeback, \DateTimeInterface $createdAt, ?string $explanation, ?\DateTimeInterface $furtherInformationRequestedAt, ?string $furtherInformationRequestedReason, - MerchantPrearbitrationDecline|array|null $merchantPrearbitrationDecline, Status|string $status, \DateTimeInterface $updatedAt, - UserPrearbitration|array|null $userPrearbitration, + Chargeback|array|null $chargeback = null, + MerchantPrearbitrationDecline|array|null $merchantPrearbitrationDecline = null, + UserPrearbitration|array|null $userPrearbitration = null, ): self { $self = new self; @@ -204,15 +199,16 @@ public static function with( $self['amount'] = $amount; $self['attachmentFiles'] = $attachmentFiles; $self['category'] = $category; - $self['chargeback'] = $chargeback; $self['createdAt'] = $createdAt; $self['explanation'] = $explanation; $self['furtherInformationRequestedAt'] = $furtherInformationRequestedAt; $self['furtherInformationRequestedReason'] = $furtherInformationRequestedReason; - $self['merchantPrearbitrationDecline'] = $merchantPrearbitrationDecline; $self['status'] = $status; $self['updatedAt'] = $updatedAt; - $self['userPrearbitration'] = $userPrearbitration; + + null !== $chargeback && $self['chargeback'] = $chargeback; + null !== $merchantPrearbitrationDecline && $self['merchantPrearbitrationDecline'] = $merchantPrearbitrationDecline; + null !== $userPrearbitration && $self['userPrearbitration'] = $userPrearbitration; return $self; } @@ -265,19 +261,6 @@ public function withCategory(Category|string $category): self return $self; } - /** - * A Visa Card Dispute Chargeback User Submission Chargeback Details object. This field will be present in the JSON response if and only if `category` is equal to `chargeback`. Contains the details specific to a Visa chargeback User Submission for a Card Dispute. - * - * @param Chargeback|ChargebackShape|null $chargeback - */ - public function withChargeback(Chargeback|array|null $chargeback): self - { - $self = clone $this; - $self['chargeback'] = $chargeback; - - return $self; - } - /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Visa Card Dispute User Submission was created. */ @@ -324,20 +307,6 @@ public function withFurtherInformationRequestedReason( return $self; } - /** - * A Visa Card Dispute Merchant Pre-Arbitration Decline User Submission object. This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_decline`. Contains the details specific to a merchant prearbitration decline Visa Card Dispute User Submission. - * - * @param MerchantPrearbitrationDecline|MerchantPrearbitrationDeclineShape|null $merchantPrearbitrationDecline - */ - public function withMerchantPrearbitrationDecline( - MerchantPrearbitrationDecline|array|null $merchantPrearbitrationDecline - ): self { - $self = clone $this; - $self['merchantPrearbitrationDecline'] = $merchantPrearbitrationDecline; - - return $self; - } - /** * The status of the Visa Card Dispute User Submission. * @@ -362,6 +331,33 @@ public function withUpdatedAt(\DateTimeInterface $updatedAt): self return $self; } + /** + * A Visa Card Dispute Chargeback User Submission Chargeback Details object. This field will be present in the JSON response if and only if `category` is equal to `chargeback`. Contains the details specific to a Visa chargeback User Submission for a Card Dispute. + * + * @param Chargeback|ChargebackShape|null $chargeback + */ + public function withChargeback(Chargeback|array|null $chargeback): self + { + $self = clone $this; + $self['chargeback'] = $chargeback; + + return $self; + } + + /** + * A Visa Card Dispute Merchant Pre-Arbitration Decline User Submission object. This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_decline`. Contains the details specific to a merchant prearbitration decline Visa Card Dispute User Submission. + * + * @param MerchantPrearbitrationDecline|MerchantPrearbitrationDeclineShape|null $merchantPrearbitrationDecline + */ + public function withMerchantPrearbitrationDecline( + MerchantPrearbitrationDecline|array|null $merchantPrearbitrationDecline + ): self { + $self = clone $this; + $self['merchantPrearbitrationDecline'] = $merchantPrearbitrationDecline; + + return $self; + } + /** * A Visa Card Dispute User-Initiated Pre-Arbitration User Submission object. This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration`. Contains the details specific to a user-initiated pre-arbitration Visa Card Dispute User Submission. * diff --git a/src/CardPayments/CardPayment/Element.php b/src/CardPayments/CardPayment/Element.php index 3498c4d..5a28d56 100644 --- a/src/CardPayments/CardPayment/Element.php +++ b/src/CardPayments/CardPayment/Element.php @@ -18,6 +18,7 @@ use Increase\CardPayments\CardPayment\Element\CardValidation; use Increase\CardPayments\CardPayment\Element\Category; use Increase\CardPayments\CardPayment\Element\Other; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -38,21 +39,21 @@ * @phpstan-import-type OtherShape from \Increase\CardPayments\CardPayment\Element\Other * * @phpstan-type ElementShape = array{ - * cardAuthentication: null|CardAuthentication|CardAuthenticationShape, - * cardAuthorization: null|CardAuthorization|CardAuthorizationShape, - * cardAuthorizationExpiration: null|CardAuthorizationExpiration|CardAuthorizationExpirationShape, - * cardBalanceInquiry: null|CardBalanceInquiry|CardBalanceInquiryShape, - * cardDecline: null|CardDecline|CardDeclineShape, - * cardFinancial: null|CardFinancial|CardFinancialShape, - * cardFuelConfirmation: null|CardFuelConfirmation|CardFuelConfirmationShape, - * cardIncrement: null|CardIncrement|CardIncrementShape, - * cardRefund: null|CardRefund|CardRefundShape, - * cardReversal: null|CardReversal|CardReversalShape, - * cardSettlement: null|CardSettlement|CardSettlementShape, - * cardValidation: null|CardValidation|CardValidationShape, * category: Category|value-of, * createdAt: \DateTimeInterface, - * other: null|Other|OtherShape, + * cardAuthentication?: null|CardAuthentication|CardAuthenticationShape, + * cardAuthorization?: null|CardAuthorization|CardAuthorizationShape, + * cardAuthorizationExpiration?: null|CardAuthorizationExpiration|CardAuthorizationExpirationShape, + * cardBalanceInquiry?: null|CardBalanceInquiry|CardBalanceInquiryShape, + * cardDecline?: null|CardDecline|CardDeclineShape, + * cardFinancial?: null|CardFinancial|CardFinancialShape, + * cardFuelConfirmation?: null|CardFuelConfirmation|CardFuelConfirmationShape, + * cardIncrement?: null|CardIncrement|CardIncrementShape, + * cardRefund?: null|CardRefund|CardRefundShape, + * cardReversal?: null|CardReversal|CardReversalShape, + * cardSettlement?: null|CardSettlement|CardSettlementShape, + * cardValidation?: null|CardValidation|CardValidationShape, + * other?: null|Other|OtherShape, * } */ final class Element implements BaseModel @@ -60,96 +61,96 @@ final class Element implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. + * + * @var value-of $category + */ + #[Required(enum: Category::class)] + public string $category; + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the card payment element was created. + */ + #[Required('created_at')] + public \DateTimeInterface $createdAt; + /** * A Card Authentication object. This field will be present in the JSON response if and only if `category` is equal to `card_authentication`. Card Authentications are attempts to authenticate a transaction or a card with 3DS. */ - #[Required('card_authentication')] + #[Optional('card_authentication', nullable: true)] public ?CardAuthentication $cardAuthentication; /** * A Card Authorization object. This field will be present in the JSON response if and only if `category` is equal to `card_authorization`. Card Authorizations are temporary holds placed on a customers funds with the intent to later clear a transaction. */ - #[Required('card_authorization')] + #[Optional('card_authorization', nullable: true)] public ?CardAuthorization $cardAuthorization; /** * A Card Authorization Expiration object. This field will be present in the JSON response if and only if `category` is equal to `card_authorization_expiration`. Card Authorization Expirations are cancellations of authorizations that were never settled by the acquirer. */ - #[Required('card_authorization_expiration')] + #[Optional('card_authorization_expiration', nullable: true)] public ?CardAuthorizationExpiration $cardAuthorizationExpiration; /** * A Card Balance Inquiry object. This field will be present in the JSON response if and only if `category` is equal to `card_balance_inquiry`. Card Balance Inquiries are transactions that allow merchants to check the available balance on a card without placing a hold on funds, commonly used when a customer requests their balance at an ATM. */ - #[Required('card_balance_inquiry')] + #[Optional('card_balance_inquiry', nullable: true)] public ?CardBalanceInquiry $cardBalanceInquiry; /** * A Card Decline object. This field will be present in the JSON response if and only if `category` is equal to `card_decline`. */ - #[Required('card_decline')] + #[Optional('card_decline', nullable: true)] public ?CardDecline $cardDecline; /** * A Card Financial object. This field will be present in the JSON response if and only if `category` is equal to `card_financial`. Card Financials are temporary holds placed on a customers funds with the intent to later clear a transaction. */ - #[Required('card_financial')] + #[Optional('card_financial', nullable: true)] public ?CardFinancial $cardFinancial; /** * A Card Fuel Confirmation object. This field will be present in the JSON response if and only if `category` is equal to `card_fuel_confirmation`. Card Fuel Confirmations update the amount of a Card Authorization after a fuel pump transaction is completed. */ - #[Required('card_fuel_confirmation')] + #[Optional('card_fuel_confirmation', nullable: true)] public ?CardFuelConfirmation $cardFuelConfirmation; /** * A Card Increment object. This field will be present in the JSON response if and only if `category` is equal to `card_increment`. Card Increments increase the pending amount of an authorized transaction. */ - #[Required('card_increment')] + #[Optional('card_increment', nullable: true)] public ?CardIncrement $cardIncrement; /** * A Card Refund object. This field will be present in the JSON response if and only if `category` is equal to `card_refund`. Card Refunds move money back to the cardholder. While they are usually connected to a Card Settlement an acquirer can also refund money directly to a card without relation to a transaction. */ - #[Required('card_refund')] + #[Optional('card_refund', nullable: true)] public ?CardRefund $cardRefund; /** * A Card Reversal object. This field will be present in the JSON response if and only if `category` is equal to `card_reversal`. Card Reversals cancel parts of or the entirety of an existing Card Authorization. */ - #[Required('card_reversal')] + #[Optional('card_reversal', nullable: true)] public ?CardReversal $cardReversal; /** * A Card Settlement object. This field will be present in the JSON response if and only if `category` is equal to `card_settlement`. Card Settlements are card transactions that have cleared and settled. While a settlement is usually preceded by an authorization, an acquirer can also directly clear a transaction without first authorizing it. */ - #[Required('card_settlement')] + #[Optional('card_settlement', nullable: true)] public ?CardSettlement $cardSettlement; /** * An Inbound Card Validation object. This field will be present in the JSON response if and only if `category` is equal to `card_validation`. Inbound Card Validations are requests from a merchant to verify that a card number and optionally its address and/or Card Verification Value are valid. */ - #[Required('card_validation')] + #[Optional('card_validation', nullable: true)] public ?CardValidation $cardValidation; - /** - * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. - * - * @var value-of $category - */ - #[Required(enum: Category::class)] - public string $category; - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the card payment element was created. - */ - #[Required('created_at')] - public \DateTimeInterface $createdAt; - /** * If the category of this Transaction source is equal to `other`, this field will contain an empty object, otherwise it will contain null. */ - #[Required] + #[Optional(nullable: true)] public ?Other $other; /** @@ -157,44 +158,13 @@ final class Element implements BaseModel * * To enforce required parameters use * ``` - * Element::with( - * cardAuthentication: ..., - * cardAuthorization: ..., - * cardAuthorizationExpiration: ..., - * cardBalanceInquiry: ..., - * cardDecline: ..., - * cardFinancial: ..., - * cardFuelConfirmation: ..., - * cardIncrement: ..., - * cardRefund: ..., - * cardReversal: ..., - * cardSettlement: ..., - * cardValidation: ..., - * category: ..., - * createdAt: ..., - * other: ..., - * ) + * Element::with(category: ..., createdAt: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Element) - * ->withCardAuthentication(...) - * ->withCardAuthorization(...) - * ->withCardAuthorizationExpiration(...) - * ->withCardBalanceInquiry(...) - * ->withCardDecline(...) - * ->withCardFinancial(...) - * ->withCardFuelConfirmation(...) - * ->withCardIncrement(...) - * ->withCardRefund(...) - * ->withCardReversal(...) - * ->withCardSettlement(...) - * ->withCardValidation(...) - * ->withCategory(...) - * ->withCreatedAt(...) - * ->withOther(...) + * (new Element)->withCategory(...)->withCreatedAt(...) * ``` */ public function __construct() @@ -207,6 +177,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Category|value-of $category * @param CardAuthentication|CardAuthenticationShape|null $cardAuthentication * @param CardAuthorization|CardAuthorizationShape|null $cardAuthorization * @param CardAuthorizationExpiration|CardAuthorizationExpirationShape|null $cardAuthorizationExpiration @@ -219,43 +190,67 @@ public function __construct() * @param CardReversal|CardReversalShape|null $cardReversal * @param CardSettlement|CardSettlementShape|null $cardSettlement * @param CardValidation|CardValidationShape|null $cardValidation - * @param Category|value-of $category * @param Other|OtherShape|null $other */ public static function with( - CardAuthentication|array|null $cardAuthentication, - CardAuthorization|array|null $cardAuthorization, - CardAuthorizationExpiration|array|null $cardAuthorizationExpiration, - CardBalanceInquiry|array|null $cardBalanceInquiry, - CardDecline|array|null $cardDecline, - CardFinancial|array|null $cardFinancial, - CardFuelConfirmation|array|null $cardFuelConfirmation, - CardIncrement|array|null $cardIncrement, - CardRefund|array|null $cardRefund, - CardReversal|array|null $cardReversal, - CardSettlement|array|null $cardSettlement, - CardValidation|array|null $cardValidation, Category|string $category, \DateTimeInterface $createdAt, - Other|array|null $other, + CardAuthentication|array|null $cardAuthentication = null, + CardAuthorization|array|null $cardAuthorization = null, + CardAuthorizationExpiration|array|null $cardAuthorizationExpiration = null, + CardBalanceInquiry|array|null $cardBalanceInquiry = null, + CardDecline|array|null $cardDecline = null, + CardFinancial|array|null $cardFinancial = null, + CardFuelConfirmation|array|null $cardFuelConfirmation = null, + CardIncrement|array|null $cardIncrement = null, + CardRefund|array|null $cardRefund = null, + CardReversal|array|null $cardReversal = null, + CardSettlement|array|null $cardSettlement = null, + CardValidation|array|null $cardValidation = null, + Other|array|null $other = null, ): self { $self = new self; - $self['cardAuthentication'] = $cardAuthentication; - $self['cardAuthorization'] = $cardAuthorization; - $self['cardAuthorizationExpiration'] = $cardAuthorizationExpiration; - $self['cardBalanceInquiry'] = $cardBalanceInquiry; - $self['cardDecline'] = $cardDecline; - $self['cardFinancial'] = $cardFinancial; - $self['cardFuelConfirmation'] = $cardFuelConfirmation; - $self['cardIncrement'] = $cardIncrement; - $self['cardRefund'] = $cardRefund; - $self['cardReversal'] = $cardReversal; - $self['cardSettlement'] = $cardSettlement; - $self['cardValidation'] = $cardValidation; $self['category'] = $category; $self['createdAt'] = $createdAt; - $self['other'] = $other; + + null !== $cardAuthentication && $self['cardAuthentication'] = $cardAuthentication; + null !== $cardAuthorization && $self['cardAuthorization'] = $cardAuthorization; + null !== $cardAuthorizationExpiration && $self['cardAuthorizationExpiration'] = $cardAuthorizationExpiration; + null !== $cardBalanceInquiry && $self['cardBalanceInquiry'] = $cardBalanceInquiry; + null !== $cardDecline && $self['cardDecline'] = $cardDecline; + null !== $cardFinancial && $self['cardFinancial'] = $cardFinancial; + null !== $cardFuelConfirmation && $self['cardFuelConfirmation'] = $cardFuelConfirmation; + null !== $cardIncrement && $self['cardIncrement'] = $cardIncrement; + null !== $cardRefund && $self['cardRefund'] = $cardRefund; + null !== $cardReversal && $self['cardReversal'] = $cardReversal; + null !== $cardSettlement && $self['cardSettlement'] = $cardSettlement; + null !== $cardValidation && $self['cardValidation'] = $cardValidation; + null !== $other && $self['other'] = $other; + + return $self; + } + + /** + * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. + * + * @param Category|value-of $category + */ + public function withCategory(Category|string $category): self + { + $self = clone $this; + $self['category'] = $category; + + return $self; + } + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the card payment element was created. + */ + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; return $self; } @@ -426,30 +421,6 @@ public function withCardValidation( return $self; } - /** - * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. - * - * @param Category|value-of $category - */ - public function withCategory(Category|string $category): self - { - $self = clone $this; - $self['category'] = $category; - - return $self; - } - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the card payment element was created. - */ - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - /** * If the category of this Transaction source is equal to `other`, this field will contain an empty object, otherwise it will contain null. * diff --git a/src/CardPushTransfers/CardPushTransfer/CreatedBy.php b/src/CardPushTransfers/CardPushTransfer/CreatedBy.php index 648c224..ec20b34 100644 --- a/src/CardPushTransfers/CardPushTransfer/CreatedBy.php +++ b/src/CardPushTransfers/CardPushTransfer/CreatedBy.php @@ -8,6 +8,7 @@ use Increase\CardPushTransfers\CardPushTransfer\CreatedBy\Category; use Increase\CardPushTransfers\CardPushTransfer\CreatedBy\OAuthApplication; use Increase\CardPushTransfers\CardPushTransfer\CreatedBy\User; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -20,10 +21,10 @@ * @phpstan-import-type UserShape from \Increase\CardPushTransfers\CardPushTransfer\CreatedBy\User * * @phpstan-type CreatedByShape = array{ - * apiKey: null|APIKey|APIKeyShape, * category: Category|value-of, - * oauthApplication: null|OAuthApplication|OAuthApplicationShape, - * user: null|User|UserShape, + * apiKey?: null|APIKey|APIKeyShape, + * oauthApplication?: null|OAuthApplication|OAuthApplicationShape, + * user?: null|User|UserShape, * } */ final class CreatedBy implements BaseModel @@ -31,12 +32,6 @@ final class CreatedBy implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * If present, details about the API key that created the transfer. - */ - #[Required('api_key')] - public ?APIKey $apiKey; - /** * The type of object that created this transfer. * @@ -45,16 +40,22 @@ final class CreatedBy implements BaseModel #[Required(enum: Category::class)] public string $category; + /** + * If present, details about the API key that created the transfer. + */ + #[Optional('api_key', nullable: true)] + public ?APIKey $apiKey; + /** * If present, details about the OAuth Application that created the transfer. */ - #[Required('oauth_application')] + #[Optional('oauth_application', nullable: true)] public ?OAuthApplication $oauthApplication; /** * If present, details about the User that created the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?User $user; /** @@ -62,17 +63,13 @@ final class CreatedBy implements BaseModel * * To enforce required parameters use * ``` - * CreatedBy::with(apiKey: ..., category: ..., oauthApplication: ..., user: ...) + * CreatedBy::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new CreatedBy) - * ->withAPIKey(...) - * ->withCategory(...) - * ->withOAuthApplication(...) - * ->withUser(...) + * (new CreatedBy)->withCategory(...) * ``` */ public function __construct() @@ -85,49 +82,50 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param APIKey|APIKeyShape|null $apiKey * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey * @param OAuthApplication|OAuthApplicationShape|null $oauthApplication * @param User|UserShape|null $user */ public static function with( - APIKey|array|null $apiKey, Category|string $category, - OAuthApplication|array|null $oauthApplication, - User|array|null $user, + APIKey|array|null $apiKey = null, + OAuthApplication|array|null $oauthApplication = null, + User|array|null $user = null, ): self { $self = new self; - $self['apiKey'] = $apiKey; $self['category'] = $category; - $self['oauthApplication'] = $oauthApplication; - $self['user'] = $user; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $oauthApplication && $self['oauthApplication'] = $oauthApplication; + null !== $user && $self['user'] = $user; return $self; } /** - * If present, details about the API key that created the transfer. + * The type of object that created this transfer. * - * @param APIKey|APIKeyShape|null $apiKey + * @param Category|value-of $category */ - public function withAPIKey(APIKey|array|null $apiKey): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['apiKey'] = $apiKey; + $self['category'] = $category; return $self; } /** - * The type of object that created this transfer. + * If present, details about the API key that created the transfer. * - * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey */ - public function withCategory(Category|string $category): self + public function withAPIKey(APIKey|array|null $apiKey): self { $self = clone $this; - $self['category'] = $category; + $self['apiKey'] = $apiKey; return $self; } diff --git a/src/CardValidations/CardValidation/CreatedBy.php b/src/CardValidations/CardValidation/CreatedBy.php index 3687786..5c01e3e 100644 --- a/src/CardValidations/CardValidation/CreatedBy.php +++ b/src/CardValidations/CardValidation/CreatedBy.php @@ -8,6 +8,7 @@ use Increase\CardValidations\CardValidation\CreatedBy\Category; use Increase\CardValidations\CardValidation\CreatedBy\OAuthApplication; use Increase\CardValidations\CardValidation\CreatedBy\User; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -20,10 +21,10 @@ * @phpstan-import-type UserShape from \Increase\CardValidations\CardValidation\CreatedBy\User * * @phpstan-type CreatedByShape = array{ - * apiKey: null|APIKey|APIKeyShape, * category: Category|value-of, - * oauthApplication: null|OAuthApplication|OAuthApplicationShape, - * user: null|User|UserShape, + * apiKey?: null|APIKey|APIKeyShape, + * oauthApplication?: null|OAuthApplication|OAuthApplicationShape, + * user?: null|User|UserShape, * } */ final class CreatedBy implements BaseModel @@ -31,12 +32,6 @@ final class CreatedBy implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * If present, details about the API key that created the transfer. - */ - #[Required('api_key')] - public ?APIKey $apiKey; - /** * The type of object that created this transfer. * @@ -45,16 +40,22 @@ final class CreatedBy implements BaseModel #[Required(enum: Category::class)] public string $category; + /** + * If present, details about the API key that created the transfer. + */ + #[Optional('api_key', nullable: true)] + public ?APIKey $apiKey; + /** * If present, details about the OAuth Application that created the transfer. */ - #[Required('oauth_application')] + #[Optional('oauth_application', nullable: true)] public ?OAuthApplication $oauthApplication; /** * If present, details about the User that created the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?User $user; /** @@ -62,17 +63,13 @@ final class CreatedBy implements BaseModel * * To enforce required parameters use * ``` - * CreatedBy::with(apiKey: ..., category: ..., oauthApplication: ..., user: ...) + * CreatedBy::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new CreatedBy) - * ->withAPIKey(...) - * ->withCategory(...) - * ->withOAuthApplication(...) - * ->withUser(...) + * (new CreatedBy)->withCategory(...) * ``` */ public function __construct() @@ -85,49 +82,50 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param APIKey|APIKeyShape|null $apiKey * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey * @param OAuthApplication|OAuthApplicationShape|null $oauthApplication * @param User|UserShape|null $user */ public static function with( - APIKey|array|null $apiKey, Category|string $category, - OAuthApplication|array|null $oauthApplication, - User|array|null $user, + APIKey|array|null $apiKey = null, + OAuthApplication|array|null $oauthApplication = null, + User|array|null $user = null, ): self { $self = new self; - $self['apiKey'] = $apiKey; $self['category'] = $category; - $self['oauthApplication'] = $oauthApplication; - $self['user'] = $user; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $oauthApplication && $self['oauthApplication'] = $oauthApplication; + null !== $user && $self['user'] = $user; return $self; } /** - * If present, details about the API key that created the transfer. + * The type of object that created this transfer. * - * @param APIKey|APIKeyShape|null $apiKey + * @param Category|value-of $category */ - public function withAPIKey(APIKey|array|null $apiKey): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['apiKey'] = $apiKey; + $self['category'] = $category; return $self; } /** - * The type of object that created this transfer. + * If present, details about the API key that created the transfer. * - * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey */ - public function withCategory(Category|string $category): self + public function withAPIKey(APIKey|array|null $apiKey): self { $self = clone $this; - $self['category'] = $category; + $self['apiKey'] = $apiKey; return $self; } diff --git a/src/CheckTransfers/CheckTransfer/CreatedBy.php b/src/CheckTransfers/CheckTransfer/CreatedBy.php index 736d45c..568c91f 100644 --- a/src/CheckTransfers/CheckTransfer/CreatedBy.php +++ b/src/CheckTransfers/CheckTransfer/CreatedBy.php @@ -8,6 +8,7 @@ use Increase\CheckTransfers\CheckTransfer\CreatedBy\Category; use Increase\CheckTransfers\CheckTransfer\CreatedBy\OAuthApplication; use Increase\CheckTransfers\CheckTransfer\CreatedBy\User; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -20,10 +21,10 @@ * @phpstan-import-type UserShape from \Increase\CheckTransfers\CheckTransfer\CreatedBy\User * * @phpstan-type CreatedByShape = array{ - * apiKey: null|APIKey|APIKeyShape, * category: Category|value-of, - * oauthApplication: null|OAuthApplication|OAuthApplicationShape, - * user: null|User|UserShape, + * apiKey?: null|APIKey|APIKeyShape, + * oauthApplication?: null|OAuthApplication|OAuthApplicationShape, + * user?: null|User|UserShape, * } */ final class CreatedBy implements BaseModel @@ -31,12 +32,6 @@ final class CreatedBy implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * If present, details about the API key that created the transfer. - */ - #[Required('api_key')] - public ?APIKey $apiKey; - /** * The type of object that created this transfer. * @@ -45,16 +40,22 @@ final class CreatedBy implements BaseModel #[Required(enum: Category::class)] public string $category; + /** + * If present, details about the API key that created the transfer. + */ + #[Optional('api_key', nullable: true)] + public ?APIKey $apiKey; + /** * If present, details about the OAuth Application that created the transfer. */ - #[Required('oauth_application')] + #[Optional('oauth_application', nullable: true)] public ?OAuthApplication $oauthApplication; /** * If present, details about the User that created the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?User $user; /** @@ -62,17 +63,13 @@ final class CreatedBy implements BaseModel * * To enforce required parameters use * ``` - * CreatedBy::with(apiKey: ..., category: ..., oauthApplication: ..., user: ...) + * CreatedBy::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new CreatedBy) - * ->withAPIKey(...) - * ->withCategory(...) - * ->withOAuthApplication(...) - * ->withUser(...) + * (new CreatedBy)->withCategory(...) * ``` */ public function __construct() @@ -85,49 +82,50 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param APIKey|APIKeyShape|null $apiKey * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey * @param OAuthApplication|OAuthApplicationShape|null $oauthApplication * @param User|UserShape|null $user */ public static function with( - APIKey|array|null $apiKey, Category|string $category, - OAuthApplication|array|null $oauthApplication, - User|array|null $user, + APIKey|array|null $apiKey = null, + OAuthApplication|array|null $oauthApplication = null, + User|array|null $user = null, ): self { $self = new self; - $self['apiKey'] = $apiKey; $self['category'] = $category; - $self['oauthApplication'] = $oauthApplication; - $self['user'] = $user; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $oauthApplication && $self['oauthApplication'] = $oauthApplication; + null !== $user && $self['user'] = $user; return $self; } /** - * If present, details about the API key that created the transfer. + * The type of object that created this transfer. * - * @param APIKey|APIKeyShape|null $apiKey + * @param Category|value-of $category */ - public function withAPIKey(APIKey|array|null $apiKey): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['apiKey'] = $apiKey; + $self['category'] = $category; return $self; } /** - * The type of object that created this transfer. + * If present, details about the API key that created the transfer. * - * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey */ - public function withCategory(Category|string $category): self + public function withAPIKey(APIKey|array|null $apiKey): self { $self = clone $this; - $self['category'] = $category; + $self['apiKey'] = $apiKey; return $self; } diff --git a/src/DeclinedTransactions/DeclinedTransaction/Source.php b/src/DeclinedTransactions/DeclinedTransaction/Source.php index 2dba814..af2eb2d 100644 --- a/src/DeclinedTransactions/DeclinedTransaction/Source.php +++ b/src/DeclinedTransactions/DeclinedTransaction/Source.php @@ -4,6 +4,7 @@ namespace Increase\DeclinedTransactions\DeclinedTransaction; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -30,15 +31,15 @@ * @phpstan-import-type WireDeclineShape from \Increase\DeclinedTransactions\DeclinedTransaction\Source\WireDecline * * @phpstan-type SourceShape = array{ - * achDecline: null|ACHDecline|ACHDeclineShape, - * cardDecline: null|CardDecline|CardDeclineShape, * category: Category|value-of, - * checkDecline: null|CheckDecline|CheckDeclineShape, - * checkDepositRejection: null|CheckDepositRejection|CheckDepositRejectionShape, - * inboundFednowTransferDecline: null|InboundFednowTransferDecline|InboundFednowTransferDeclineShape, - * inboundRealTimePaymentsTransferDecline: null|InboundRealTimePaymentsTransferDecline|InboundRealTimePaymentsTransferDeclineShape, - * other: null|Other|OtherShape, - * wireDecline: null|WireDecline|WireDeclineShape, + * achDecline?: null|ACHDecline|ACHDeclineShape, + * cardDecline?: null|CardDecline|CardDeclineShape, + * checkDecline?: null|CheckDecline|CheckDeclineShape, + * checkDepositRejection?: null|CheckDepositRejection|CheckDepositRejectionShape, + * inboundFednowTransferDecline?: null|InboundFednowTransferDecline|InboundFednowTransferDeclineShape, + * inboundRealTimePaymentsTransferDecline?: null|InboundRealTimePaymentsTransferDecline|InboundRealTimePaymentsTransferDeclineShape, + * other?: null|Other|OtherShape, + * wireDecline?: null|WireDecline|WireDeclineShape, * } */ final class Source implements BaseModel @@ -46,60 +47,60 @@ final class Source implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. + * + * @var value-of $category + */ + #[Required(enum: Category::class)] + public string $category; + /** * An ACH Decline object. This field will be present in the JSON response if and only if `category` is equal to `ach_decline`. */ - #[Required('ach_decline')] + #[Optional('ach_decline', nullable: true)] public ?ACHDecline $achDecline; /** * A Card Decline object. This field will be present in the JSON response if and only if `category` is equal to `card_decline`. */ - #[Required('card_decline')] + #[Optional('card_decline', nullable: true)] public ?CardDecline $cardDecline; - /** - * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. - * - * @var value-of $category - */ - #[Required(enum: Category::class)] - public string $category; - /** * A Check Decline object. This field will be present in the JSON response if and only if `category` is equal to `check_decline`. */ - #[Required('check_decline')] + #[Optional('check_decline', nullable: true)] public ?CheckDecline $checkDecline; /** * A Check Deposit Rejection object. This field will be present in the JSON response if and only if `category` is equal to `check_deposit_rejection`. */ - #[Required('check_deposit_rejection')] + #[Optional('check_deposit_rejection', nullable: true)] public ?CheckDepositRejection $checkDepositRejection; /** * An Inbound FedNow Transfer Decline object. This field will be present in the JSON response if and only if `category` is equal to `inbound_fednow_transfer_decline`. */ - #[Required('inbound_fednow_transfer_decline')] + #[Optional('inbound_fednow_transfer_decline', nullable: true)] public ?InboundFednowTransferDecline $inboundFednowTransferDecline; /** * An Inbound Real-Time Payments Transfer Decline object. This field will be present in the JSON response if and only if `category` is equal to `inbound_real_time_payments_transfer_decline`. */ - #[Required('inbound_real_time_payments_transfer_decline')] + #[Optional('inbound_real_time_payments_transfer_decline', nullable: true)] public ?InboundRealTimePaymentsTransferDecline $inboundRealTimePaymentsTransferDecline; /** * If the category of this Transaction source is equal to `other`, this field will contain an empty object, otherwise it will contain null. */ - #[Required] + #[Optional(nullable: true)] public ?Other $other; /** * A Wire Decline object. This field will be present in the JSON response if and only if `category` is equal to `wire_decline`. */ - #[Required('wire_decline')] + #[Optional('wire_decline', nullable: true)] public ?WireDecline $wireDecline; /** @@ -107,32 +108,13 @@ final class Source implements BaseModel * * To enforce required parameters use * ``` - * Source::with( - * achDecline: ..., - * cardDecline: ..., - * category: ..., - * checkDecline: ..., - * checkDepositRejection: ..., - * inboundFednowTransferDecline: ..., - * inboundRealTimePaymentsTransferDecline: ..., - * other: ..., - * wireDecline: ..., - * ) + * Source::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Source) - * ->withACHDecline(...) - * ->withCardDecline(...) - * ->withCategory(...) - * ->withCheckDecline(...) - * ->withCheckDepositRejection(...) - * ->withInboundFednowTransferDecline(...) - * ->withInboundRealTimePaymentsTransferDecline(...) - * ->withOther(...) - * ->withWireDecline(...) + * (new Source)->withCategory(...) * ``` */ public function __construct() @@ -145,9 +127,9 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Category|value-of $category * @param ACHDecline|ACHDeclineShape|null $achDecline * @param CardDecline|CardDeclineShape|null $cardDecline - * @param Category|value-of $category * @param CheckDecline|CheckDeclineShape|null $checkDecline * @param CheckDepositRejection|CheckDepositRejectionShape|null $checkDepositRejection * @param InboundFednowTransferDecline|InboundFednowTransferDeclineShape|null $inboundFednowTransferDecline @@ -156,66 +138,67 @@ public function __construct() * @param WireDecline|WireDeclineShape|null $wireDecline */ public static function with( - ACHDecline|array|null $achDecline, - CardDecline|array|null $cardDecline, Category|string $category, - CheckDecline|array|null $checkDecline, - CheckDepositRejection|array|null $checkDepositRejection, - InboundFednowTransferDecline|array|null $inboundFednowTransferDecline, - InboundRealTimePaymentsTransferDecline|array|null $inboundRealTimePaymentsTransferDecline, - Other|array|null $other, - WireDecline|array|null $wireDecline, + ACHDecline|array|null $achDecline = null, + CardDecline|array|null $cardDecline = null, + CheckDecline|array|null $checkDecline = null, + CheckDepositRejection|array|null $checkDepositRejection = null, + InboundFednowTransferDecline|array|null $inboundFednowTransferDecline = null, + InboundRealTimePaymentsTransferDecline|array|null $inboundRealTimePaymentsTransferDecline = null, + Other|array|null $other = null, + WireDecline|array|null $wireDecline = null, ): self { $self = new self; - $self['achDecline'] = $achDecline; - $self['cardDecline'] = $cardDecline; $self['category'] = $category; - $self['checkDecline'] = $checkDecline; - $self['checkDepositRejection'] = $checkDepositRejection; - $self['inboundFednowTransferDecline'] = $inboundFednowTransferDecline; - $self['inboundRealTimePaymentsTransferDecline'] = $inboundRealTimePaymentsTransferDecline; - $self['other'] = $other; - $self['wireDecline'] = $wireDecline; + + null !== $achDecline && $self['achDecline'] = $achDecline; + null !== $cardDecline && $self['cardDecline'] = $cardDecline; + null !== $checkDecline && $self['checkDecline'] = $checkDecline; + null !== $checkDepositRejection && $self['checkDepositRejection'] = $checkDepositRejection; + null !== $inboundFednowTransferDecline && $self['inboundFednowTransferDecline'] = $inboundFednowTransferDecline; + null !== $inboundRealTimePaymentsTransferDecline && $self['inboundRealTimePaymentsTransferDecline'] = $inboundRealTimePaymentsTransferDecline; + null !== $other && $self['other'] = $other; + null !== $wireDecline && $self['wireDecline'] = $wireDecline; return $self; } /** - * An ACH Decline object. This field will be present in the JSON response if and only if `category` is equal to `ach_decline`. + * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. * - * @param ACHDecline|ACHDeclineShape|null $achDecline + * @param Category|value-of $category */ - public function withACHDecline(ACHDecline|array|null $achDecline): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['achDecline'] = $achDecline; + $self['category'] = $category; return $self; } /** - * A Card Decline object. This field will be present in the JSON response if and only if `category` is equal to `card_decline`. + * An ACH Decline object. This field will be present in the JSON response if and only if `category` is equal to `ach_decline`. * - * @param CardDecline|CardDeclineShape|null $cardDecline + * @param ACHDecline|ACHDeclineShape|null $achDecline */ - public function withCardDecline(CardDecline|array|null $cardDecline): self + public function withACHDecline(ACHDecline|array|null $achDecline): self { $self = clone $this; - $self['cardDecline'] = $cardDecline; + $self['achDecline'] = $achDecline; return $self; } /** - * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. + * A Card Decline object. This field will be present in the JSON response if and only if `category` is equal to `card_decline`. * - * @param Category|value-of $category + * @param CardDecline|CardDeclineShape|null $cardDecline */ - public function withCategory(Category|string $category): self + public function withCardDecline(CardDecline|array|null $cardDecline): self { $self = clone $this; - $self['category'] = $category; + $self['cardDecline'] = $cardDecline; return $self; } diff --git a/src/FednowTransfers/FednowTransfer/CreatedBy.php b/src/FednowTransfers/FednowTransfer/CreatedBy.php index 382198e..60f747c 100644 --- a/src/FednowTransfers/FednowTransfer/CreatedBy.php +++ b/src/FednowTransfers/FednowTransfer/CreatedBy.php @@ -4,6 +4,7 @@ namespace Increase\FednowTransfers\FednowTransfer; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -20,10 +21,10 @@ * @phpstan-import-type UserShape from \Increase\FednowTransfers\FednowTransfer\CreatedBy\User * * @phpstan-type CreatedByShape = array{ - * apiKey: null|APIKey|APIKeyShape, * category: Category|value-of, - * oauthApplication: null|OAuthApplication|OAuthApplicationShape, - * user: null|User|UserShape, + * apiKey?: null|APIKey|APIKeyShape, + * oauthApplication?: null|OAuthApplication|OAuthApplicationShape, + * user?: null|User|UserShape, * } */ final class CreatedBy implements BaseModel @@ -31,12 +32,6 @@ final class CreatedBy implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * If present, details about the API key that created the transfer. - */ - #[Required('api_key')] - public ?APIKey $apiKey; - /** * The type of object that created this transfer. * @@ -45,16 +40,22 @@ final class CreatedBy implements BaseModel #[Required(enum: Category::class)] public string $category; + /** + * If present, details about the API key that created the transfer. + */ + #[Optional('api_key', nullable: true)] + public ?APIKey $apiKey; + /** * If present, details about the OAuth Application that created the transfer. */ - #[Required('oauth_application')] + #[Optional('oauth_application', nullable: true)] public ?OAuthApplication $oauthApplication; /** * If present, details about the User that created the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?User $user; /** @@ -62,17 +63,13 @@ final class CreatedBy implements BaseModel * * To enforce required parameters use * ``` - * CreatedBy::with(apiKey: ..., category: ..., oauthApplication: ..., user: ...) + * CreatedBy::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new CreatedBy) - * ->withAPIKey(...) - * ->withCategory(...) - * ->withOAuthApplication(...) - * ->withUser(...) + * (new CreatedBy)->withCategory(...) * ``` */ public function __construct() @@ -85,49 +82,50 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param APIKey|APIKeyShape|null $apiKey * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey * @param OAuthApplication|OAuthApplicationShape|null $oauthApplication * @param User|UserShape|null $user */ public static function with( - APIKey|array|null $apiKey, Category|string $category, - OAuthApplication|array|null $oauthApplication, - User|array|null $user, + APIKey|array|null $apiKey = null, + OAuthApplication|array|null $oauthApplication = null, + User|array|null $user = null, ): self { $self = new self; - $self['apiKey'] = $apiKey; $self['category'] = $category; - $self['oauthApplication'] = $oauthApplication; - $self['user'] = $user; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $oauthApplication && $self['oauthApplication'] = $oauthApplication; + null !== $user && $self['user'] = $user; return $self; } /** - * If present, details about the API key that created the transfer. + * The type of object that created this transfer. * - * @param APIKey|APIKeyShape|null $apiKey + * @param Category|value-of $category */ - public function withAPIKey(APIKey|array|null $apiKey): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['apiKey'] = $apiKey; + $self['category'] = $category; return $self; } /** - * The type of object that created this transfer. + * If present, details about the API key that created the transfer. * - * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey */ - public function withCategory(Category|string $category): self + public function withAPIKey(APIKey|array|null $apiKey): self { $self = clone $this; - $self['category'] = $category; + $self['apiKey'] = $apiKey; return $self; } diff --git a/src/PendingTransactions/PendingTransaction/Source.php b/src/PendingTransactions/PendingTransaction/Source.php index ea4d439..2208349 100644 --- a/src/PendingTransactions/PendingTransaction/Source.php +++ b/src/PendingTransactions/PendingTransaction/Source.php @@ -4,6 +4,7 @@ namespace Increase\PendingTransactions\PendingTransaction; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -44,23 +45,23 @@ * @phpstan-import-type WireTransferInstructionShape from \Increase\PendingTransactions\PendingTransaction\Source\WireTransferInstruction * * @phpstan-type SourceShape = array{ - * accountTransferInstruction: null|AccountTransferInstruction|AccountTransferInstructionShape, - * achTransferInstruction: null|ACHTransferInstruction|ACHTransferInstructionShape, - * blockchainOfframpTransferInstruction: null|BlockchainOfframpTransferInstruction|BlockchainOfframpTransferInstructionShape, - * blockchainOnrampTransferInstruction: null|BlockchainOnrampTransferInstruction|BlockchainOnrampTransferInstructionShape, - * cardAuthorization: null|CardAuthorization|CardAuthorizationShape, - * cardPushTransferInstruction: null|CardPushTransferInstruction|CardPushTransferInstructionShape, * category: Category|value-of, - * checkDepositInstruction: null|CheckDepositInstruction|CheckDepositInstructionShape, - * checkTransferInstruction: null|CheckTransferInstruction|CheckTransferInstructionShape, - * fednowTransferInstruction: null|FednowTransferInstruction|FednowTransferInstructionShape, - * inboundFundsHold: null|InboundFundsHold|InboundFundsHoldShape, - * inboundWireTransferReversal: null|InboundWireTransferReversal|InboundWireTransferReversalShape, - * other: null|Other|OtherShape, - * realTimePaymentsTransferInstruction: null|RealTimePaymentsTransferInstruction|RealTimePaymentsTransferInstructionShape, - * swiftTransferInstruction: null|SwiftTransferInstruction|SwiftTransferInstructionShape, - * userInitiatedHold: array|null, - * wireTransferInstruction: null|WireTransferInstruction|WireTransferInstructionShape, + * accountTransferInstruction?: null|AccountTransferInstruction|AccountTransferInstructionShape, + * achTransferInstruction?: null|ACHTransferInstruction|ACHTransferInstructionShape, + * blockchainOfframpTransferInstruction?: null|BlockchainOfframpTransferInstruction|BlockchainOfframpTransferInstructionShape, + * blockchainOnrampTransferInstruction?: null|BlockchainOnrampTransferInstruction|BlockchainOnrampTransferInstructionShape, + * cardAuthorization?: null|CardAuthorization|CardAuthorizationShape, + * cardPushTransferInstruction?: null|CardPushTransferInstruction|CardPushTransferInstructionShape, + * checkDepositInstruction?: null|CheckDepositInstruction|CheckDepositInstructionShape, + * checkTransferInstruction?: null|CheckTransferInstruction|CheckTransferInstructionShape, + * fednowTransferInstruction?: null|FednowTransferInstruction|FednowTransferInstructionShape, + * inboundFundsHold?: null|InboundFundsHold|InboundFundsHoldShape, + * inboundWireTransferReversal?: null|InboundWireTransferReversal|InboundWireTransferReversalShape, + * other?: null|Other|OtherShape, + * realTimePaymentsTransferInstruction?: null|RealTimePaymentsTransferInstruction|RealTimePaymentsTransferInstructionShape, + * swiftTransferInstruction?: null|SwiftTransferInstruction|SwiftTransferInstructionShape, + * userInitiatedHold?: array|null, + * wireTransferInstruction?: null|WireTransferInstruction|WireTransferInstructionShape, * } */ final class Source implements BaseModel @@ -68,96 +69,96 @@ final class Source implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. + * + * @var value-of $category + */ + #[Required(enum: Category::class)] + public string $category; + /** * An Account Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `account_transfer_instruction`. */ - #[Required('account_transfer_instruction')] + #[Optional('account_transfer_instruction', nullable: true)] public ?AccountTransferInstruction $accountTransferInstruction; /** * An ACH Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `ach_transfer_instruction`. */ - #[Required('ach_transfer_instruction')] + #[Optional('ach_transfer_instruction', nullable: true)] public ?ACHTransferInstruction $achTransferInstruction; /** * A Blockchain Off-Ramp Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `blockchain_offramp_transfer_instruction`. */ - #[Required('blockchain_offramp_transfer_instruction')] + #[Optional('blockchain_offramp_transfer_instruction', nullable: true)] public ?BlockchainOfframpTransferInstruction $blockchainOfframpTransferInstruction; /** * A Blockchain On-Ramp Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `blockchain_onramp_transfer_instruction`. */ - #[Required('blockchain_onramp_transfer_instruction')] + #[Optional('blockchain_onramp_transfer_instruction', nullable: true)] public ?BlockchainOnrampTransferInstruction $blockchainOnrampTransferInstruction; /** * A Card Authorization object. This field will be present in the JSON response if and only if `category` is equal to `card_authorization`. Card Authorizations are temporary holds placed on a customers funds with the intent to later clear a transaction. */ - #[Required('card_authorization')] + #[Optional('card_authorization', nullable: true)] public ?CardAuthorization $cardAuthorization; /** * A Card Push Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `card_push_transfer_instruction`. */ - #[Required('card_push_transfer_instruction')] + #[Optional('card_push_transfer_instruction', nullable: true)] public ?CardPushTransferInstruction $cardPushTransferInstruction; - /** - * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. - * - * @var value-of $category - */ - #[Required(enum: Category::class)] - public string $category; - /** * A Check Deposit Instruction object. This field will be present in the JSON response if and only if `category` is equal to `check_deposit_instruction`. */ - #[Required('check_deposit_instruction')] + #[Optional('check_deposit_instruction', nullable: true)] public ?CheckDepositInstruction $checkDepositInstruction; /** * A Check Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `check_transfer_instruction`. */ - #[Required('check_transfer_instruction')] + #[Optional('check_transfer_instruction', nullable: true)] public ?CheckTransferInstruction $checkTransferInstruction; /** * A FedNow Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `fednow_transfer_instruction`. */ - #[Required('fednow_transfer_instruction')] + #[Optional('fednow_transfer_instruction', nullable: true)] public ?FednowTransferInstruction $fednowTransferInstruction; /** * An Inbound Funds Hold object. This field will be present in the JSON response if and only if `category` is equal to `inbound_funds_hold`. We hold funds for certain transaction types to account for return windows where funds might still be clawed back by the sending institution. */ - #[Required('inbound_funds_hold')] + #[Optional('inbound_funds_hold', nullable: true)] public ?InboundFundsHold $inboundFundsHold; /** * An Inbound Wire Transfer Reversal object. This field will be present in the JSON response if and only if `category` is equal to `inbound_wire_transfer_reversal`. An Inbound Wire Transfer Reversal is created when Increase has received a wire and the User requests that it be reversed. */ - #[Required('inbound_wire_transfer_reversal')] + #[Optional('inbound_wire_transfer_reversal', nullable: true)] public ?InboundWireTransferReversal $inboundWireTransferReversal; /** * If the category of this Transaction source is equal to `other`, this field will contain an empty object, otherwise it will contain null. */ - #[Required] + #[Optional(nullable: true)] public ?Other $other; /** * A Real-Time Payments Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `real_time_payments_transfer_instruction`. */ - #[Required('real_time_payments_transfer_instruction')] + #[Optional('real_time_payments_transfer_instruction', nullable: true)] public ?RealTimePaymentsTransferInstruction $realTimePaymentsTransferInstruction; /** * A Swift Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `swift_transfer_instruction`. */ - #[Required('swift_transfer_instruction')] + #[Optional('swift_transfer_instruction', nullable: true)] public ?SwiftTransferInstruction $swiftTransferInstruction; /** @@ -165,13 +166,13 @@ final class Source implements BaseModel * * @var array|null $userInitiatedHold */ - #[Required('user_initiated_hold', map: 'mixed')] + #[Optional('user_initiated_hold', map: 'mixed', nullable: true)] public ?array $userInitiatedHold; /** * A Wire Transfer Instruction object. This field will be present in the JSON response if and only if `category` is equal to `wire_transfer_instruction`. */ - #[Required('wire_transfer_instruction')] + #[Optional('wire_transfer_instruction', nullable: true)] public ?WireTransferInstruction $wireTransferInstruction; /** @@ -179,48 +180,13 @@ final class Source implements BaseModel * * To enforce required parameters use * ``` - * Source::with( - * accountTransferInstruction: ..., - * achTransferInstruction: ..., - * blockchainOfframpTransferInstruction: ..., - * blockchainOnrampTransferInstruction: ..., - * cardAuthorization: ..., - * cardPushTransferInstruction: ..., - * category: ..., - * checkDepositInstruction: ..., - * checkTransferInstruction: ..., - * fednowTransferInstruction: ..., - * inboundFundsHold: ..., - * inboundWireTransferReversal: ..., - * other: ..., - * realTimePaymentsTransferInstruction: ..., - * swiftTransferInstruction: ..., - * userInitiatedHold: ..., - * wireTransferInstruction: ..., - * ) + * Source::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Source) - * ->withAccountTransferInstruction(...) - * ->withACHTransferInstruction(...) - * ->withBlockchainOfframpTransferInstruction(...) - * ->withBlockchainOnrampTransferInstruction(...) - * ->withCardAuthorization(...) - * ->withCardPushTransferInstruction(...) - * ->withCategory(...) - * ->withCheckDepositInstruction(...) - * ->withCheckTransferInstruction(...) - * ->withFednowTransferInstruction(...) - * ->withInboundFundsHold(...) - * ->withInboundWireTransferReversal(...) - * ->withOther(...) - * ->withRealTimePaymentsTransferInstruction(...) - * ->withSwiftTransferInstruction(...) - * ->withUserInitiatedHold(...) - * ->withWireTransferInstruction(...) + * (new Source)->withCategory(...) * ``` */ public function __construct() @@ -233,13 +199,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Category|value-of $category * @param AccountTransferInstruction|AccountTransferInstructionShape|null $accountTransferInstruction * @param ACHTransferInstruction|ACHTransferInstructionShape|null $achTransferInstruction * @param BlockchainOfframpTransferInstruction|BlockchainOfframpTransferInstructionShape|null $blockchainOfframpTransferInstruction * @param BlockchainOnrampTransferInstruction|BlockchainOnrampTransferInstructionShape|null $blockchainOnrampTransferInstruction * @param CardAuthorization|CardAuthorizationShape|null $cardAuthorization * @param CardPushTransferInstruction|CardPushTransferInstructionShape|null $cardPushTransferInstruction - * @param Category|value-of $category * @param CheckDepositInstruction|CheckDepositInstructionShape|null $checkDepositInstruction * @param CheckTransferInstruction|CheckTransferInstructionShape|null $checkTransferInstruction * @param FednowTransferInstruction|FednowTransferInstructionShape|null $fednowTransferInstruction @@ -252,43 +218,57 @@ public function __construct() * @param WireTransferInstruction|WireTransferInstructionShape|null $wireTransferInstruction */ public static function with( - AccountTransferInstruction|array|null $accountTransferInstruction, - ACHTransferInstruction|array|null $achTransferInstruction, - BlockchainOfframpTransferInstruction|array|null $blockchainOfframpTransferInstruction, - BlockchainOnrampTransferInstruction|array|null $blockchainOnrampTransferInstruction, - CardAuthorization|array|null $cardAuthorization, - CardPushTransferInstruction|array|null $cardPushTransferInstruction, Category|string $category, - CheckDepositInstruction|array|null $checkDepositInstruction, - CheckTransferInstruction|array|null $checkTransferInstruction, - FednowTransferInstruction|array|null $fednowTransferInstruction, - InboundFundsHold|array|null $inboundFundsHold, - InboundWireTransferReversal|array|null $inboundWireTransferReversal, - Other|array|null $other, - RealTimePaymentsTransferInstruction|array|null $realTimePaymentsTransferInstruction, - SwiftTransferInstruction|array|null $swiftTransferInstruction, - ?array $userInitiatedHold, - WireTransferInstruction|array|null $wireTransferInstruction, + AccountTransferInstruction|array|null $accountTransferInstruction = null, + ACHTransferInstruction|array|null $achTransferInstruction = null, + BlockchainOfframpTransferInstruction|array|null $blockchainOfframpTransferInstruction = null, + BlockchainOnrampTransferInstruction|array|null $blockchainOnrampTransferInstruction = null, + CardAuthorization|array|null $cardAuthorization = null, + CardPushTransferInstruction|array|null $cardPushTransferInstruction = null, + CheckDepositInstruction|array|null $checkDepositInstruction = null, + CheckTransferInstruction|array|null $checkTransferInstruction = null, + FednowTransferInstruction|array|null $fednowTransferInstruction = null, + InboundFundsHold|array|null $inboundFundsHold = null, + InboundWireTransferReversal|array|null $inboundWireTransferReversal = null, + Other|array|null $other = null, + RealTimePaymentsTransferInstruction|array|null $realTimePaymentsTransferInstruction = null, + SwiftTransferInstruction|array|null $swiftTransferInstruction = null, + ?array $userInitiatedHold = null, + WireTransferInstruction|array|null $wireTransferInstruction = null, ): self { $self = new self; - $self['accountTransferInstruction'] = $accountTransferInstruction; - $self['achTransferInstruction'] = $achTransferInstruction; - $self['blockchainOfframpTransferInstruction'] = $blockchainOfframpTransferInstruction; - $self['blockchainOnrampTransferInstruction'] = $blockchainOnrampTransferInstruction; - $self['cardAuthorization'] = $cardAuthorization; - $self['cardPushTransferInstruction'] = $cardPushTransferInstruction; $self['category'] = $category; - $self['checkDepositInstruction'] = $checkDepositInstruction; - $self['checkTransferInstruction'] = $checkTransferInstruction; - $self['fednowTransferInstruction'] = $fednowTransferInstruction; - $self['inboundFundsHold'] = $inboundFundsHold; - $self['inboundWireTransferReversal'] = $inboundWireTransferReversal; - $self['other'] = $other; - $self['realTimePaymentsTransferInstruction'] = $realTimePaymentsTransferInstruction; - $self['swiftTransferInstruction'] = $swiftTransferInstruction; - $self['userInitiatedHold'] = $userInitiatedHold; - $self['wireTransferInstruction'] = $wireTransferInstruction; + + null !== $accountTransferInstruction && $self['accountTransferInstruction'] = $accountTransferInstruction; + null !== $achTransferInstruction && $self['achTransferInstruction'] = $achTransferInstruction; + null !== $blockchainOfframpTransferInstruction && $self['blockchainOfframpTransferInstruction'] = $blockchainOfframpTransferInstruction; + null !== $blockchainOnrampTransferInstruction && $self['blockchainOnrampTransferInstruction'] = $blockchainOnrampTransferInstruction; + null !== $cardAuthorization && $self['cardAuthorization'] = $cardAuthorization; + null !== $cardPushTransferInstruction && $self['cardPushTransferInstruction'] = $cardPushTransferInstruction; + null !== $checkDepositInstruction && $self['checkDepositInstruction'] = $checkDepositInstruction; + null !== $checkTransferInstruction && $self['checkTransferInstruction'] = $checkTransferInstruction; + null !== $fednowTransferInstruction && $self['fednowTransferInstruction'] = $fednowTransferInstruction; + null !== $inboundFundsHold && $self['inboundFundsHold'] = $inboundFundsHold; + null !== $inboundWireTransferReversal && $self['inboundWireTransferReversal'] = $inboundWireTransferReversal; + null !== $other && $self['other'] = $other; + null !== $realTimePaymentsTransferInstruction && $self['realTimePaymentsTransferInstruction'] = $realTimePaymentsTransferInstruction; + null !== $swiftTransferInstruction && $self['swiftTransferInstruction'] = $swiftTransferInstruction; + null !== $userInitiatedHold && $self['userInitiatedHold'] = $userInitiatedHold; + null !== $wireTransferInstruction && $self['wireTransferInstruction'] = $wireTransferInstruction; + + return $self; + } + + /** + * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. + * + * @param Category|value-of $category + */ + public function withCategory(Category|string $category): self + { + $self = clone $this; + $self['category'] = $category; return $self; } @@ -377,19 +357,6 @@ public function withCardPushTransferInstruction( return $self; } - /** - * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. - * - * @param Category|value-of $category - */ - public function withCategory(Category|string $category): self - { - $self = clone $this; - $self['category'] = $category; - - return $self; - } - /** * A Check Deposit Instruction object. This field will be present in the JSON response if and only if `category` is equal to `check_deposit_instruction`. * diff --git a/src/RealTimePaymentsTransfers/RealTimePaymentsTransfer/CreatedBy.php b/src/RealTimePaymentsTransfers/RealTimePaymentsTransfer/CreatedBy.php index af8fca1..37ab5f4 100644 --- a/src/RealTimePaymentsTransfers/RealTimePaymentsTransfer/CreatedBy.php +++ b/src/RealTimePaymentsTransfers/RealTimePaymentsTransfer/CreatedBy.php @@ -4,6 +4,7 @@ namespace Increase\RealTimePaymentsTransfers\RealTimePaymentsTransfer; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -20,10 +21,10 @@ * @phpstan-import-type UserShape from \Increase\RealTimePaymentsTransfers\RealTimePaymentsTransfer\CreatedBy\User * * @phpstan-type CreatedByShape = array{ - * apiKey: null|APIKey|APIKeyShape, * category: Category|value-of, - * oauthApplication: null|OAuthApplication|OAuthApplicationShape, - * user: null|User|UserShape, + * apiKey?: null|APIKey|APIKeyShape, + * oauthApplication?: null|OAuthApplication|OAuthApplicationShape, + * user?: null|User|UserShape, * } */ final class CreatedBy implements BaseModel @@ -31,12 +32,6 @@ final class CreatedBy implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * If present, details about the API key that created the transfer. - */ - #[Required('api_key')] - public ?APIKey $apiKey; - /** * The type of object that created this transfer. * @@ -45,16 +40,22 @@ final class CreatedBy implements BaseModel #[Required(enum: Category::class)] public string $category; + /** + * If present, details about the API key that created the transfer. + */ + #[Optional('api_key', nullable: true)] + public ?APIKey $apiKey; + /** * If present, details about the OAuth Application that created the transfer. */ - #[Required('oauth_application')] + #[Optional('oauth_application', nullable: true)] public ?OAuthApplication $oauthApplication; /** * If present, details about the User that created the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?User $user; /** @@ -62,17 +63,13 @@ final class CreatedBy implements BaseModel * * To enforce required parameters use * ``` - * CreatedBy::with(apiKey: ..., category: ..., oauthApplication: ..., user: ...) + * CreatedBy::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new CreatedBy) - * ->withAPIKey(...) - * ->withCategory(...) - * ->withOAuthApplication(...) - * ->withUser(...) + * (new CreatedBy)->withCategory(...) * ``` */ public function __construct() @@ -85,49 +82,50 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param APIKey|APIKeyShape|null $apiKey * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey * @param OAuthApplication|OAuthApplicationShape|null $oauthApplication * @param User|UserShape|null $user */ public static function with( - APIKey|array|null $apiKey, Category|string $category, - OAuthApplication|array|null $oauthApplication, - User|array|null $user, + APIKey|array|null $apiKey = null, + OAuthApplication|array|null $oauthApplication = null, + User|array|null $user = null, ): self { $self = new self; - $self['apiKey'] = $apiKey; $self['category'] = $category; - $self['oauthApplication'] = $oauthApplication; - $self['user'] = $user; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $oauthApplication && $self['oauthApplication'] = $oauthApplication; + null !== $user && $self['user'] = $user; return $self; } /** - * If present, details about the API key that created the transfer. + * The type of object that created this transfer. * - * @param APIKey|APIKeyShape|null $apiKey + * @param Category|value-of $category */ - public function withAPIKey(APIKey|array|null $apiKey): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['apiKey'] = $apiKey; + $self['category'] = $category; return $self; } /** - * The type of object that created this transfer. + * If present, details about the API key that created the transfer. * - * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey */ - public function withCategory(Category|string $category): self + public function withAPIKey(APIKey|array|null $apiKey): self { $self = clone $this; - $self['category'] = $category; + $self['apiKey'] = $apiKey; return $self; } diff --git a/src/SwiftTransfers/SwiftTransfer/CreatedBy.php b/src/SwiftTransfers/SwiftTransfer/CreatedBy.php index 188f0ab..f798cfa 100644 --- a/src/SwiftTransfers/SwiftTransfer/CreatedBy.php +++ b/src/SwiftTransfers/SwiftTransfer/CreatedBy.php @@ -4,6 +4,7 @@ namespace Increase\SwiftTransfers\SwiftTransfer; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -20,10 +21,10 @@ * @phpstan-import-type UserShape from \Increase\SwiftTransfers\SwiftTransfer\CreatedBy\User * * @phpstan-type CreatedByShape = array{ - * apiKey: null|APIKey|APIKeyShape, * category: Category|value-of, - * oauthApplication: null|OAuthApplication|OAuthApplicationShape, - * user: null|User|UserShape, + * apiKey?: null|APIKey|APIKeyShape, + * oauthApplication?: null|OAuthApplication|OAuthApplicationShape, + * user?: null|User|UserShape, * } */ final class CreatedBy implements BaseModel @@ -31,12 +32,6 @@ final class CreatedBy implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * If present, details about the API key that created the transfer. - */ - #[Required('api_key')] - public ?APIKey $apiKey; - /** * The type of object that created this transfer. * @@ -45,16 +40,22 @@ final class CreatedBy implements BaseModel #[Required(enum: Category::class)] public string $category; + /** + * If present, details about the API key that created the transfer. + */ + #[Optional('api_key', nullable: true)] + public ?APIKey $apiKey; + /** * If present, details about the OAuth Application that created the transfer. */ - #[Required('oauth_application')] + #[Optional('oauth_application', nullable: true)] public ?OAuthApplication $oauthApplication; /** * If present, details about the User that created the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?User $user; /** @@ -62,17 +63,13 @@ final class CreatedBy implements BaseModel * * To enforce required parameters use * ``` - * CreatedBy::with(apiKey: ..., category: ..., oauthApplication: ..., user: ...) + * CreatedBy::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new CreatedBy) - * ->withAPIKey(...) - * ->withCategory(...) - * ->withOAuthApplication(...) - * ->withUser(...) + * (new CreatedBy)->withCategory(...) * ``` */ public function __construct() @@ -85,49 +82,50 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param APIKey|APIKeyShape|null $apiKey * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey * @param OAuthApplication|OAuthApplicationShape|null $oauthApplication * @param User|UserShape|null $user */ public static function with( - APIKey|array|null $apiKey, Category|string $category, - OAuthApplication|array|null $oauthApplication, - User|array|null $user, + APIKey|array|null $apiKey = null, + OAuthApplication|array|null $oauthApplication = null, + User|array|null $user = null, ): self { $self = new self; - $self['apiKey'] = $apiKey; $self['category'] = $category; - $self['oauthApplication'] = $oauthApplication; - $self['user'] = $user; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $oauthApplication && $self['oauthApplication'] = $oauthApplication; + null !== $user && $self['user'] = $user; return $self; } /** - * If present, details about the API key that created the transfer. + * The type of object that created this transfer. * - * @param APIKey|APIKeyShape|null $apiKey + * @param Category|value-of $category */ - public function withAPIKey(APIKey|array|null $apiKey): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['apiKey'] = $apiKey; + $self['category'] = $category; return $self; } /** - * The type of object that created this transfer. + * If present, details about the API key that created the transfer. * - * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey */ - public function withCategory(Category|string $category): self + public function withAPIKey(APIKey|array|null $apiKey): self { $self = clone $this; - $self['category'] = $category; + $self['apiKey'] = $apiKey; return $self; } diff --git a/src/Transactions/Transaction/Source.php b/src/Transactions/Transaction/Source.php index f5b6ab6..0162fe2 100644 --- a/src/Transactions/Transaction/Source.php +++ b/src/Transactions/Transaction/Source.php @@ -4,6 +4,7 @@ namespace Increase\Transactions\Transaction; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -90,45 +91,45 @@ * @phpstan-import-type WireTransferIntentionShape from \Increase\Transactions\Transaction\Source\WireTransferIntention * * @phpstan-type SourceShape = array{ - * accountRevenuePayment: null|AccountRevenuePayment|AccountRevenuePaymentShape, - * accountTransferIntention: null|AccountTransferIntention|AccountTransferIntentionShape, - * achTransferIntention: null|ACHTransferIntention|ACHTransferIntentionShape, - * achTransferRejection: null|ACHTransferRejection|ACHTransferRejectionShape, - * achTransferReturn: null|ACHTransferReturn|ACHTransferReturnShape, - * blockchainOfframpTransferSettlement: null|BlockchainOfframpTransferSettlement|BlockchainOfframpTransferSettlementShape, - * blockchainOnrampTransferIntention: null|BlockchainOnrampTransferIntention|BlockchainOnrampTransferIntentionShape, - * cardDisputeAcceptance: null|CardDisputeAcceptance|CardDisputeAcceptanceShape, - * cardDisputeFinancial: null|CardDisputeFinancial|CardDisputeFinancialShape, - * cardDisputeLoss: null|CardDisputeLoss|CardDisputeLossShape, - * cardFinancial: null|CardFinancial|CardFinancialShape, - * cardPushTransferAcceptance: null|CardPushTransferAcceptance|CardPushTransferAcceptanceShape, - * cardRefund: null|CardRefund|CardRefundShape, - * cardRevenuePayment: null|CardRevenuePayment|CardRevenuePaymentShape, - * cardSettlement: null|CardSettlement|CardSettlementShape, - * cashbackPayment: null|CashbackPayment|CashbackPaymentShape, * category: Category|value-of, - * checkDepositAcceptance: null|CheckDepositAcceptance|CheckDepositAcceptanceShape, - * checkDepositReturn: null|CheckDepositReturn|CheckDepositReturnShape, - * checkTransferDeposit: null|CheckTransferDeposit|CheckTransferDepositShape, - * fednowTransferAcknowledgement: null|FednowTransferAcknowledgement|FednowTransferAcknowledgementShape, - * feePayment: null|FeePayment|FeePaymentShape, - * inboundACHTransfer: null|InboundACHTransfer|InboundACHTransferShape, - * inboundACHTransferReturnIntention: null|InboundACHTransferReturnIntention|InboundACHTransferReturnIntentionShape, - * inboundCheckAdjustment: null|InboundCheckAdjustment|InboundCheckAdjustmentShape, - * inboundCheckDepositReturnIntention: null|InboundCheckDepositReturnIntention|InboundCheckDepositReturnIntentionShape, - * inboundFednowTransferConfirmation: null|InboundFednowTransferConfirmation|InboundFednowTransferConfirmationShape, - * inboundRealTimePaymentsTransferConfirmation: null|InboundRealTimePaymentsTransferConfirmation|InboundRealTimePaymentsTransferConfirmationShape, - * inboundWireReversal: null|InboundWireReversal|InboundWireReversalShape, - * inboundWireTransfer: null|InboundWireTransfer|InboundWireTransferShape, - * inboundWireTransferReversal: null|InboundWireTransferReversal|InboundWireTransferReversalShape, - * interestPayment: null|InterestPayment|InterestPaymentShape, - * internalSource: null|InternalSource|InternalSourceShape, - * other: null|Other|OtherShape, - * realTimePaymentsTransferAcknowledgement: null|RealTimePaymentsTransferAcknowledgement|RealTimePaymentsTransferAcknowledgementShape, - * sampleFunds: null|SampleFunds|SampleFundsShape, - * swiftTransferIntention: null|SwiftTransferIntention|SwiftTransferIntentionShape, - * swiftTransferReturn: null|SwiftTransferReturn|SwiftTransferReturnShape, - * wireTransferIntention: null|WireTransferIntention|WireTransferIntentionShape, + * accountRevenuePayment?: null|AccountRevenuePayment|AccountRevenuePaymentShape, + * accountTransferIntention?: null|AccountTransferIntention|AccountTransferIntentionShape, + * achTransferIntention?: null|ACHTransferIntention|ACHTransferIntentionShape, + * achTransferRejection?: null|ACHTransferRejection|ACHTransferRejectionShape, + * achTransferReturn?: null|ACHTransferReturn|ACHTransferReturnShape, + * blockchainOfframpTransferSettlement?: null|BlockchainOfframpTransferSettlement|BlockchainOfframpTransferSettlementShape, + * blockchainOnrampTransferIntention?: null|BlockchainOnrampTransferIntention|BlockchainOnrampTransferIntentionShape, + * cardDisputeAcceptance?: null|CardDisputeAcceptance|CardDisputeAcceptanceShape, + * cardDisputeFinancial?: null|CardDisputeFinancial|CardDisputeFinancialShape, + * cardDisputeLoss?: null|CardDisputeLoss|CardDisputeLossShape, + * cardFinancial?: null|CardFinancial|CardFinancialShape, + * cardPushTransferAcceptance?: null|CardPushTransferAcceptance|CardPushTransferAcceptanceShape, + * cardRefund?: null|CardRefund|CardRefundShape, + * cardRevenuePayment?: null|CardRevenuePayment|CardRevenuePaymentShape, + * cardSettlement?: null|CardSettlement|CardSettlementShape, + * cashbackPayment?: null|CashbackPayment|CashbackPaymentShape, + * checkDepositAcceptance?: null|CheckDepositAcceptance|CheckDepositAcceptanceShape, + * checkDepositReturn?: null|CheckDepositReturn|CheckDepositReturnShape, + * checkTransferDeposit?: null|CheckTransferDeposit|CheckTransferDepositShape, + * fednowTransferAcknowledgement?: null|FednowTransferAcknowledgement|FednowTransferAcknowledgementShape, + * feePayment?: null|FeePayment|FeePaymentShape, + * inboundACHTransfer?: null|InboundACHTransfer|InboundACHTransferShape, + * inboundACHTransferReturnIntention?: null|InboundACHTransferReturnIntention|InboundACHTransferReturnIntentionShape, + * inboundCheckAdjustment?: null|InboundCheckAdjustment|InboundCheckAdjustmentShape, + * inboundCheckDepositReturnIntention?: null|InboundCheckDepositReturnIntention|InboundCheckDepositReturnIntentionShape, + * inboundFednowTransferConfirmation?: null|InboundFednowTransferConfirmation|InboundFednowTransferConfirmationShape, + * inboundRealTimePaymentsTransferConfirmation?: null|InboundRealTimePaymentsTransferConfirmation|InboundRealTimePaymentsTransferConfirmationShape, + * inboundWireReversal?: null|InboundWireReversal|InboundWireReversalShape, + * inboundWireTransfer?: null|InboundWireTransfer|InboundWireTransferShape, + * inboundWireTransferReversal?: null|InboundWireTransferReversal|InboundWireTransferReversalShape, + * interestPayment?: null|InterestPayment|InterestPaymentShape, + * internalSource?: null|InternalSource|InternalSourceShape, + * other?: null|Other|OtherShape, + * realTimePaymentsTransferAcknowledgement?: null|RealTimePaymentsTransferAcknowledgement|RealTimePaymentsTransferAcknowledgementShape, + * sampleFunds?: null|SampleFunds|SampleFundsShape, + * swiftTransferIntention?: null|SwiftTransferIntention|SwiftTransferIntentionShape, + * swiftTransferReturn?: null|SwiftTransferReturn|SwiftTransferReturnShape, + * wireTransferIntention?: null|WireTransferIntention|WireTransferIntentionShape, * } */ final class Source implements BaseModel @@ -136,240 +137,243 @@ final class Source implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. + * + * @var value-of $category + */ + #[Required(enum: Category::class)] + public string $category; + /** * An Account Revenue Payment object. This field will be present in the JSON response if and only if `category` is equal to `account_revenue_payment`. An Account Revenue Payment represents a payment made to an account from the bank. Account revenue is a type of non-interest income. */ - #[Required('account_revenue_payment')] + #[Optional('account_revenue_payment', nullable: true)] public ?AccountRevenuePayment $accountRevenuePayment; /** * An Account Transfer Intention object. This field will be present in the JSON response if and only if `category` is equal to `account_transfer_intention`. Two Account Transfer Intentions are created from each Account Transfer. One decrements the source account, and the other increments the destination account. */ - #[Required('account_transfer_intention')] + #[Optional('account_transfer_intention', nullable: true)] public ?AccountTransferIntention $accountTransferIntention; /** * An ACH Transfer Intention object. This field will be present in the JSON response if and only if `category` is equal to `ach_transfer_intention`. An ACH Transfer Intention is created from an ACH Transfer. It reflects the intention to move money into or out of an Increase account via the ACH network. */ - #[Required('ach_transfer_intention')] + #[Optional('ach_transfer_intention', nullable: true)] public ?ACHTransferIntention $achTransferIntention; /** * An ACH Transfer Rejection object. This field will be present in the JSON response if and only if `category` is equal to `ach_transfer_rejection`. An ACH Transfer Rejection is created when an ACH Transfer is rejected by Increase. It offsets the ACH Transfer Intention. These rejections are rare. */ - #[Required('ach_transfer_rejection')] + #[Optional('ach_transfer_rejection', nullable: true)] public ?ACHTransferRejection $achTransferRejection; /** * An ACH Transfer Return object. This field will be present in the JSON response if and only if `category` is equal to `ach_transfer_return`. An ACH Transfer Return is created when an ACH Transfer is returned by the receiving bank. It offsets the ACH Transfer Intention. ACH Transfer Returns usually occur within the first two business days after the transfer is initiated, but can occur much later. */ - #[Required('ach_transfer_return')] + #[Optional('ach_transfer_return', nullable: true)] public ?ACHTransferReturn $achTransferReturn; /** * A Blockchain Off-Ramp Transfer Settlement object. This field will be present in the JSON response if and only if `category` is equal to `blockchain_offramp_transfer_settlement`. */ - #[Required('blockchain_offramp_transfer_settlement')] + #[Optional('blockchain_offramp_transfer_settlement', nullable: true)] public ?BlockchainOfframpTransferSettlement $blockchainOfframpTransferSettlement; /** * A Blockchain On-Ramp Transfer Intention object. This field will be present in the JSON response if and only if `category` is equal to `blockchain_onramp_transfer_intention`. */ - #[Required('blockchain_onramp_transfer_intention')] + #[Optional('blockchain_onramp_transfer_intention', nullable: true)] public ?BlockchainOnrampTransferIntention $blockchainOnrampTransferIntention; /** * A Legacy Card Dispute Acceptance object. This field will be present in the JSON response if and only if `category` is equal to `card_dispute_acceptance`. Contains the details of a successful Card Dispute. */ - #[Required('card_dispute_acceptance')] + #[Optional('card_dispute_acceptance', nullable: true)] public ?CardDisputeAcceptance $cardDisputeAcceptance; /** * A Card Dispute Financial object. This field will be present in the JSON response if and only if `category` is equal to `card_dispute_financial`. Financial event related to a Card Dispute. */ - #[Required('card_dispute_financial')] + #[Optional('card_dispute_financial', nullable: true)] public ?CardDisputeFinancial $cardDisputeFinancial; /** * A Legacy Card Dispute Loss object. This field will be present in the JSON response if and only if `category` is equal to `card_dispute_loss`. Contains the details of a lost Card Dispute. */ - #[Required('card_dispute_loss')] + #[Optional('card_dispute_loss', nullable: true)] public ?CardDisputeLoss $cardDisputeLoss; /** * A Card Financial object. This field will be present in the JSON response if and only if `category` is equal to `card_financial`. Card Financials are temporary holds placed on a customers funds with the intent to later clear a transaction. */ - #[Required('card_financial')] + #[Optional('card_financial', nullable: true)] public ?CardFinancial $cardFinancial; /** * A Card Push Transfer Acceptance object. This field will be present in the JSON response if and only if `category` is equal to `card_push_transfer_acceptance`. A Card Push Transfer Acceptance is created when an Outbound Card Push Transfer sent from Increase is accepted by the receiving bank. */ - #[Required('card_push_transfer_acceptance')] + #[Optional('card_push_transfer_acceptance', nullable: true)] public ?CardPushTransferAcceptance $cardPushTransferAcceptance; /** * A Card Refund object. This field will be present in the JSON response if and only if `category` is equal to `card_refund`. Card Refunds move money back to the cardholder. While they are usually connected to a Card Settlement an acquirer can also refund money directly to a card without relation to a transaction. */ - #[Required('card_refund')] + #[Optional('card_refund', nullable: true)] public ?CardRefund $cardRefund; /** * A Card Revenue Payment object. This field will be present in the JSON response if and only if `category` is equal to `card_revenue_payment`. Card Revenue Payments reflect earnings from fees on card transactions. */ - #[Required('card_revenue_payment')] + #[Optional('card_revenue_payment', nullable: true)] public ?CardRevenuePayment $cardRevenuePayment; /** * A Card Settlement object. This field will be present in the JSON response if and only if `category` is equal to `card_settlement`. Card Settlements are card transactions that have cleared and settled. While a settlement is usually preceded by an authorization, an acquirer can also directly clear a transaction without first authorizing it. */ - #[Required('card_settlement')] + #[Optional('card_settlement', nullable: true)] public ?CardSettlement $cardSettlement; /** * A Cashback Payment object. This field will be present in the JSON response if and only if `category` is equal to `cashback_payment`. A Cashback Payment represents the cashback paid to a cardholder for a given period. Cashback is usually paid monthly for the prior month's transactions. */ - #[Required('cashback_payment')] + #[Optional('cashback_payment', nullable: true)] public ?CashbackPayment $cashbackPayment; - /** - * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. - * - * @var value-of $category - */ - #[Required(enum: Category::class)] - public string $category; - /** * A Check Deposit Acceptance object. This field will be present in the JSON response if and only if `category` is equal to `check_deposit_acceptance`. A Check Deposit Acceptance is created when a Check Deposit is processed and its details confirmed. Check Deposits may be returned by the receiving bank, which will appear as a Check Deposit Return. */ - #[Required('check_deposit_acceptance')] + #[Optional('check_deposit_acceptance', nullable: true)] public ?CheckDepositAcceptance $checkDepositAcceptance; /** * A Check Deposit Return object. This field will be present in the JSON response if and only if `category` is equal to `check_deposit_return`. A Check Deposit Return is created when a Check Deposit is returned by the bank holding the account it was drawn against. Check Deposits may be returned for a variety of reasons, including insufficient funds or a mismatched account number. Usually, checks are returned within the first 7 days after the deposit is made. */ - #[Required('check_deposit_return')] + #[Optional('check_deposit_return', nullable: true)] public ?CheckDepositReturn $checkDepositReturn; /** * A Check Transfer Deposit object. This field will be present in the JSON response if and only if `category` is equal to `check_transfer_deposit`. An Inbound Check is a check drawn on an Increase account that has been deposited by an external bank account. These types of checks are not pre-registered. */ - #[Required('check_transfer_deposit')] + #[Optional('check_transfer_deposit', nullable: true)] public ?CheckTransferDeposit $checkTransferDeposit; /** * A FedNow Transfer Acknowledgement object. This field will be present in the JSON response if and only if `category` is equal to `fednow_transfer_acknowledgement`. A FedNow Transfer Acknowledgement is created when a FedNow Transfer sent from Increase is acknowledged by the receiving bank. */ - #[Required('fednow_transfer_acknowledgement')] + #[Optional('fednow_transfer_acknowledgement', nullable: true)] public ?FednowTransferAcknowledgement $fednowTransferAcknowledgement; /** * A Fee Payment object. This field will be present in the JSON response if and only if `category` is equal to `fee_payment`. A Fee Payment represents a payment made to Increase. */ - #[Required('fee_payment')] + #[Optional('fee_payment', nullable: true)] public ?FeePayment $feePayment; /** * An Inbound ACH Transfer Intention object. This field will be present in the JSON response if and only if `category` is equal to `inbound_ach_transfer`. An Inbound ACH Transfer Intention is created when an ACH transfer is initiated at another bank and received by Increase. */ - #[Required('inbound_ach_transfer')] + #[Optional('inbound_ach_transfer', nullable: true)] public ?InboundACHTransfer $inboundACHTransfer; /** * An Inbound ACH Transfer Return Intention object. This field will be present in the JSON response if and only if `category` is equal to `inbound_ach_transfer_return_intention`. An Inbound ACH Transfer Return Intention is created when an ACH transfer is initiated at another bank and returned by Increase. */ - #[Required('inbound_ach_transfer_return_intention')] + #[Optional('inbound_ach_transfer_return_intention', nullable: true)] public ?InboundACHTransferReturnIntention $inboundACHTransferReturnIntention; /** * An Inbound Check Adjustment object. This field will be present in the JSON response if and only if `category` is equal to `inbound_check_adjustment`. An Inbound Check Adjustment is created when Increase receives an adjustment for a check or return deposited through Check21. */ - #[Required('inbound_check_adjustment')] + #[Optional('inbound_check_adjustment', nullable: true)] public ?InboundCheckAdjustment $inboundCheckAdjustment; /** * An Inbound Check Deposit Return Intention object. This field will be present in the JSON response if and only if `category` is equal to `inbound_check_deposit_return_intention`. An Inbound Check Deposit Return Intention is created when Increase receives an Inbound Check and the User requests that it be returned. */ - #[Required('inbound_check_deposit_return_intention')] + #[Optional('inbound_check_deposit_return_intention', nullable: true)] public ?InboundCheckDepositReturnIntention $inboundCheckDepositReturnIntention; /** * An Inbound FedNow Transfer Confirmation object. This field will be present in the JSON response if and only if `category` is equal to `inbound_fednow_transfer_confirmation`. An Inbound FedNow Transfer Confirmation is created when a FedNow transfer is initiated at another bank and received by Increase. */ - #[Required('inbound_fednow_transfer_confirmation')] + #[Optional('inbound_fednow_transfer_confirmation', nullable: true)] public ?InboundFednowTransferConfirmation $inboundFednowTransferConfirmation; /** * An Inbound Real-Time Payments Transfer Confirmation object. This field will be present in the JSON response if and only if `category` is equal to `inbound_real_time_payments_transfer_confirmation`. An Inbound Real-Time Payments Transfer Confirmation is created when a Real-Time Payments transfer is initiated at another bank and received by Increase. */ - #[Required('inbound_real_time_payments_transfer_confirmation')] + #[Optional( + 'inbound_real_time_payments_transfer_confirmation', + nullable: true + )] public ?InboundRealTimePaymentsTransferConfirmation $inboundRealTimePaymentsTransferConfirmation; /** * An Inbound Wire Reversal object. This field will be present in the JSON response if and only if `category` is equal to `inbound_wire_reversal`. An Inbound Wire Reversal represents a reversal of a wire transfer that was initiated via Increase. The other bank is sending the money back. This most often happens when the original destination account details were incorrect. */ - #[Required('inbound_wire_reversal')] + #[Optional('inbound_wire_reversal', nullable: true)] public ?InboundWireReversal $inboundWireReversal; /** * An Inbound Wire Transfer Intention object. This field will be present in the JSON response if and only if `category` is equal to `inbound_wire_transfer`. An Inbound Wire Transfer Intention is created when a wire transfer is initiated at another bank and received by Increase. */ - #[Required('inbound_wire_transfer')] + #[Optional('inbound_wire_transfer', nullable: true)] public ?InboundWireTransfer $inboundWireTransfer; /** * An Inbound Wire Transfer Reversal Intention object. This field will be present in the JSON response if and only if `category` is equal to `inbound_wire_transfer_reversal`. An Inbound Wire Transfer Reversal Intention is created when Increase has received a wire and the User requests that it be reversed. */ - #[Required('inbound_wire_transfer_reversal')] + #[Optional('inbound_wire_transfer_reversal', nullable: true)] public ?InboundWireTransferReversal $inboundWireTransferReversal; /** * An Interest Payment object. This field will be present in the JSON response if and only if `category` is equal to `interest_payment`. An Interest Payment represents a payment of interest on an account. Interest is usually paid monthly. */ - #[Required('interest_payment')] + #[Optional('interest_payment', nullable: true)] public ?InterestPayment $interestPayment; /** * An Internal Source object. This field will be present in the JSON response if and only if `category` is equal to `internal_source`. A transaction between the user and Increase. See the `reason` attribute for more information. */ - #[Required('internal_source')] + #[Optional('internal_source', nullable: true)] public ?InternalSource $internalSource; /** * If the category of this Transaction source is equal to `other`, this field will contain an empty object, otherwise it will contain null. */ - #[Required] + #[Optional(nullable: true)] public ?Other $other; /** * A Real-Time Payments Transfer Acknowledgement object. This field will be present in the JSON response if and only if `category` is equal to `real_time_payments_transfer_acknowledgement`. A Real-Time Payments Transfer Acknowledgement is created when a Real-Time Payments Transfer sent from Increase is acknowledged by the receiving bank. */ - #[Required('real_time_payments_transfer_acknowledgement')] + #[Optional('real_time_payments_transfer_acknowledgement', nullable: true)] public ?RealTimePaymentsTransferAcknowledgement $realTimePaymentsTransferAcknowledgement; /** * A Sample Funds object. This field will be present in the JSON response if and only if `category` is equal to `sample_funds`. Sample funds for testing purposes. */ - #[Required('sample_funds')] + #[Optional('sample_funds', nullable: true)] public ?SampleFunds $sampleFunds; /** * A Swift Transfer Intention object. This field will be present in the JSON response if and only if `category` is equal to `swift_transfer_intention`. A Swift Transfer initiated via Increase. */ - #[Required('swift_transfer_intention')] + #[Optional('swift_transfer_intention', nullable: true)] public ?SwiftTransferIntention $swiftTransferIntention; /** * A Swift Transfer Return object. This field will be present in the JSON response if and only if `category` is equal to `swift_transfer_return`. A Swift Transfer Return is created when a Swift Transfer is returned by the receiving bank. */ - #[Required('swift_transfer_return')] + #[Optional('swift_transfer_return', nullable: true)] public ?SwiftTransferReturn $swiftTransferReturn; /** * A Wire Transfer Intention object. This field will be present in the JSON response if and only if `category` is equal to `wire_transfer_intention`. A Wire Transfer initiated via Increase and sent to a different bank. */ - #[Required('wire_transfer_intention')] + #[Optional('wire_transfer_intention', nullable: true)] public ?WireTransferIntention $wireTransferIntention; /** @@ -377,92 +381,13 @@ final class Source implements BaseModel * * To enforce required parameters use * ``` - * Source::with( - * accountRevenuePayment: ..., - * accountTransferIntention: ..., - * achTransferIntention: ..., - * achTransferRejection: ..., - * achTransferReturn: ..., - * blockchainOfframpTransferSettlement: ..., - * blockchainOnrampTransferIntention: ..., - * cardDisputeAcceptance: ..., - * cardDisputeFinancial: ..., - * cardDisputeLoss: ..., - * cardFinancial: ..., - * cardPushTransferAcceptance: ..., - * cardRefund: ..., - * cardRevenuePayment: ..., - * cardSettlement: ..., - * cashbackPayment: ..., - * category: ..., - * checkDepositAcceptance: ..., - * checkDepositReturn: ..., - * checkTransferDeposit: ..., - * fednowTransferAcknowledgement: ..., - * feePayment: ..., - * inboundACHTransfer: ..., - * inboundACHTransferReturnIntention: ..., - * inboundCheckAdjustment: ..., - * inboundCheckDepositReturnIntention: ..., - * inboundFednowTransferConfirmation: ..., - * inboundRealTimePaymentsTransferConfirmation: ..., - * inboundWireReversal: ..., - * inboundWireTransfer: ..., - * inboundWireTransferReversal: ..., - * interestPayment: ..., - * internalSource: ..., - * other: ..., - * realTimePaymentsTransferAcknowledgement: ..., - * sampleFunds: ..., - * swiftTransferIntention: ..., - * swiftTransferReturn: ..., - * wireTransferIntention: ..., - * ) + * Source::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Source) - * ->withAccountRevenuePayment(...) - * ->withAccountTransferIntention(...) - * ->withACHTransferIntention(...) - * ->withACHTransferRejection(...) - * ->withACHTransferReturn(...) - * ->withBlockchainOfframpTransferSettlement(...) - * ->withBlockchainOnrampTransferIntention(...) - * ->withCardDisputeAcceptance(...) - * ->withCardDisputeFinancial(...) - * ->withCardDisputeLoss(...) - * ->withCardFinancial(...) - * ->withCardPushTransferAcceptance(...) - * ->withCardRefund(...) - * ->withCardRevenuePayment(...) - * ->withCardSettlement(...) - * ->withCashbackPayment(...) - * ->withCategory(...) - * ->withCheckDepositAcceptance(...) - * ->withCheckDepositReturn(...) - * ->withCheckTransferDeposit(...) - * ->withFednowTransferAcknowledgement(...) - * ->withFeePayment(...) - * ->withInboundACHTransfer(...) - * ->withInboundACHTransferReturnIntention(...) - * ->withInboundCheckAdjustment(...) - * ->withInboundCheckDepositReturnIntention(...) - * ->withInboundFednowTransferConfirmation(...) - * ->withInboundRealTimePaymentsTransferConfirmation(...) - * ->withInboundWireReversal(...) - * ->withInboundWireTransfer(...) - * ->withInboundWireTransferReversal(...) - * ->withInterestPayment(...) - * ->withInternalSource(...) - * ->withOther(...) - * ->withRealTimePaymentsTransferAcknowledgement(...) - * ->withSampleFunds(...) - * ->withSwiftTransferIntention(...) - * ->withSwiftTransferReturn(...) - * ->withWireTransferIntention(...) + * (new Source)->withCategory(...) * ``` */ public function __construct() @@ -475,6 +400,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Category|value-of $category * @param AccountRevenuePayment|AccountRevenuePaymentShape|null $accountRevenuePayment * @param AccountTransferIntention|AccountTransferIntentionShape|null $accountTransferIntention * @param ACHTransferIntention|ACHTransferIntentionShape|null $achTransferIntention @@ -491,7 +417,6 @@ public function __construct() * @param CardRevenuePayment|CardRevenuePaymentShape|null $cardRevenuePayment * @param CardSettlement|CardSettlementShape|null $cardSettlement * @param CashbackPayment|CashbackPaymentShape|null $cashbackPayment - * @param Category|value-of $category * @param CheckDepositAcceptance|CheckDepositAcceptanceShape|null $checkDepositAcceptance * @param CheckDepositReturn|CheckDepositReturnShape|null $checkDepositReturn * @param CheckTransferDeposit|CheckTransferDepositShape|null $checkTransferDeposit @@ -516,87 +441,101 @@ public function __construct() * @param WireTransferIntention|WireTransferIntentionShape|null $wireTransferIntention */ public static function with( - AccountRevenuePayment|array|null $accountRevenuePayment, - AccountTransferIntention|array|null $accountTransferIntention, - ACHTransferIntention|array|null $achTransferIntention, - ACHTransferRejection|array|null $achTransferRejection, - ACHTransferReturn|array|null $achTransferReturn, - BlockchainOfframpTransferSettlement|array|null $blockchainOfframpTransferSettlement, - BlockchainOnrampTransferIntention|array|null $blockchainOnrampTransferIntention, - CardDisputeAcceptance|array|null $cardDisputeAcceptance, - CardDisputeFinancial|array|null $cardDisputeFinancial, - CardDisputeLoss|array|null $cardDisputeLoss, - CardFinancial|array|null $cardFinancial, - CardPushTransferAcceptance|array|null $cardPushTransferAcceptance, - CardRefund|array|null $cardRefund, - CardRevenuePayment|array|null $cardRevenuePayment, - CardSettlement|array|null $cardSettlement, - CashbackPayment|array|null $cashbackPayment, Category|string $category, - CheckDepositAcceptance|array|null $checkDepositAcceptance, - CheckDepositReturn|array|null $checkDepositReturn, - CheckTransferDeposit|array|null $checkTransferDeposit, - FednowTransferAcknowledgement|array|null $fednowTransferAcknowledgement, - FeePayment|array|null $feePayment, - InboundACHTransfer|array|null $inboundACHTransfer, - InboundACHTransferReturnIntention|array|null $inboundACHTransferReturnIntention, - InboundCheckAdjustment|array|null $inboundCheckAdjustment, - InboundCheckDepositReturnIntention|array|null $inboundCheckDepositReturnIntention, - InboundFednowTransferConfirmation|array|null $inboundFednowTransferConfirmation, - InboundRealTimePaymentsTransferConfirmation|array|null $inboundRealTimePaymentsTransferConfirmation, - InboundWireReversal|array|null $inboundWireReversal, - InboundWireTransfer|array|null $inboundWireTransfer, - InboundWireTransferReversal|array|null $inboundWireTransferReversal, - InterestPayment|array|null $interestPayment, - InternalSource|array|null $internalSource, - Other|array|null $other, - RealTimePaymentsTransferAcknowledgement|array|null $realTimePaymentsTransferAcknowledgement, - SampleFunds|array|null $sampleFunds, - SwiftTransferIntention|array|null $swiftTransferIntention, - SwiftTransferReturn|array|null $swiftTransferReturn, - WireTransferIntention|array|null $wireTransferIntention, + AccountRevenuePayment|array|null $accountRevenuePayment = null, + AccountTransferIntention|array|null $accountTransferIntention = null, + ACHTransferIntention|array|null $achTransferIntention = null, + ACHTransferRejection|array|null $achTransferRejection = null, + ACHTransferReturn|array|null $achTransferReturn = null, + BlockchainOfframpTransferSettlement|array|null $blockchainOfframpTransferSettlement = null, + BlockchainOnrampTransferIntention|array|null $blockchainOnrampTransferIntention = null, + CardDisputeAcceptance|array|null $cardDisputeAcceptance = null, + CardDisputeFinancial|array|null $cardDisputeFinancial = null, + CardDisputeLoss|array|null $cardDisputeLoss = null, + CardFinancial|array|null $cardFinancial = null, + CardPushTransferAcceptance|array|null $cardPushTransferAcceptance = null, + CardRefund|array|null $cardRefund = null, + CardRevenuePayment|array|null $cardRevenuePayment = null, + CardSettlement|array|null $cardSettlement = null, + CashbackPayment|array|null $cashbackPayment = null, + CheckDepositAcceptance|array|null $checkDepositAcceptance = null, + CheckDepositReturn|array|null $checkDepositReturn = null, + CheckTransferDeposit|array|null $checkTransferDeposit = null, + FednowTransferAcknowledgement|array|null $fednowTransferAcknowledgement = null, + FeePayment|array|null $feePayment = null, + InboundACHTransfer|array|null $inboundACHTransfer = null, + InboundACHTransferReturnIntention|array|null $inboundACHTransferReturnIntention = null, + InboundCheckAdjustment|array|null $inboundCheckAdjustment = null, + InboundCheckDepositReturnIntention|array|null $inboundCheckDepositReturnIntention = null, + InboundFednowTransferConfirmation|array|null $inboundFednowTransferConfirmation = null, + InboundRealTimePaymentsTransferConfirmation|array|null $inboundRealTimePaymentsTransferConfirmation = null, + InboundWireReversal|array|null $inboundWireReversal = null, + InboundWireTransfer|array|null $inboundWireTransfer = null, + InboundWireTransferReversal|array|null $inboundWireTransferReversal = null, + InterestPayment|array|null $interestPayment = null, + InternalSource|array|null $internalSource = null, + Other|array|null $other = null, + RealTimePaymentsTransferAcknowledgement|array|null $realTimePaymentsTransferAcknowledgement = null, + SampleFunds|array|null $sampleFunds = null, + SwiftTransferIntention|array|null $swiftTransferIntention = null, + SwiftTransferReturn|array|null $swiftTransferReturn = null, + WireTransferIntention|array|null $wireTransferIntention = null, ): self { $self = new self; - $self['accountRevenuePayment'] = $accountRevenuePayment; - $self['accountTransferIntention'] = $accountTransferIntention; - $self['achTransferIntention'] = $achTransferIntention; - $self['achTransferRejection'] = $achTransferRejection; - $self['achTransferReturn'] = $achTransferReturn; - $self['blockchainOfframpTransferSettlement'] = $blockchainOfframpTransferSettlement; - $self['blockchainOnrampTransferIntention'] = $blockchainOnrampTransferIntention; - $self['cardDisputeAcceptance'] = $cardDisputeAcceptance; - $self['cardDisputeFinancial'] = $cardDisputeFinancial; - $self['cardDisputeLoss'] = $cardDisputeLoss; - $self['cardFinancial'] = $cardFinancial; - $self['cardPushTransferAcceptance'] = $cardPushTransferAcceptance; - $self['cardRefund'] = $cardRefund; - $self['cardRevenuePayment'] = $cardRevenuePayment; - $self['cardSettlement'] = $cardSettlement; - $self['cashbackPayment'] = $cashbackPayment; $self['category'] = $category; - $self['checkDepositAcceptance'] = $checkDepositAcceptance; - $self['checkDepositReturn'] = $checkDepositReturn; - $self['checkTransferDeposit'] = $checkTransferDeposit; - $self['fednowTransferAcknowledgement'] = $fednowTransferAcknowledgement; - $self['feePayment'] = $feePayment; - $self['inboundACHTransfer'] = $inboundACHTransfer; - $self['inboundACHTransferReturnIntention'] = $inboundACHTransferReturnIntention; - $self['inboundCheckAdjustment'] = $inboundCheckAdjustment; - $self['inboundCheckDepositReturnIntention'] = $inboundCheckDepositReturnIntention; - $self['inboundFednowTransferConfirmation'] = $inboundFednowTransferConfirmation; - $self['inboundRealTimePaymentsTransferConfirmation'] = $inboundRealTimePaymentsTransferConfirmation; - $self['inboundWireReversal'] = $inboundWireReversal; - $self['inboundWireTransfer'] = $inboundWireTransfer; - $self['inboundWireTransferReversal'] = $inboundWireTransferReversal; - $self['interestPayment'] = $interestPayment; - $self['internalSource'] = $internalSource; - $self['other'] = $other; - $self['realTimePaymentsTransferAcknowledgement'] = $realTimePaymentsTransferAcknowledgement; - $self['sampleFunds'] = $sampleFunds; - $self['swiftTransferIntention'] = $swiftTransferIntention; - $self['swiftTransferReturn'] = $swiftTransferReturn; - $self['wireTransferIntention'] = $wireTransferIntention; + + null !== $accountRevenuePayment && $self['accountRevenuePayment'] = $accountRevenuePayment; + null !== $accountTransferIntention && $self['accountTransferIntention'] = $accountTransferIntention; + null !== $achTransferIntention && $self['achTransferIntention'] = $achTransferIntention; + null !== $achTransferRejection && $self['achTransferRejection'] = $achTransferRejection; + null !== $achTransferReturn && $self['achTransferReturn'] = $achTransferReturn; + null !== $blockchainOfframpTransferSettlement && $self['blockchainOfframpTransferSettlement'] = $blockchainOfframpTransferSettlement; + null !== $blockchainOnrampTransferIntention && $self['blockchainOnrampTransferIntention'] = $blockchainOnrampTransferIntention; + null !== $cardDisputeAcceptance && $self['cardDisputeAcceptance'] = $cardDisputeAcceptance; + null !== $cardDisputeFinancial && $self['cardDisputeFinancial'] = $cardDisputeFinancial; + null !== $cardDisputeLoss && $self['cardDisputeLoss'] = $cardDisputeLoss; + null !== $cardFinancial && $self['cardFinancial'] = $cardFinancial; + null !== $cardPushTransferAcceptance && $self['cardPushTransferAcceptance'] = $cardPushTransferAcceptance; + null !== $cardRefund && $self['cardRefund'] = $cardRefund; + null !== $cardRevenuePayment && $self['cardRevenuePayment'] = $cardRevenuePayment; + null !== $cardSettlement && $self['cardSettlement'] = $cardSettlement; + null !== $cashbackPayment && $self['cashbackPayment'] = $cashbackPayment; + null !== $checkDepositAcceptance && $self['checkDepositAcceptance'] = $checkDepositAcceptance; + null !== $checkDepositReturn && $self['checkDepositReturn'] = $checkDepositReturn; + null !== $checkTransferDeposit && $self['checkTransferDeposit'] = $checkTransferDeposit; + null !== $fednowTransferAcknowledgement && $self['fednowTransferAcknowledgement'] = $fednowTransferAcknowledgement; + null !== $feePayment && $self['feePayment'] = $feePayment; + null !== $inboundACHTransfer && $self['inboundACHTransfer'] = $inboundACHTransfer; + null !== $inboundACHTransferReturnIntention && $self['inboundACHTransferReturnIntention'] = $inboundACHTransferReturnIntention; + null !== $inboundCheckAdjustment && $self['inboundCheckAdjustment'] = $inboundCheckAdjustment; + null !== $inboundCheckDepositReturnIntention && $self['inboundCheckDepositReturnIntention'] = $inboundCheckDepositReturnIntention; + null !== $inboundFednowTransferConfirmation && $self['inboundFednowTransferConfirmation'] = $inboundFednowTransferConfirmation; + null !== $inboundRealTimePaymentsTransferConfirmation && $self['inboundRealTimePaymentsTransferConfirmation'] = $inboundRealTimePaymentsTransferConfirmation; + null !== $inboundWireReversal && $self['inboundWireReversal'] = $inboundWireReversal; + null !== $inboundWireTransfer && $self['inboundWireTransfer'] = $inboundWireTransfer; + null !== $inboundWireTransferReversal && $self['inboundWireTransferReversal'] = $inboundWireTransferReversal; + null !== $interestPayment && $self['interestPayment'] = $interestPayment; + null !== $internalSource && $self['internalSource'] = $internalSource; + null !== $other && $self['other'] = $other; + null !== $realTimePaymentsTransferAcknowledgement && $self['realTimePaymentsTransferAcknowledgement'] = $realTimePaymentsTransferAcknowledgement; + null !== $sampleFunds && $self['sampleFunds'] = $sampleFunds; + null !== $swiftTransferIntention && $self['swiftTransferIntention'] = $swiftTransferIntention; + null !== $swiftTransferReturn && $self['swiftTransferReturn'] = $swiftTransferReturn; + null !== $wireTransferIntention && $self['wireTransferIntention'] = $wireTransferIntention; + + return $self; + } + + /** + * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. + * + * @param Category|value-of $category + */ + public function withCategory(Category|string $category): self + { + $self = clone $this; + $self['category'] = $category; return $self; } @@ -824,19 +763,6 @@ public function withCashbackPayment( return $self; } - /** - * The type of the resource. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. - * - * @param Category|value-of $category - */ - public function withCategory(Category|string $category): self - { - $self = clone $this; - $self['category'] = $category; - - return $self; - } - /** * A Check Deposit Acceptance object. This field will be present in the JSON response if and only if `category` is equal to `check_deposit_acceptance`. A Check Deposit Acceptance is created when a Check Deposit is processed and its details confirmed. Check Deposits may be returned by the receiving bank, which will appear as a Check Deposit Return. * diff --git a/src/Version.php b/src/Version.php index 1dfc3e2..ab708bb 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace Increase; // x-release-please-start-version -const VERSION = '0.28.0'; +const VERSION = '0.29.0'; // x-release-please-end diff --git a/src/WireTransfers/WireTransfer/CreatedBy.php b/src/WireTransfers/WireTransfer/CreatedBy.php index 580ef17..0712bc0 100644 --- a/src/WireTransfers/WireTransfer/CreatedBy.php +++ b/src/WireTransfers/WireTransfer/CreatedBy.php @@ -4,6 +4,7 @@ namespace Increase\WireTransfers\WireTransfer; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -20,10 +21,10 @@ * @phpstan-import-type UserShape from \Increase\WireTransfers\WireTransfer\CreatedBy\User * * @phpstan-type CreatedByShape = array{ - * apiKey: null|APIKey|APIKeyShape, * category: Category|value-of, - * oauthApplication: null|OAuthApplication|OAuthApplicationShape, - * user: null|User|UserShape, + * apiKey?: null|APIKey|APIKeyShape, + * oauthApplication?: null|OAuthApplication|OAuthApplicationShape, + * user?: null|User|UserShape, * } */ final class CreatedBy implements BaseModel @@ -31,12 +32,6 @@ final class CreatedBy implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * If present, details about the API key that created the transfer. - */ - #[Required('api_key')] - public ?APIKey $apiKey; - /** * The type of object that created this transfer. * @@ -45,16 +40,22 @@ final class CreatedBy implements BaseModel #[Required(enum: Category::class)] public string $category; + /** + * If present, details about the API key that created the transfer. + */ + #[Optional('api_key', nullable: true)] + public ?APIKey $apiKey; + /** * If present, details about the OAuth Application that created the transfer. */ - #[Required('oauth_application')] + #[Optional('oauth_application', nullable: true)] public ?OAuthApplication $oauthApplication; /** * If present, details about the User that created the transfer. */ - #[Required] + #[Optional(nullable: true)] public ?User $user; /** @@ -62,17 +63,13 @@ final class CreatedBy implements BaseModel * * To enforce required parameters use * ``` - * CreatedBy::with(apiKey: ..., category: ..., oauthApplication: ..., user: ...) + * CreatedBy::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new CreatedBy) - * ->withAPIKey(...) - * ->withCategory(...) - * ->withOAuthApplication(...) - * ->withUser(...) + * (new CreatedBy)->withCategory(...) * ``` */ public function __construct() @@ -85,49 +82,50 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param APIKey|APIKeyShape|null $apiKey * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey * @param OAuthApplication|OAuthApplicationShape|null $oauthApplication * @param User|UserShape|null $user */ public static function with( - APIKey|array|null $apiKey, Category|string $category, - OAuthApplication|array|null $oauthApplication, - User|array|null $user, + APIKey|array|null $apiKey = null, + OAuthApplication|array|null $oauthApplication = null, + User|array|null $user = null, ): self { $self = new self; - $self['apiKey'] = $apiKey; $self['category'] = $category; - $self['oauthApplication'] = $oauthApplication; - $self['user'] = $user; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $oauthApplication && $self['oauthApplication'] = $oauthApplication; + null !== $user && $self['user'] = $user; return $self; } /** - * If present, details about the API key that created the transfer. + * The type of object that created this transfer. * - * @param APIKey|APIKeyShape|null $apiKey + * @param Category|value-of $category */ - public function withAPIKey(APIKey|array|null $apiKey): self + public function withCategory(Category|string $category): self { $self = clone $this; - $self['apiKey'] = $apiKey; + $self['category'] = $category; return $self; } /** - * The type of object that created this transfer. + * If present, details about the API key that created the transfer. * - * @param Category|value-of $category + * @param APIKey|APIKeyShape|null $apiKey */ - public function withCategory(Category|string $category): self + public function withAPIKey(APIKey|array|null $apiKey): self { $self = clone $this; - $self['category'] = $category; + $self['apiKey'] = $apiKey; return $self; } diff --git a/src/WireTransfers/WireTransfer/Remittance.php b/src/WireTransfers/WireTransfer/Remittance.php index 146eeb3..e4bac6c 100644 --- a/src/WireTransfers/WireTransfer/Remittance.php +++ b/src/WireTransfers/WireTransfer/Remittance.php @@ -4,6 +4,7 @@ namespace Increase\WireTransfers\WireTransfer; +use Increase\Core\Attributes\Optional; use Increase\Core\Attributes\Required; use Increase\Core\Concerns\SdkModel; use Increase\Core\Contracts\BaseModel; @@ -19,8 +20,8 @@ * * @phpstan-type RemittanceShape = array{ * category: Category|value-of, - * tax: null|Tax|TaxShape, - * unstructured: null|Unstructured|UnstructuredShape, + * tax?: null|Tax|TaxShape, + * unstructured?: null|Unstructured|UnstructuredShape, * } */ final class Remittance implements BaseModel @@ -39,13 +40,13 @@ final class Remittance implements BaseModel /** * Internal Revenue Service (IRS) tax repayment information. Required if `category` is equal to `tax`. */ - #[Required] + #[Optional(nullable: true)] public ?Tax $tax; /** * Unstructured remittance information. Required if `category` is equal to `unstructured`. */ - #[Required] + #[Optional(nullable: true)] public ?Unstructured $unstructured; /** @@ -53,13 +54,13 @@ final class Remittance implements BaseModel * * To enforce required parameters use * ``` - * Remittance::with(category: ..., tax: ..., unstructured: ...) + * Remittance::with(category: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Remittance)->withCategory(...)->withTax(...)->withUnstructured(...) + * (new Remittance)->withCategory(...) * ``` */ public function __construct() @@ -78,14 +79,15 @@ public function __construct() */ public static function with( Category|string $category, - Tax|array|null $tax, - Unstructured|array|null $unstructured, + Tax|array|null $tax = null, + Unstructured|array|null $unstructured = null, ): self { $self = new self; $self['category'] = $category; - $self['tax'] = $tax; - $self['unstructured'] = $unstructured; + + null !== $tax && $self['tax'] = $tax; + null !== $unstructured && $self['unstructured'] = $unstructured; return $self; }