From 247da12a4bcb3d96b14683af87fed9f633e34325 Mon Sep 17 00:00:00 2001 From: rebilly-machine-user Date: Fri, 16 Feb 2024 12:23:06 +0000 Subject: [PATCH] update SDK from api-definitions --- .changeset/blue-bags-leave.md | 5 + .changeset/brown-ligers-fry.md | 5 + .changeset/chilly-rabbits-dream.md | 5 + .changeset/clean-buttons-hide.md | 5 + .changeset/cuddly-chefs-swim.md | 5 + .changeset/cuddly-mice-retire.md | 5 + .changeset/fair-crabs-sort.md | 5 + .changeset/fast-cars-remain.md | 5 + .changeset/fast-trains-lick.md | 5 + .changeset/fifty-dolphins-travel.md | 5 + .changeset/flat-forks-count.md | 5 + .changeset/flat-tools-sin.md | 5 + .changeset/fluffy-pans-invent.md | 5 + .changeset/forty-houses-lick.md | 5 + .changeset/friendly-snails-stare.md | 5 + .changeset/fuzzy-houses-confess.md | 5 + .changeset/good-llamas-burn.md | 5 + .changeset/great-wasps-type.md | 5 + .changeset/heavy-lemons-punch.md | 5 + .changeset/heavy-mayflies-explain.md | 5 + .changeset/khaki-clocks-relate.md | 5 + .changeset/large-eggs-scream.md | 5 + .changeset/late-spoons-begin.md | 5 + .changeset/lemon-gorillas-check.md | 5 + .changeset/little-beers-brake.md | 5 + .changeset/long-emus-applaud.md | 5 + .changeset/metal-shrimps-fry.md | 5 + .changeset/moody-rockets-own.md | 5 + .changeset/nervous-ducks-matter.md | 5 + .changeset/nice-masks-remember.md | 5 + .changeset/olive-kings-live.md | 5 + .changeset/pink-flies-draw.md | 5 + .changeset/pink-spoons-greet.md | 5 + .changeset/poor-shoes-marry.md | 5 + .changeset/pretty-bears-doubt.md | 5 + .changeset/pretty-candles-rush.md | 5 + .changeset/purple-dragons-clap.md | 5 + .changeset/quiet-bulldogs-visit.md | 5 + .changeset/rich-gorillas-sneeze.md | 5 + .changeset/rotten-masks-sniff.md | 5 + .changeset/rude-planets-return.md | 5 + .changeset/shy-melons-crash.md | 5 + .changeset/smooth-nails-hope.md | 5 + .changeset/spotty-oranges-grab.md | 5 + .changeset/stale-chairs-juggle.md | 5 + .changeset/strange-hotels-exercise.md | 5 + .changeset/stupid-moons-admire.md | 5 + .changeset/swift-hairs-look.md | 5 + .changeset/swift-parrots-swim.md | 5 + .changeset/swift-shirts-marry.md | 5 + .changeset/tall-rats-invent.md | 5 + .changeset/tame-gorillas-arrive.md | 5 + .changeset/tame-walls-relax.md | 5 + .changeset/tender-dolphins-leave.md | 5 + .changeset/tender-plants-reply.md | 5 + .changeset/thick-weeks-rescue.md | 5 + .changeset/thirty-cherries-build.md | 5 + .changeset/tidy-ghosts-impress.md | 5 + .changeset/twenty-cows-build.md | 5 + .changeset/twenty-tables-sip.md | 5 + .changeset/violet-grapes-nail.md | 5 + .changeset/violet-suns-smash.md | 5 + .changeset/wicked-jeans-impress.md | 5 + src/Api/DisputesApi.php | 9 +- src/Api/QuotesApi.php | 21 +- src/Api/RichBillingPortalsApi.php | 134 ++ src/Api/SubscriptionsApi.php | 70 +- src/CombinedService.php | 8 + src/Model/AdjustReadyToPayGeneric.php | 4 + src/Model/AdjustReadyToPayoutGeneric.php | 55 + .../AdjustReadyToPayoutPaymentMethod.php | 19 + ...djustReadyToPayoutPaymentMethodFactory.php | 171 +++ src/Model/AlternativeInstrument.php | 4 + src/Model/AlternativePaymentToken.php | 4 + src/Model/AmlCompoundConfidence.php | 103 ++ ... => AmlCompoundConfidenceAddressMatch.php} | 2 +- ... AmlCompoundConfidenceAddressMismatch.php} | 2 +- ...php => AmlCompoundConfidenceNoAddress.php} | 2 +- src/Model/AmlSettingsConfidence.php | 190 +-- src/Model/AmlSettingsConfidenceDob.php | 81 ++ .../AmlSettingsConfidenceDobInexactMatch.php | 91 -- src/Model/AmlSettingsConfidenceInexactYob.php | 81 ++ ...SettingsConfidenceInexactYobExactMatch.php | 91 -- ...ttingsConfidenceInexactYobInexactMatch.php | 91 -- src/Model/AmlSettingsConfidenceNoDob.php | 103 ++ .../AmlSettingsConfidenceNoDobExactMatch.php | 91 -- ...AmlSettingsConfidenceNoDobInexactMatch.php | 91 -- .../AmlSettingsConfidenceNoDobWeakMatch.php | 91 -- src/Model/AmlSettingsConfidenceYob.php | 81 ++ src/Model/Awepay.php | 22 + src/Model/AwepayCredentials.php | 18 + src/Model/AwepaySettings.php | 55 + src/Model/DepositRequest.php | 44 + src/Model/DepositRequestEmbedded.php | 16 +- src/Model/DepositStrategy.php | 8 +- src/Model/Dispute.php | 372 +----- src/Model/GatewayAccount.php | 18 + src/Model/Invoice.php | 42 + src/Model/KlarnaSettings.php | 18 + src/Model/KycRequestDocument.php | 18 + .../{OneTimeOrder.php => OneTimeSale.php} | 76 +- ...erEmbedded.php => OneTimeSaleEmbedded.php} | 2 +- src/Model/OrderItem.php | 26 +- src/Model/OrderItemUsageLimits.php | 16 +- src/Model/PaymentInstrumentCreateToken.php | 4 + src/Model/PostDepositRequest.php | 26 +- src/Model/PostDepositRequestCustomAmount.php | 103 ++ src/Model/PostDisputeRequest.php | 597 +++++++++ src/Model/Quote.php | 552 +------- src/Model/QuoteChangeOrder.php | 747 +++++++++++ src/Model/QuoteCreateOrder.php | 747 +++++++++++ .../QuoteCreateOrderAcceptanceFulfillment.php | 79 ++ ...edded.php => QuoteCreateOrderEmbedded.php} | 20 +- ...php => QuoteCreateOrderInvoicePreview.php} | 24 +- ...eateOrderInvoicePreviewInitialAmounts.php} | 2 +- ...> QuoteCreateOrderInvoicePreviewItems.php} | 2 +- ...teOrderInvoicePreviewRecurringAmounts.php} | 2 +- ...oteItems.php => QuoteCreateOrderItems.php} | 32 +- ....php => QuoteCreateOrderItemsEmbedded.php} | 2 +- .../QuoteCreateOrderItemsUsageLimits.php | 81 ++ ...eCreateOrderItemsUsageLimitsHardLimit.php} | 2 +- ...eCreateOrderItemsUsageLimitsSoftLimit.php} | 2 +- ...ture.php => QuoteCreateOrderSignature.php} | 2 +- src/Model/QuoteFactory.php | 29 + src/Model/QuoteReactivateOrder.php | 747 +++++++++++ src/Model/ReportDeclinedTransactions.php | 18 - src/Model/RichBillingPortal.php | 246 ++++ src/Model/RichBillingPortalAddons.php | 81 ++ src/Model/RichBillingPortalPlans.php | 81 ++ src/Model/RichBillingPortalPlansPlan.php | 466 +++++++ src/Model/RiskMetadata.php | 16 +- src/Model/RuleAction.php | 2 + src/Model/RuleActionAdjustReadyToPayout.php | 86 ++ src/Model/Search.php | 6 +- src/Model/Subscription.php | 1105 ++++++++++++++++- ...rEmbedded.php => SubscriptionEmbedded.php} | 2 +- src/Model/SubscriptionItemUpdate.php | 55 + ...l.php => SubscriptionLineItemSubtotal.php} | 2 +- ...ineItems.php => SubscriptionLineItems.php} | 2 +- src/Model/SubscriptionOrOneTimeSale.php | 114 ++ ...p => SubscriptionOrOneTimeSaleFactory.php} | 8 +- src/Model/SubscriptionOrder.php | 1101 ---------------- ...SubscriptionOrderPlanRecurringInterval.php | 10 +- src/Model/SubscriptionOrderPlanTrial.php | 81 ++ ....php => SubscriptionRecurringInterval.php} | 2 +- ...onOrderTrial.php => SubscriptionTrial.php} | 2 +- src/Model/TagUntagRule.php | 4 + src/Model/Transaction.php | 36 + src/Model/TruevoCredentials.php | 18 + src/Model/WorldpaySettings.php | 22 +- src/UsersService.php | 8 + 151 files changed, 7290 insertions(+), 2842 deletions(-) create mode 100644 .changeset/blue-bags-leave.md create mode 100644 .changeset/brown-ligers-fry.md create mode 100644 .changeset/chilly-rabbits-dream.md create mode 100644 .changeset/clean-buttons-hide.md create mode 100644 .changeset/cuddly-chefs-swim.md create mode 100644 .changeset/cuddly-mice-retire.md create mode 100644 .changeset/fair-crabs-sort.md create mode 100644 .changeset/fast-cars-remain.md create mode 100644 .changeset/fast-trains-lick.md create mode 100644 .changeset/fifty-dolphins-travel.md create mode 100644 .changeset/flat-forks-count.md create mode 100644 .changeset/flat-tools-sin.md create mode 100644 .changeset/fluffy-pans-invent.md create mode 100644 .changeset/forty-houses-lick.md create mode 100644 .changeset/friendly-snails-stare.md create mode 100644 .changeset/fuzzy-houses-confess.md create mode 100644 .changeset/good-llamas-burn.md create mode 100644 .changeset/great-wasps-type.md create mode 100644 .changeset/heavy-lemons-punch.md create mode 100644 .changeset/heavy-mayflies-explain.md create mode 100644 .changeset/khaki-clocks-relate.md create mode 100644 .changeset/large-eggs-scream.md create mode 100644 .changeset/late-spoons-begin.md create mode 100644 .changeset/lemon-gorillas-check.md create mode 100644 .changeset/little-beers-brake.md create mode 100644 .changeset/long-emus-applaud.md create mode 100644 .changeset/metal-shrimps-fry.md create mode 100644 .changeset/moody-rockets-own.md create mode 100644 .changeset/nervous-ducks-matter.md create mode 100644 .changeset/nice-masks-remember.md create mode 100644 .changeset/olive-kings-live.md create mode 100644 .changeset/pink-flies-draw.md create mode 100644 .changeset/pink-spoons-greet.md create mode 100644 .changeset/poor-shoes-marry.md create mode 100644 .changeset/pretty-bears-doubt.md create mode 100644 .changeset/pretty-candles-rush.md create mode 100644 .changeset/purple-dragons-clap.md create mode 100644 .changeset/quiet-bulldogs-visit.md create mode 100644 .changeset/rich-gorillas-sneeze.md create mode 100644 .changeset/rotten-masks-sniff.md create mode 100644 .changeset/rude-planets-return.md create mode 100644 .changeset/shy-melons-crash.md create mode 100644 .changeset/smooth-nails-hope.md create mode 100644 .changeset/spotty-oranges-grab.md create mode 100644 .changeset/stale-chairs-juggle.md create mode 100644 .changeset/strange-hotels-exercise.md create mode 100644 .changeset/stupid-moons-admire.md create mode 100644 .changeset/swift-hairs-look.md create mode 100644 .changeset/swift-parrots-swim.md create mode 100644 .changeset/swift-shirts-marry.md create mode 100644 .changeset/tall-rats-invent.md create mode 100644 .changeset/tame-gorillas-arrive.md create mode 100644 .changeset/tame-walls-relax.md create mode 100644 .changeset/tender-dolphins-leave.md create mode 100644 .changeset/tender-plants-reply.md create mode 100644 .changeset/thick-weeks-rescue.md create mode 100644 .changeset/thirty-cherries-build.md create mode 100644 .changeset/tidy-ghosts-impress.md create mode 100644 .changeset/twenty-cows-build.md create mode 100644 .changeset/twenty-tables-sip.md create mode 100644 .changeset/violet-grapes-nail.md create mode 100644 .changeset/violet-suns-smash.md create mode 100644 .changeset/wicked-jeans-impress.md create mode 100644 src/Api/RichBillingPortalsApi.php create mode 100644 src/Model/AdjustReadyToPayoutGeneric.php create mode 100644 src/Model/AdjustReadyToPayoutPaymentMethod.php create mode 100644 src/Model/AdjustReadyToPayoutPaymentMethodFactory.php create mode 100644 src/Model/AmlCompoundConfidence.php rename src/Model/{AmlSettingsConfidenceDobExactMatch.php => AmlCompoundConfidenceAddressMatch.php} (97%) rename src/Model/{AmlSettingsConfidenceYobInexactMatch.php => AmlCompoundConfidenceAddressMismatch.php} (97%) rename src/Model/{AmlSettingsConfidenceYobExactMatch.php => AmlCompoundConfidenceNoAddress.php} (97%) create mode 100644 src/Model/AmlSettingsConfidenceDob.php delete mode 100644 src/Model/AmlSettingsConfidenceDobInexactMatch.php create mode 100644 src/Model/AmlSettingsConfidenceInexactYob.php delete mode 100644 src/Model/AmlSettingsConfidenceInexactYobExactMatch.php delete mode 100644 src/Model/AmlSettingsConfidenceInexactYobInexactMatch.php create mode 100644 src/Model/AmlSettingsConfidenceNoDob.php delete mode 100644 src/Model/AmlSettingsConfidenceNoDobExactMatch.php delete mode 100644 src/Model/AmlSettingsConfidenceNoDobInexactMatch.php delete mode 100644 src/Model/AmlSettingsConfidenceNoDobWeakMatch.php create mode 100644 src/Model/AmlSettingsConfidenceYob.php create mode 100644 src/Model/AwepaySettings.php rename src/Model/{OneTimeOrder.php => OneTimeSale.php} (92%) rename src/Model/{OneTimeOrderEmbedded.php => OneTimeSaleEmbedded.php} (98%) create mode 100644 src/Model/PostDepositRequestCustomAmount.php create mode 100644 src/Model/PostDisputeRequest.php create mode 100644 src/Model/QuoteChangeOrder.php create mode 100644 src/Model/QuoteCreateOrder.php create mode 100644 src/Model/QuoteCreateOrderAcceptanceFulfillment.php rename src/Model/{QuoteEmbedded.php => QuoteCreateOrderEmbedded.php} (78%) rename src/Model/{QuoteInvoicePreview.php => QuoteCreateOrderInvoicePreview.php} (71%) rename src/Model/{QuoteInvoicePreviewInitialAmounts.php => QuoteCreateOrderInvoicePreviewInitialAmounts.php} (97%) rename src/Model/{QuoteInvoicePreviewItems.php => QuoteCreateOrderInvoicePreviewItems.php} (99%) rename src/Model/{QuoteInvoicePreviewRecurringAmounts.php => QuoteCreateOrderInvoicePreviewRecurringAmounts.php} (97%) rename src/Model/{QuoteItems.php => QuoteCreateOrderItems.php} (81%) rename src/Model/{QuoteItemsEmbedded.php => QuoteCreateOrderItemsEmbedded.php} (94%) create mode 100644 src/Model/QuoteCreateOrderItemsUsageLimits.php rename src/Model/{OrderItemUsageLimitsSoftLimit.php => QuoteCreateOrderItemsUsageLimitsHardLimit.php} (95%) rename src/Model/{OrderItemUsageLimitsHardLimit.php => QuoteCreateOrderItemsUsageLimitsSoftLimit.php} (95%) rename src/Model/{QuoteSignature.php => QuoteCreateOrderSignature.php} (96%) create mode 100644 src/Model/QuoteFactory.php create mode 100644 src/Model/QuoteReactivateOrder.php create mode 100644 src/Model/RichBillingPortal.php create mode 100644 src/Model/RichBillingPortalAddons.php create mode 100644 src/Model/RichBillingPortalPlans.php create mode 100644 src/Model/RichBillingPortalPlansPlan.php create mode 100644 src/Model/RuleActionAdjustReadyToPayout.php rename src/Model/{SubscriptionOrderEmbedded.php => SubscriptionEmbedded.php} (98%) create mode 100644 src/Model/SubscriptionItemUpdate.php rename src/Model/{SubscriptionOrderLineItemSubtotal.php => SubscriptionLineItemSubtotal.php} (95%) rename src/Model/{SubscriptionOrderLineItems.php => SubscriptionLineItems.php} (99%) create mode 100644 src/Model/SubscriptionOrOneTimeSale.php rename src/Model/{SubscriptionFactory.php => SubscriptionOrOneTimeSaleFactory.php} (64%) delete mode 100644 src/Model/SubscriptionOrder.php create mode 100644 src/Model/SubscriptionOrderPlanTrial.php rename src/Model/{SubscriptionOrderRecurringInterval.php => SubscriptionRecurringInterval.php} (95%) rename src/Model/{SubscriptionOrderTrial.php => SubscriptionTrial.php} (96%) diff --git a/.changeset/blue-bags-leave.md b/.changeset/blue-bags-leave.md new file mode 100644 index 000000000..4cb47f20e --- /dev/null +++ b/.changeset/blue-bags-leave.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add depositRequestId to Transaction response Rebilly/api-definitions#1762 diff --git a/.changeset/brown-ligers-fry.md b/.changeset/brown-ligers-fry.md new file mode 100644 index 000000000..553e69f58 --- /dev/null +++ b/.changeset/brown-ligers-fry.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add round amount after DCC to gateway account setting Rebilly/api-definitions#1714 diff --git a/.changeset/chilly-rabbits-dream.md b/.changeset/chilly-rabbits-dream.md new file mode 100644 index 000000000..cb6a72dd0 --- /dev/null +++ b/.changeset/chilly-rabbits-dream.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Readme updated Rebilly/api-definitions#1793 diff --git a/.changeset/clean-buttons-hide.md b/.changeset/clean-buttons-hide.md new file mode 100644 index 000000000..0fd1e2428 --- /dev/null +++ b/.changeset/clean-buttons-hide.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Bump @redocly/portal from 0.65.7 to 0.67.1 Rebilly/api-definitions#1723 diff --git a/.changeset/cuddly-chefs-swim.md b/.changeset/cuddly-chefs-swim.md new file mode 100644 index 000000000..0ad0d2b3c --- /dev/null +++ b/.changeset/cuddly-chefs-swim.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Use FQCN in PHP SDK 3.x code samples Rebilly/api-definitions#1725 diff --git a/.changeset/cuddly-mice-retire.md b/.changeset/cuddly-mice-retire.md new file mode 100644 index 000000000..4b3284be9 --- /dev/null +++ b/.changeset/cuddly-mice-retire.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add quote for change items/reactivate order Rebilly/api-definitions#1784 diff --git a/.changeset/fair-crabs-sort.md b/.changeset/fair-crabs-sort.md new file mode 100644 index 000000000..6dd9800fa --- /dev/null +++ b/.changeset/fair-crabs-sort.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Rename risk metadata vpnServiceName to hostingName Rebilly/api-definitions#1724 diff --git a/.changeset/fast-cars-remain.md b/.changeset/fast-cars-remain.md new file mode 100644 index 000000000..5676b1b3e --- /dev/null +++ b/.changeset/fast-cars-remain.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add Storefront update usage limits Rebilly/api-definitions#1775 diff --git a/.changeset/fast-trains-lick.md b/.changeset/fast-trains-lick.md new file mode 100644 index 000000000..aec0401b1 --- /dev/null +++ b/.changeset/fast-trains-lick.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Remove build command Rebilly/api-definitions#1792 diff --git a/.changeset/fifty-dolphins-travel.md b/.changeset/fifty-dolphins-travel.md new file mode 100644 index 000000000..4a98237ac --- /dev/null +++ b/.changeset/fifty-dolphins-travel.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add Invoice delinquencyTime Rebilly/api-definitions#1746 diff --git a/.changeset/flat-forks-count.md b/.changeset/flat-forks-count.md new file mode 100644 index 000000000..5edf0f5ae --- /dev/null +++ b/.changeset/flat-forks-count.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Rename Storefront tags Rebilly/api-definitions#1738 diff --git a/.changeset/flat-tools-sin.md b/.changeset/flat-tools-sin.md new file mode 100644 index 000000000..7bb8028d2 --- /dev/null +++ b/.changeset/flat-tools-sin.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add missing security for Storefront operations Rebilly/api-definitions#1740 diff --git a/.changeset/fluffy-pans-invent.md b/.changeset/fluffy-pans-invent.md new file mode 100644 index 000000000..a5ffc8a33 --- /dev/null +++ b/.changeset/fluffy-pans-invent.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Rename Storefront POST Order to Subscriptions Rebilly/api-definitions#1777 diff --git a/.changeset/forty-houses-lick.md b/.changeset/forty-houses-lick.md new file mode 100644 index 000000000..9ec4a9f05 --- /dev/null +++ b/.changeset/forty-houses-lick.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +add faceLivenessRequired Rebilly/api-definitions#1774 diff --git a/.changeset/friendly-snails-stare.md b/.changeset/friendly-snails-stare.md new file mode 100644 index 000000000..14181cbf0 --- /dev/null +++ b/.changeset/friendly-snails-stare.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add quantityFilled and its update Rebilly/api-definitions#1754 diff --git a/.changeset/fuzzy-houses-confess.md b/.changeset/fuzzy-houses-confess.md new file mode 100644 index 000000000..6aac7d33f --- /dev/null +++ b/.changeset/fuzzy-houses-confess.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add Klarna payNowStandalone to settings Rebilly/api-definitions#1718 diff --git a/.changeset/good-llamas-burn.md b/.changeset/good-llamas-burn.md new file mode 100644 index 000000000..12e7c8841 --- /dev/null +++ b/.changeset/good-llamas-burn.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Update description for authorize-and-void setup instruction Rebilly/api-definitions#1790 diff --git a/.changeset/great-wasps-type.md b/.changeset/great-wasps-type.md new file mode 100644 index 000000000..ffb43bc22 --- /dev/null +++ b/.changeset/great-wasps-type.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Fix dispute schema Rebilly/api-definitions#1716 diff --git a/.changeset/heavy-lemons-punch.md b/.changeset/heavy-lemons-punch.md new file mode 100644 index 000000000..2b3c4c91a --- /dev/null +++ b/.changeset/heavy-lemons-punch.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add payoutRequestId to Transaction Rebilly/api-definitions#1768 diff --git a/.changeset/heavy-mayflies-explain.md b/.changeset/heavy-mayflies-explain.md new file mode 100644 index 000000000..8bea8c53c --- /dev/null +++ b/.changeset/heavy-mayflies-explain.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Bump @redocly/cli from 1.8.0 to 1.8.1 Rebilly/api-definitions#1758 diff --git a/.changeset/khaki-clocks-relate.md b/.changeset/khaki-clocks-relate.md new file mode 100644 index 000000000..6e60e2165 --- /dev/null +++ b/.changeset/khaki-clocks-relate.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Bump @redocly/cli from 1.7.0 to 1.8.0 Rebilly/api-definitions#1756 diff --git a/.changeset/large-eggs-scream.md b/.changeset/large-eggs-scream.md new file mode 100644 index 000000000..a70be615b --- /dev/null +++ b/.changeset/large-eggs-scream.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add deposit-request transactionIds Rebilly/api-definitions#1772 diff --git a/.changeset/late-spoons-begin.md b/.changeset/late-spoons-begin.md new file mode 100644 index 000000000..28934388b --- /dev/null +++ b/.changeset/late-spoons-begin.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Remove Subscription from upcoming invoice Rebilly/api-definitions#1781 diff --git a/.changeset/lemon-gorillas-check.md b/.changeset/lemon-gorillas-check.md new file mode 100644 index 000000000..1222f11a2 --- /dev/null +++ b/.changeset/lemon-gorillas-check.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add expand parameter to Storefront invoices Rebilly/api-definitions#1770 diff --git a/.changeset/little-beers-brake.md b/.changeset/little-beers-brake.md new file mode 100644 index 000000000..accb0367b --- /dev/null +++ b/.changeset/little-beers-brake.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Fis Storefront get order expand Rebilly/api-definitions#1785 diff --git a/.changeset/long-emus-applaud.md b/.changeset/long-emus-applaud.md new file mode 100644 index 000000000..47a5ae806 --- /dev/null +++ b/.changeset/long-emus-applaud.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add PO box to StorefrontPurchase Rebilly/api-definitions#1743 diff --git a/.changeset/metal-shrimps-fry.md b/.changeset/metal-shrimps-fry.md new file mode 100644 index 000000000..e8a520501 --- /dev/null +++ b/.changeset/metal-shrimps-fry.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Remove Worldpay enableStoredCredentials in favour of enforceStoredCredentails Rebilly/api-definitions#1747 diff --git a/.changeset/moody-rockets-own.md b/.changeset/moody-rockets-own.md new file mode 100644 index 000000000..e663f043a --- /dev/null +++ b/.changeset/moody-rockets-own.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Update README links Rebilly/api-definitions#1739 diff --git a/.changeset/nervous-ducks-matter.md b/.changeset/nervous-ducks-matter.md new file mode 100644 index 000000000..4e3ef490d --- /dev/null +++ b/.changeset/nervous-ducks-matter.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Update sample Rebilly/api-definitions#1780 diff --git a/.changeset/nice-masks-remember.md b/.changeset/nice-masks-remember.md new file mode 100644 index 000000000..2dbd22574 --- /dev/null +++ b/.changeset/nice-masks-remember.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Fix Plan periodAnchorInstruction Rebilly/api-definitions#1759 diff --git a/.changeset/olive-kings-live.md b/.changeset/olive-kings-live.md new file mode 100644 index 000000000..320e94613 --- /dev/null +++ b/.changeset/olive-kings-live.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +fix(dependancy): Override typesense axios version Rebilly/api-definitions#1737 diff --git a/.changeset/pink-flies-draw.md b/.changeset/pink-flies-draw.md new file mode 100644 index 000000000..592807a1d --- /dev/null +++ b/.changeset/pink-flies-draw.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add and to StorefrontTransaction Rebilly/api-definitions#1745 diff --git a/.changeset/pink-spoons-greet.md b/.changeset/pink-spoons-greet.md new file mode 100644 index 000000000..5a468b53e --- /dev/null +++ b/.changeset/pink-spoons-greet.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add delinquencyPeriod property to Subscription resource Rebilly/api-definitions#1722 diff --git a/.changeset/poor-shoes-marry.md b/.changeset/poor-shoes-marry.md new file mode 100644 index 000000000..ace138ed7 --- /dev/null +++ b/.changeset/poor-shoes-marry.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Fix broken links Rebilly/api-definitions#1787 diff --git a/.changeset/pretty-bears-doubt.md b/.changeset/pretty-bears-doubt.md new file mode 100644 index 000000000..e88bf0df3 --- /dev/null +++ b/.changeset/pretty-bears-doubt.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add subscription-items-changed event Rebilly/api-definitions#1794 diff --git a/.changeset/pretty-candles-rush.md b/.changeset/pretty-candles-rush.md new file mode 100644 index 000000000..565000280 --- /dev/null +++ b/.changeset/pretty-candles-rush.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add setting and credentials to Awepay Rebilly/api-definitions#1719 diff --git a/.changeset/purple-dragons-clap.md b/.changeset/purple-dragons-clap.md new file mode 100644 index 000000000..f75c59930 --- /dev/null +++ b/.changeset/purple-dragons-clap.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Allow resetTime to be null Rebilly/api-definitions#1696 diff --git a/.changeset/quiet-bulldogs-visit.md b/.changeset/quiet-bulldogs-visit.md new file mode 100644 index 000000000..3c5516050 --- /dev/null +++ b/.changeset/quiet-bulldogs-visit.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Update score description Rebilly/api-definitions#1749 diff --git a/.changeset/rich-gorillas-sneeze.md b/.changeset/rich-gorillas-sneeze.md new file mode 100644 index 000000000..ce5e1cf38 --- /dev/null +++ b/.changeset/rich-gorillas-sneeze.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Bump @redocly/cli from 1.8.1 to 1.8.2 Rebilly/api-definitions#1773 diff --git a/.changeset/rotten-masks-sniff.md b/.changeset/rotten-masks-sniff.md new file mode 100644 index 000000000..67a4355fc --- /dev/null +++ b/.changeset/rotten-masks-sniff.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add Storefront Order expand Rebilly/api-definitions#1782 diff --git a/.changeset/rude-planets-return.md b/.changeset/rude-planets-return.md new file mode 100644 index 000000000..90ef9cf52 --- /dev/null +++ b/.changeset/rude-planets-return.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add rich billing portal Rebilly/api-definitions#1686 diff --git a/.changeset/shy-melons-crash.md b/.changeset/shy-melons-crash.md new file mode 100644 index 000000000..63d098aac --- /dev/null +++ b/.changeset/shy-melons-crash.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add Storefront change-items endpoint Rebilly/api-definitions#1769 diff --git a/.changeset/smooth-nails-hope.md b/.changeset/smooth-nails-hope.md new file mode 100644 index 000000000..c5d3d9306 --- /dev/null +++ b/.changeset/smooth-nails-hope.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add Ready To Payout operations Rebilly/api-definitions#1649 diff --git a/.changeset/spotty-oranges-grab.md b/.changeset/spotty-oranges-grab.md new file mode 100644 index 000000000..7dac07617 --- /dev/null +++ b/.changeset/spotty-oranges-grab.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Update references and readme Rebilly/api-definitions#1731 diff --git a/.changeset/stale-chairs-juggle.md b/.changeset/stale-chairs-juggle.md new file mode 100644 index 000000000..6eab5cafa --- /dev/null +++ b/.changeset/stale-chairs-juggle.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add enforceStoredCredentials setting for Worldpay Rebilly/api-definitions#1741 diff --git a/.changeset/strange-hotels-exercise.md b/.changeset/strange-hotels-exercise.md new file mode 100644 index 000000000..77e945e19 --- /dev/null +++ b/.changeset/strange-hotels-exercise.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Make \_links of plan schemas read only Rebilly/api-definitions#1744 diff --git a/.changeset/stupid-moons-admire.md b/.changeset/stupid-moons-admire.md new file mode 100644 index 000000000..7212ca274 --- /dev/null +++ b/.changeset/stupid-moons-admire.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +add new status to deposit request Rebilly/api-definitions#1765 diff --git a/.changeset/swift-hairs-look.md b/.changeset/swift-hairs-look.md new file mode 100644 index 000000000..c36b61c1f --- /dev/null +++ b/.changeset/swift-hairs-look.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add quote for change items/reactivate order Rebilly/api-definitions#1727 diff --git a/.changeset/swift-parrots-swim.md b/.changeset/swift-parrots-swim.md new file mode 100644 index 000000000..b609f8759 --- /dev/null +++ b/.changeset/swift-parrots-swim.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Bump @redocly/cli from 1.5.0 to 1.7.0 Rebilly/api-definitions#1750 diff --git a/.changeset/swift-shirts-marry.md b/.changeset/swift-shirts-marry.md new file mode 100644 index 000000000..f397dc85f --- /dev/null +++ b/.changeset/swift-shirts-marry.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add expand param to Storefront rich billing portals Rebilly/api-definitions#1779 diff --git a/.changeset/tall-rats-invent.md b/.changeset/tall-rats-invent.md new file mode 100644 index 000000000..bf2b0e814 --- /dev/null +++ b/.changeset/tall-rats-invent.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add specification for UpcomingInvoice Rebilly/api-definitions#1748 diff --git a/.changeset/tame-gorillas-arrive.md b/.changeset/tame-gorillas-arrive.md new file mode 100644 index 000000000..7dbace0d2 --- /dev/null +++ b/.changeset/tame-gorillas-arrive.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Rename subscription yaml files Rebilly/api-definitions#1735 diff --git a/.changeset/tame-walls-relax.md b/.changeset/tame-walls-relax.md new file mode 100644 index 000000000..737327844 --- /dev/null +++ b/.changeset/tame-walls-relax.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Fix UpcomingInvoice \_links Rebilly/api-definitions#1753 diff --git a/.changeset/tender-dolphins-leave.md b/.changeset/tender-dolphins-leave.md new file mode 100644 index 000000000..4c2fc541d --- /dev/null +++ b/.changeset/tender-dolphins-leave.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Upgrade to @redocly/realm.v0.76.1. Rebilly/api-definitions#1788 diff --git a/.changeset/tender-plants-reply.md b/.changeset/tender-plants-reply.md new file mode 100644 index 000000000..eefca9306 --- /dev/null +++ b/.changeset/tender-plants-reply.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add detail to face liveness description Rebilly/api-definitions#1776 diff --git a/.changeset/thick-weeks-rescue.md b/.changeset/thick-weeks-rescue.md new file mode 100644 index 000000000..b82c60361 --- /dev/null +++ b/.changeset/thick-weeks-rescue.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Remove invalid property from declined report Rebilly/api-definitions#1712 diff --git a/.changeset/thirty-cherries-build.md b/.changeset/thirty-cherries-build.md new file mode 100644 index 000000000..3895d5720 --- /dev/null +++ b/.changeset/thirty-cherries-build.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add gateway object to StorefrontTransaction Rebilly/api-definitions#1736 diff --git a/.changeset/tidy-ghosts-impress.md b/.changeset/tidy-ghosts-impress.md new file mode 100644 index 000000000..e9d143064 --- /dev/null +++ b/.changeset/tidy-ghosts-impress.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add address-based and refactor AML confidence settings Rebilly/api-definitions#1697 diff --git a/.changeset/twenty-cows-build.md b/.changeset/twenty-cows-build.md new file mode 100644 index 000000000..8662c9cdd --- /dev/null +++ b/.changeset/twenty-cows-build.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add sftpKeyPassphrase to Truevo Rebilly/api-definitions#1733 diff --git a/.changeset/twenty-tables-sip.md b/.changeset/twenty-tables-sip.md new file mode 100644 index 000000000..edf035aa7 --- /dev/null +++ b/.changeset/twenty-tables-sip.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add example for regex pattern properties Rebilly/api-definitions#1720 diff --git a/.changeset/violet-grapes-nail.md b/.changeset/violet-grapes-nail.md new file mode 100644 index 000000000..fedee24ed --- /dev/null +++ b/.changeset/violet-grapes-nail.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Update outdated subscription code examples Rebilly/api-definitions#1742 diff --git a/.changeset/violet-suns-smash.md b/.changeset/violet-suns-smash.md new file mode 100644 index 000000000..ee7c12ca3 --- /dev/null +++ b/.changeset/violet-suns-smash.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Update notificationUrl descriptions Rebilly/api-definitions#1764 diff --git a/.changeset/wicked-jeans-impress.md b/.changeset/wicked-jeans-impress.md new file mode 100644 index 000000000..39e893440 --- /dev/null +++ b/.changeset/wicked-jeans-impress.md @@ -0,0 +1,5 @@ +--- +"@rebilly/client-php": patch +--- + +Add acceptance conditions to quotes Rebilly/api-definitions#1760 diff --git a/src/Api/DisputesApi.php b/src/Api/DisputesApi.php index e159be2fa..031749ece 100644 --- a/src/Api/DisputesApi.php +++ b/src/Api/DisputesApi.php @@ -18,6 +18,7 @@ use GuzzleHttp\Utils; use Rebilly\Sdk\Collection; use Rebilly\Sdk\Model\Dispute; +use Rebilly\Sdk\Model\PostDisputeRequest; use Rebilly\Sdk\Paginator; class DisputesApi @@ -30,11 +31,11 @@ public function __construct(protected ?ClientInterface $client) * @return Dispute */ public function create( - Dispute $dispute, + PostDisputeRequest $postDisputeRequest, ): Dispute { $uri = '/disputes'; - $request = new Request('POST', $uri, body: Utils::jsonEncode($dispute)); + $request = new Request('POST', $uri, body: Utils::jsonEncode($postDisputeRequest)); $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); @@ -121,7 +122,7 @@ public function getAllPaginator( */ public function update( string $id, - Dispute $dispute, + PostDisputeRequest $postDisputeRequest, ): Dispute { $pathParams = [ '{id}' => $id, @@ -129,7 +130,7 @@ public function update( $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/disputes/{id}'); - $request = new Request('PUT', $uri, body: Utils::jsonEncode($dispute)); + $request = new Request('PUT', $uri, body: Utils::jsonEncode($postDisputeRequest)); $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); diff --git a/src/Api/QuotesApi.php b/src/Api/QuotesApi.php index ef00541fa..6157f8943 100644 --- a/src/Api/QuotesApi.php +++ b/src/Api/QuotesApi.php @@ -20,6 +20,7 @@ use Rebilly\Sdk\Collection; use Rebilly\Sdk\Model\PatchQuote; use Rebilly\Sdk\Model\Quote; +use Rebilly\Sdk\Model\QuoteFactory; use Rebilly\Sdk\Model\QuoteTimeline; use Rebilly\Sdk\Paginator; @@ -45,7 +46,7 @@ public function accept( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return Quote::from($data); + return QuoteFactory::from($data); } /** @@ -64,7 +65,7 @@ public function cancel( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return Quote::from($data); + return QuoteFactory::from($data); } /** @@ -79,7 +80,7 @@ public function create( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return Quote::from($data); + return QuoteFactory::from($data); } /** @@ -139,7 +140,7 @@ public function get( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return Quote::from($data); + return QuoteFactory::from($data); } public function getPdf( @@ -187,7 +188,7 @@ public function getAll( $data = Utils::jsonDecode((string) $response->getBody(), true); return new Collection( - array_map(fn (array $item): Quote => Quote::from($item), $data), + array_map(fn (array $item): Quote => QuoteFactory::from($item), $data), (int) $response->getHeaderLine(Collection::HEADER_LIMIT), (int) $response->getHeaderLine(Collection::HEADER_OFFSET), (int) $response->getHeaderLine(Collection::HEADER_TOTAL), @@ -311,7 +312,7 @@ public function issue( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return Quote::from($data); + return QuoteFactory::from($data); } /** @@ -331,7 +332,7 @@ public function patch( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return Quote::from($data); + return QuoteFactory::from($data); } /** @@ -350,7 +351,7 @@ public function recall( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return Quote::from($data); + return QuoteFactory::from($data); } /** @@ -369,7 +370,7 @@ public function reject( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return Quote::from($data); + return QuoteFactory::from($data); } /** @@ -389,6 +390,6 @@ public function update( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return Quote::from($data); + return QuoteFactory::from($data); } } diff --git a/src/Api/RichBillingPortalsApi.php b/src/Api/RichBillingPortalsApi.php new file mode 100644 index 000000000..1617767f3 --- /dev/null +++ b/src/Api/RichBillingPortalsApi.php @@ -0,0 +1,134 @@ +client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return RichBillingPortal::from($data); + } + + /** + * @return RichBillingPortal + */ + public function get( + string $id, + ): RichBillingPortal { + $pathParams = [ + '{id}' => $id, + ]; + + $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/rich-billing-portals/{id}'); + + $request = new Request('GET', $uri); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return RichBillingPortal::from($data); + } + + /** + * @return Collection + */ + public function getAll( + ?string $filter = null, + ?array $sort = null, + ?int $limit = null, + ?int $offset = null, + ?string $q = null, + ): Collection { + $queryParams = [ + 'filter' => $filter, + 'sort' => $sort ? implode(',', $sort) : null, + 'limit' => $limit, + 'offset' => $offset, + 'q' => $q, + ]; + $uri = '/rich-billing-portals?' . http_build_query($queryParams); + + $request = new Request('GET', $uri); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return new Collection( + array_map(fn (array $item): RichBillingPortal => RichBillingPortal::from($item), $data), + (int) $response->getHeaderLine(Collection::HEADER_LIMIT), + (int) $response->getHeaderLine(Collection::HEADER_OFFSET), + (int) $response->getHeaderLine(Collection::HEADER_TOTAL), + ); + } + + public function getAllPaginator( + ?string $filter = null, + ?array $sort = null, + ?int $limit = null, + ?int $offset = null, + ?string $q = null, + ): Paginator { + $closure = fn (?int $limit, ?int $offset): Collection => $this->getAll( + filter: $filter, + sort: $sort, + limit: $limit, + offset: $offset, + q: $q, + ); + + return new Paginator( + $limit !== null || $offset !== null ? $closure(limit: $limit, offset: $offset) : null, + $closure, + ); + } + + /** + * @return RichBillingPortal + */ + public function update( + string $id, + RichBillingPortal $richBillingPortal, + ): RichBillingPortal { + $pathParams = [ + '{id}' => $id, + ]; + + $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/rich-billing-portals/{id}'); + + $request = new Request('PUT', $uri, body: Utils::jsonEncode($richBillingPortal)); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return RichBillingPortal::from($data); + } +} diff --git a/src/Api/SubscriptionsApi.php b/src/Api/SubscriptionsApi.php index db21f021e..b283f9413 100644 --- a/src/Api/SubscriptionsApi.php +++ b/src/Api/SubscriptionsApi.php @@ -19,11 +19,13 @@ use Rebilly\Sdk\Collection; use Rebilly\Sdk\Model\Invoice; use Rebilly\Sdk\Model\InvoiceIssue; +use Rebilly\Sdk\Model\OrderItem; use Rebilly\Sdk\Model\OrderTimeline; -use Rebilly\Sdk\Model\Subscription; use Rebilly\Sdk\Model\SubscriptionChange; -use Rebilly\Sdk\Model\SubscriptionFactory; use Rebilly\Sdk\Model\SubscriptionInvoice; +use Rebilly\Sdk\Model\SubscriptionItemUpdate; +use Rebilly\Sdk\Model\SubscriptionOrOneTimeSale; +use Rebilly\Sdk\Model\SubscriptionOrOneTimeSaleFactory; use Rebilly\Sdk\Model\SubscriptionSummaryMetrics; use Rebilly\Sdk\Model\UpcomingInvoice; use Rebilly\Sdk\Paginator; @@ -35,12 +37,12 @@ public function __construct(protected ?ClientInterface $client) } /** - * @return Subscription + * @return SubscriptionOrOneTimeSale */ public function changeItems( string $id, SubscriptionChange $subscriptionChange, - ): Subscription { + ): SubscriptionOrOneTimeSale { $pathParams = [ '{id}' => $id, ]; @@ -51,26 +53,26 @@ public function changeItems( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return SubscriptionFactory::from($data); + return SubscriptionOrOneTimeSaleFactory::from($data); } /** - * @return Subscription + * @return SubscriptionOrOneTimeSale */ public function create( - Subscription $subscription, + SubscriptionOrOneTimeSale $subscriptionOrOneTimeSale, ?string $expand = null, - ): Subscription { + ): SubscriptionOrOneTimeSale { $queryParams = [ 'expand' => $expand, ]; $uri = '/subscriptions?' . http_build_query($queryParams); - $request = new Request('POST', $uri, body: Utils::jsonEncode($subscription)); + $request = new Request('POST', $uri, body: Utils::jsonEncode($subscriptionOrOneTimeSale)); $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return SubscriptionFactory::from($data); + return SubscriptionOrOneTimeSaleFactory::from($data); } /** @@ -142,12 +144,12 @@ public function deleteTimelineMessage( } /** - * @return Subscription + * @return SubscriptionOrOneTimeSale */ public function get( string $id, ?string $expand = null, - ): Subscription { + ): SubscriptionOrOneTimeSale { $pathParams = [ '{id}' => $id, ]; @@ -161,11 +163,11 @@ public function get( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return SubscriptionFactory::from($data); + return SubscriptionOrOneTimeSaleFactory::from($data); } /** - * @return Collection + * @return Collection */ public function getAll( ?string $filter = null, @@ -190,7 +192,7 @@ public function getAll( $data = Utils::jsonDecode((string) $response->getBody(), true); return new Collection( - array_map(fn (array $item): Subscription => SubscriptionFactory::from($item), $data), + array_map(fn (array $item): SubscriptionOrOneTimeSale => SubscriptionOrOneTimeSaleFactory::from($item), $data), (int) $response->getHeaderLine(Collection::HEADER_LIMIT), (int) $response->getHeaderLine(Collection::HEADER_OFFSET), (int) $response->getHeaderLine(Collection::HEADER_TOTAL), @@ -408,13 +410,13 @@ public function issueUpcomingInvoice( } /** - * @return Subscription + * @return SubscriptionOrOneTimeSale */ public function update( string $id, - Subscription $subscription, + SubscriptionOrOneTimeSale $subscriptionOrOneTimeSale, ?string $expand = null, - ): Subscription { + ): SubscriptionOrOneTimeSale { $pathParams = [ '{id}' => $id, ]; @@ -424,19 +426,41 @@ public function update( ]; $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/subscriptions/{id}?') . http_build_query($queryParams); - $request = new Request('PUT', $uri, body: Utils::jsonEncode($subscription)); + $request = new Request('PUT', $uri, body: Utils::jsonEncode($subscriptionOrOneTimeSale)); $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return SubscriptionFactory::from($data); + return SubscriptionOrOneTimeSaleFactory::from($data); } /** - * @return Subscription + * @return OrderItem + */ + public function updateItem( + string $id, + string $itemId, + SubscriptionItemUpdate $subscriptionItemUpdate, + ): OrderItem { + $pathParams = [ + '{id}' => $id, + '{itemId}' => $itemId, + ]; + + $uri = str_replace(array_keys($pathParams), array_values($pathParams), '/subscriptions/{id}/items/{itemId}'); + + $request = new Request('PATCH', $uri, body: Utils::jsonEncode($subscriptionItemUpdate)); + $response = $this->client->send($request); + $data = Utils::jsonDecode((string) $response->getBody(), true); + + return OrderItem::from($data); + } + + /** + * @return SubscriptionOrOneTimeSale */ public function void( string $id, - ): Subscription { + ): SubscriptionOrOneTimeSale { $pathParams = [ '{id}' => $id, ]; @@ -447,6 +471,6 @@ public function void( $response = $this->client->send($request); $data = Utils::jsonDecode((string) $response->getBody(), true); - return SubscriptionFactory::from($data); + return SubscriptionOrOneTimeSaleFactory::from($data); } } diff --git a/src/CombinedService.php b/src/CombinedService.php index f32b60405..7e2161f7c 100644 --- a/src/CombinedService.php +++ b/src/CombinedService.php @@ -135,6 +135,8 @@ class CombinedService private Api\ReportsApi $reports; + private Api\RichBillingPortalsApi $richBillingPortals; + private Api\RiskScoreRulesApi $riskScoreRules; private Api\RolesApi $roles; @@ -236,6 +238,7 @@ public function __construct(Client $client = null, array $config = []) $this->purchase = new Api\PurchaseApi($this->client); $this->quotes = new Api\QuotesApi($this->client); $this->reports = new Api\ReportsApi($this->client); + $this->richBillingPortals = new Api\RichBillingPortalsApi($this->client); $this->riskScoreRules = new Api\RiskScoreRulesApi($this->client); $this->roles = new Api\RolesApi($this->client); $this->search = new Api\SearchApi($this->client); @@ -553,6 +556,11 @@ public function reports(): Api\ReportsApi return $this->reports; } + public function richBillingPortals(): Api\RichBillingPortalsApi + { + return $this->richBillingPortals; + } + public function riskScoreRules(): Api\RiskScoreRulesApi { return $this->riskScoreRules; diff --git a/src/Model/AdjustReadyToPayGeneric.php b/src/Model/AdjustReadyToPayGeneric.php index 26de2b090..ae8333e4b 100644 --- a/src/Model/AdjustReadyToPayGeneric.php +++ b/src/Model/AdjustReadyToPayGeneric.php @@ -211,6 +211,8 @@ class AdjustReadyToPayGeneric implements AdjustPaymentMethod, JsonSerializable public const PAYMENT_METHOD_PIASTRIX = 'Piastrix'; + public const PAYMENT_METHOD_PIX = 'PIX'; + public const PAYMENT_METHOD_PAY_TABS = 'PayTabs'; public const PAYMENT_METHOD_PAYSAFECARD = 'Paysafecard'; @@ -301,6 +303,8 @@ class AdjustReadyToPayGeneric implements AdjustPaymentMethod, JsonSerializable public const PAYMENT_METHOD_WE_CHAT_PAY = 'WeChat Pay'; + public const PAYMENT_METHOD_WIRE = 'wire'; + public const PAYMENT_METHOD_X_PAY_P2_P = 'XPay-P2P'; public const PAYMENT_METHOD_X_PAY_QR = 'XPay-QR'; diff --git a/src/Model/AdjustReadyToPayoutGeneric.php b/src/Model/AdjustReadyToPayoutGeneric.php new file mode 100644 index 000000000..b458444fb --- /dev/null +++ b/src/Model/AdjustReadyToPayoutGeneric.php @@ -0,0 +1,55 @@ +setPaymentMethod($data['paymentMethod']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getPaymentMethod(): ?string + { + return $this->fields['paymentMethod'] ?? null; + } + + public function setPaymentMethod(null|string $paymentMethod): static + { + $this->fields['paymentMethod'] = $paymentMethod; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('paymentMethod', $this->fields)) { + $data['paymentMethod'] = $this->fields['paymentMethod']; + } + + return $data; + } +} diff --git a/src/Model/AdjustReadyToPayoutPaymentMethod.php b/src/Model/AdjustReadyToPayoutPaymentMethod.php new file mode 100644 index 000000000..daa1ef145 --- /dev/null +++ b/src/Model/AdjustReadyToPayoutPaymentMethod.php @@ -0,0 +1,19 @@ + AdjustReadyToPayoutGeneric::from($data), + 'Alfa-click' => AdjustReadyToPayoutGeneric::from($data), + 'Alipay' => AdjustReadyToPayoutGeneric::from($data), + 'AstroPay Card' => AdjustReadyToPayoutGeneric::from($data), + 'AstroPay-GO' => AdjustReadyToPayoutGeneric::from($data), + 'Baloto' => AdjustReadyToPayoutGeneric::from($data), + 'Bancontact' => AdjustReadyToPayoutGeneric::from($data), + 'Bancontact-mobile' => AdjustReadyToPayoutGeneric::from($data), + 'BankReferenced' => AdjustReadyToPayoutGeneric::from($data), + 'Beeline' => AdjustReadyToPayoutGeneric::from($data), + 'Belfius-direct-net' => AdjustReadyToPayoutGeneric::from($data), + 'Bizum' => AdjustReadyToPayoutGeneric::from($data), + 'Boleto' => AdjustReadyToPayoutGeneric::from($data), + 'CASHlib' => AdjustReadyToPayoutGeneric::from($data), + 'CODVoucher' => AdjustReadyToPayoutGeneric::from($data), + 'CashToCode' => AdjustReadyToPayoutGeneric::from($data), + 'China UnionPay' => AdjustReadyToPayoutGeneric::from($data), + 'Cleo' => AdjustReadyToPayoutGeneric::from($data), + 'Conekta-oxxo' => AdjustReadyToPayoutGeneric::from($data), + 'Cupon-de-pagos' => AdjustReadyToPayoutGeneric::from($data), + 'EPS' => AdjustReadyToPayoutGeneric::from($data), + 'Efecty' => AdjustReadyToPayoutGeneric::from($data), + 'FasterPay' => AdjustReadyToPayoutGeneric::from($data), + 'Flexepin' => AdjustReadyToPayoutGeneric::from($data), + 'Giropay' => AdjustReadyToPayoutGeneric::from($data), + 'Google Pay' => AdjustReadyToPayoutGeneric::from($data), + 'Gpaysafe' => AdjustReadyToPayoutGeneric::from($data), + 'ING-homepay' => AdjustReadyToPayoutGeneric::from($data), + 'INOVAPAY-pin' => AdjustReadyToPayoutGeneric::from($data), + 'INOVAPAY-wallet' => AdjustReadyToPayoutGeneric::from($data), + 'InstaDebit' => AdjustReadyToPayoutGeneric::from($data), + 'InstantPayments' => AdjustReadyToPayoutGeneric::from($data), + 'Interac' => AdjustReadyToPayoutGeneric::from($data), + 'Interac-eTransfer' => AdjustReadyToPayoutGeneric::from($data), + 'Interac-online' => AdjustReadyToPayoutGeneric::from($data), + 'Jeton' => AdjustReadyToPayoutGeneric::from($data), + 'KNOT' => AdjustReadyToPayoutGeneric::from($data), + 'Khelocard' => AdjustReadyToPayoutGeneric::from($data), + 'Klarna' => AdjustReadyToPayoutGeneric::from($data), + 'MTS' => AdjustReadyToPayoutGeneric::from($data), + 'Matrix' => AdjustReadyToPayoutGeneric::from($data), + 'MaxiCash' => AdjustReadyToPayoutGeneric::from($data), + 'Megafon' => AdjustReadyToPayoutGeneric::from($data), + 'MiFinity-eWallet' => AdjustReadyToPayoutGeneric::from($data), + 'MuchBetter' => AdjustReadyToPayoutGeneric::from($data), + 'Multibanco' => AdjustReadyToPayoutGeneric::from($data), + 'Neosurf' => AdjustReadyToPayoutGeneric::from($data), + 'Netbanking' => AdjustReadyToPayoutGeneric::from($data), + 'Neteller' => AdjustReadyToPayoutGeneric::from($data), + 'Nordea-Solo' => AdjustReadyToPayoutGeneric::from($data), + 'OXXO' => AdjustReadyToPayoutGeneric::from($data), + 'OchaPay' => AdjustReadyToPayoutGeneric::from($data), + 'Onlineueberweisen' => AdjustReadyToPayoutGeneric::from($data), + 'P24' => AdjustReadyToPayoutGeneric::from($data), + 'POLi' => AdjustReadyToPayoutGeneric::from($data), + 'Pagadito' => AdjustReadyToPayoutGeneric::from($data), + 'PagoEffectivo' => AdjustReadyToPayoutGeneric::from($data), + 'Pagsmile-deposit-express' => AdjustReadyToPayoutGeneric::from($data), + 'Pagsmile-lottery' => AdjustReadyToPayoutGeneric::from($data), + 'Pay4Fun' => AdjustReadyToPayoutGeneric::from($data), + 'PayCash' => AdjustReadyToPayoutGeneric::from($data), + 'PayTabs' => AdjustReadyToPayoutGeneric::from($data), + 'Payeer' => AdjustReadyToPayoutGeneric::from($data), + 'PaymentAsia-crypto' => AdjustReadyToPayoutGeneric::from($data), + 'Paymero' => AdjustReadyToPayoutGeneric::from($data), + 'Paynote' => AdjustReadyToPayoutGeneric::from($data), + 'Paysafecard' => AdjustReadyToPayoutGeneric::from($data), + 'Paysafecash' => AdjustReadyToPayoutGeneric::from($data), + 'Perfect-money' => AdjustReadyToPayoutGeneric::from($data), + 'PhonePe' => AdjustReadyToPayoutGeneric::from($data), + 'Piastrix' => AdjustReadyToPayoutGeneric::from($data), + 'PinPay' => AdjustReadyToPayoutGeneric::from($data), + 'PostFinance-card' => AdjustReadyToPayoutGeneric::from($data), + 'PostFinance-e-finance' => AdjustReadyToPayoutGeneric::from($data), + 'QIWI' => AdjustReadyToPayoutGeneric::from($data), + 'QPay' => AdjustReadyToPayoutGeneric::from($data), + 'QQPay' => AdjustReadyToPayoutGeneric::from($data), + 'Resurs' => AdjustReadyToPayoutGeneric::from($data), + 'SEPA' => AdjustReadyToPayoutGeneric::from($data), + 'SMSVoucher' => AdjustReadyToPayoutGeneric::from($data), + 'SafetyPay' => AdjustReadyToPayoutGeneric::from($data), + 'Skrill' => AdjustReadyToPayoutGeneric::from($data), + 'Skrill Rapid Transfer' => AdjustReadyToPayoutGeneric::from($data), + 'Sofort' => AdjustReadyToPayoutGeneric::from($data), + 'SparkPay' => AdjustReadyToPayoutGeneric::from($data), + 'Tele2' => AdjustReadyToPayoutGeneric::from($data), + 'Terminaly-RF' => AdjustReadyToPayoutGeneric::from($data), + 'ToditoCash-card' => AdjustReadyToPayoutGeneric::from($data), + 'Trustly' => AdjustReadyToPayoutGeneric::from($data), + 'UPI' => AdjustReadyToPayoutGeneric::from($data), + 'UPayCard' => AdjustReadyToPayoutGeneric::from($data), + 'USD-coin' => AdjustReadyToPayoutGeneric::from($data), + 'VCreditos' => AdjustReadyToPayoutGeneric::from($data), + 'VenusPoint' => AdjustReadyToPayoutGeneric::from($data), + 'WeChat Pay' => AdjustReadyToPayoutGeneric::from($data), + 'Webmoney' => AdjustReadyToPayoutGeneric::from($data), + 'Webpay' => AdjustReadyToPayoutGeneric::from($data), + 'Webpay Card' => AdjustReadyToPayoutGeneric::from($data), + 'Webpay-2' => AdjustReadyToPayoutGeneric::from($data), + 'XPay-P2P' => AdjustReadyToPayoutGeneric::from($data), + 'XPay-QR' => AdjustReadyToPayoutGeneric::from($data), + 'Yandex-money' => AdjustReadyToPayoutGeneric::from($data), + 'Zimpler' => AdjustReadyToPayoutGeneric::from($data), + 'Zotapay' => AdjustReadyToPayoutGeneric::from($data), + 'ach' => AdjustReadyToPayoutGeneric::from($data), + 'bank-transfer' => AdjustReadyToPayoutGeneric::from($data), + 'bank-transfer-2' => AdjustReadyToPayoutGeneric::from($data), + 'bank-transfer-3' => AdjustReadyToPayoutGeneric::from($data), + 'bank-transfer-4' => AdjustReadyToPayoutGeneric::from($data), + 'bank-transfer-5' => AdjustReadyToPayoutGeneric::from($data), + 'bank-transfer-6' => AdjustReadyToPayoutGeneric::from($data), + 'bank-transfer-7' => AdjustReadyToPayoutGeneric::from($data), + 'bank-transfer-8' => AdjustReadyToPayoutGeneric::from($data), + 'bank-transfer-9' => AdjustReadyToPayoutGeneric::from($data), + 'bitcoin' => AdjustReadyToPayoutGeneric::from($data), + 'cash' => AdjustReadyToPayoutGeneric::from($data), + 'cash-deposit' => AdjustReadyToPayoutGeneric::from($data), + 'check' => AdjustReadyToPayoutGeneric::from($data), + 'cryptocurrency' => AdjustReadyToPayoutGeneric::from($data), + 'domestic-cards' => AdjustReadyToPayoutGeneric::from($data), + 'ePay.bg' => AdjustReadyToPayoutGeneric::from($data), + 'eZeeWallet' => AdjustReadyToPayoutGeneric::from($data), + 'echeck' => AdjustReadyToPayoutGeneric::from($data), + 'ecoPayz' => AdjustReadyToPayoutGeneric::from($data), + 'ecoVoucher' => AdjustReadyToPayoutGeneric::from($data), + 'iDEAL' => AdjustReadyToPayoutGeneric::from($data), + 'iDebit' => AdjustReadyToPayoutGeneric::from($data), + 'iWallet' => AdjustReadyToPayoutGeneric::from($data), + 'instant-bank-transfer' => AdjustReadyToPayoutGeneric::from($data), + 'invoice' => AdjustReadyToPayoutGeneric::from($data), + 'jpay' => AdjustReadyToPayoutGeneric::from($data), + 'loonie' => AdjustReadyToPayoutGeneric::from($data), + 'miscellaneous' => AdjustReadyToPayoutGeneric::from($data), + 'online-bank-transfer' => AdjustReadyToPayoutGeneric::from($data), + 'oriental-wallet' => AdjustReadyToPayoutGeneric::from($data), + 'payment-card' => AdjustReadyToPayoutGeneric::from($data), + 'paypal' => AdjustReadyToPayoutGeneric::from($data), + 'phone' => AdjustReadyToPayoutGeneric::from($data), + 'plaid-account' => AdjustReadyToPayoutGeneric::from($data), + 'rapyd-checkout' => AdjustReadyToPayoutGeneric::from($data), + 'swift-dbt' => AdjustReadyToPayoutGeneric::from($data), + 'voucher' => AdjustReadyToPayoutGeneric::from($data), + 'voucher-2' => AdjustReadyToPayoutGeneric::from($data), + 'voucher-3' => AdjustReadyToPayoutGeneric::from($data), + 'voucher-4' => AdjustReadyToPayoutGeneric::from($data), + default => throw new UnknownDiscriminatorValueException(), + }; + } +} diff --git a/src/Model/AlternativeInstrument.php b/src/Model/AlternativeInstrument.php index 1db35c7b2..1d65a921c 100644 --- a/src/Model/AlternativeInstrument.php +++ b/src/Model/AlternativeInstrument.php @@ -213,6 +213,8 @@ class AlternativeInstrument implements PaymentInstrument, PostPaymentInstrumentR public const METHOD_PIASTRIX = 'Piastrix'; + public const METHOD_PIX = 'PIX'; + public const METHOD_PAY_TABS = 'PayTabs'; public const METHOD_PAYSAFECARD = 'Paysafecard'; @@ -303,6 +305,8 @@ class AlternativeInstrument implements PaymentInstrument, PostPaymentInstrumentR public const METHOD_WE_CHAT_PAY = 'WeChat Pay'; + public const METHOD_WIRE = 'wire'; + public const METHOD_X_PAY_P2_P = 'XPay-P2P'; public const METHOD_X_PAY_QR = 'XPay-QR'; diff --git a/src/Model/AlternativePaymentToken.php b/src/Model/AlternativePaymentToken.php index 8a9fc6605..82839817c 100644 --- a/src/Model/AlternativePaymentToken.php +++ b/src/Model/AlternativePaymentToken.php @@ -213,6 +213,8 @@ class AlternativePaymentToken implements CompositeToken, JsonSerializable public const METHOD_PIASTRIX = 'Piastrix'; + public const METHOD_PIX = 'PIX'; + public const METHOD_PAY_TABS = 'PayTabs'; public const METHOD_PAYSAFECARD = 'Paysafecard'; @@ -303,6 +305,8 @@ class AlternativePaymentToken implements CompositeToken, JsonSerializable public const METHOD_WE_CHAT_PAY = 'WeChat Pay'; + public const METHOD_WIRE = 'wire'; + public const METHOD_X_PAY_P2_P = 'XPay-P2P'; public const METHOD_X_PAY_QR = 'XPay-QR'; diff --git a/src/Model/AmlCompoundConfidence.php b/src/Model/AmlCompoundConfidence.php new file mode 100644 index 000000000..2dfaa326d --- /dev/null +++ b/src/Model/AmlCompoundConfidence.php @@ -0,0 +1,103 @@ +setAddressMatch($data['addressMatch']); + } + if (array_key_exists('addressMismatch', $data)) { + $this->setAddressMismatch($data['addressMismatch']); + } + if (array_key_exists('noAddress', $data)) { + $this->setNoAddress($data['noAddress']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getAddressMatch(): ?AmlCompoundConfidenceAddressMatch + { + return $this->fields['addressMatch'] ?? null; + } + + public function setAddressMatch(null|AmlCompoundConfidenceAddressMatch|array $addressMatch): static + { + if ($addressMatch !== null && !($addressMatch instanceof AmlCompoundConfidenceAddressMatch)) { + $addressMatch = AmlCompoundConfidenceAddressMatch::from($addressMatch); + } + + $this->fields['addressMatch'] = $addressMatch; + + return $this; + } + + public function getAddressMismatch(): ?AmlCompoundConfidenceAddressMismatch + { + return $this->fields['addressMismatch'] ?? null; + } + + public function setAddressMismatch(null|AmlCompoundConfidenceAddressMismatch|array $addressMismatch): static + { + if ($addressMismatch !== null && !($addressMismatch instanceof AmlCompoundConfidenceAddressMismatch)) { + $addressMismatch = AmlCompoundConfidenceAddressMismatch::from($addressMismatch); + } + + $this->fields['addressMismatch'] = $addressMismatch; + + return $this; + } + + public function getNoAddress(): ?AmlCompoundConfidenceNoAddress + { + return $this->fields['noAddress'] ?? null; + } + + public function setNoAddress(null|AmlCompoundConfidenceNoAddress|array $noAddress): static + { + if ($noAddress !== null && !($noAddress instanceof AmlCompoundConfidenceNoAddress)) { + $noAddress = AmlCompoundConfidenceNoAddress::from($noAddress); + } + + $this->fields['noAddress'] = $noAddress; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('addressMatch', $this->fields)) { + $data['addressMatch'] = $this->fields['addressMatch']?->jsonSerialize(); + } + if (array_key_exists('addressMismatch', $this->fields)) { + $data['addressMismatch'] = $this->fields['addressMismatch']?->jsonSerialize(); + } + if (array_key_exists('noAddress', $this->fields)) { + $data['noAddress'] = $this->fields['noAddress']?->jsonSerialize(); + } + + return $data; + } +} diff --git a/src/Model/AmlSettingsConfidenceDobExactMatch.php b/src/Model/AmlCompoundConfidenceAddressMatch.php similarity index 97% rename from src/Model/AmlSettingsConfidenceDobExactMatch.php rename to src/Model/AmlCompoundConfidenceAddressMatch.php index ad6a8d016..90b167b7f 100644 --- a/src/Model/AmlSettingsConfidenceDobExactMatch.php +++ b/src/Model/AmlCompoundConfidenceAddressMatch.php @@ -15,7 +15,7 @@ use JsonSerializable; -class AmlSettingsConfidenceDobExactMatch implements JsonSerializable +class AmlCompoundConfidenceAddressMatch implements JsonSerializable { private array $fields = []; diff --git a/src/Model/AmlSettingsConfidenceYobInexactMatch.php b/src/Model/AmlCompoundConfidenceAddressMismatch.php similarity index 97% rename from src/Model/AmlSettingsConfidenceYobInexactMatch.php rename to src/Model/AmlCompoundConfidenceAddressMismatch.php index a8e1f966d..2b545fce8 100644 --- a/src/Model/AmlSettingsConfidenceYobInexactMatch.php +++ b/src/Model/AmlCompoundConfidenceAddressMismatch.php @@ -15,7 +15,7 @@ use JsonSerializable; -class AmlSettingsConfidenceYobInexactMatch implements JsonSerializable +class AmlCompoundConfidenceAddressMismatch implements JsonSerializable { private array $fields = []; diff --git a/src/Model/AmlSettingsConfidenceYobExactMatch.php b/src/Model/AmlCompoundConfidenceNoAddress.php similarity index 97% rename from src/Model/AmlSettingsConfidenceYobExactMatch.php rename to src/Model/AmlCompoundConfidenceNoAddress.php index 0aaef7a39..29f54d993 100644 --- a/src/Model/AmlSettingsConfidenceYobExactMatch.php +++ b/src/Model/AmlCompoundConfidenceNoAddress.php @@ -15,7 +15,7 @@ use JsonSerializable; -class AmlSettingsConfidenceYobExactMatch implements JsonSerializable +class AmlCompoundConfidenceNoAddress implements JsonSerializable { private array $fields = []; diff --git a/src/Model/AmlSettingsConfidence.php b/src/Model/AmlSettingsConfidence.php index 0500b34ef..155eb0740 100644 --- a/src/Model/AmlSettingsConfidence.php +++ b/src/Model/AmlSettingsConfidence.php @@ -21,32 +21,17 @@ class AmlSettingsConfidence implements JsonSerializable public function __construct(array $data = []) { - if (array_key_exists('noDobExactMatch', $data)) { - $this->setNoDobExactMatch($data['noDobExactMatch']); + if (array_key_exists('dob', $data)) { + $this->setDob($data['dob']); } - if (array_key_exists('noDobInexactMatch', $data)) { - $this->setNoDobInexactMatch($data['noDobInexactMatch']); + if (array_key_exists('noDob', $data)) { + $this->setNoDob($data['noDob']); } - if (array_key_exists('noDobWeakMatch', $data)) { - $this->setNoDobWeakMatch($data['noDobWeakMatch']); + if (array_key_exists('yob', $data)) { + $this->setYob($data['yob']); } - if (array_key_exists('dobExactMatch', $data)) { - $this->setDobExactMatch($data['dobExactMatch']); - } - if (array_key_exists('dobInexactMatch', $data)) { - $this->setDobInexactMatch($data['dobInexactMatch']); - } - if (array_key_exists('yobExactMatch', $data)) { - $this->setYobExactMatch($data['yobExactMatch']); - } - if (array_key_exists('yobInexactMatch', $data)) { - $this->setYobInexactMatch($data['yobInexactMatch']); - } - if (array_key_exists('inexactYobExactMatch', $data)) { - $this->setInexactYobExactMatch($data['inexactYobExactMatch']); - } - if (array_key_exists('inexactYobInexactMatch', $data)) { - $this->setInexactYobInexactMatch($data['inexactYobInexactMatch']); + if (array_key_exists('inexactYob', $data)) { + $this->setInexactYob($data['inexactYob']); } } @@ -55,146 +40,66 @@ public static function from(array $data = []): self return new self($data); } - public function getNoDobExactMatch(): ?AmlSettingsConfidenceNoDobExactMatch - { - return $this->fields['noDobExactMatch'] ?? null; - } - - public function setNoDobExactMatch(null|AmlSettingsConfidenceNoDobExactMatch|array $noDobExactMatch): static - { - if ($noDobExactMatch !== null && !($noDobExactMatch instanceof AmlSettingsConfidenceNoDobExactMatch)) { - $noDobExactMatch = AmlSettingsConfidenceNoDobExactMatch::from($noDobExactMatch); - } - - $this->fields['noDobExactMatch'] = $noDobExactMatch; - - return $this; - } - - public function getNoDobInexactMatch(): ?AmlSettingsConfidenceNoDobInexactMatch - { - return $this->fields['noDobInexactMatch'] ?? null; - } - - public function setNoDobInexactMatch(null|AmlSettingsConfidenceNoDobInexactMatch|array $noDobInexactMatch): static - { - if ($noDobInexactMatch !== null && !($noDobInexactMatch instanceof AmlSettingsConfidenceNoDobInexactMatch)) { - $noDobInexactMatch = AmlSettingsConfidenceNoDobInexactMatch::from($noDobInexactMatch); - } - - $this->fields['noDobInexactMatch'] = $noDobInexactMatch; - - return $this; - } - - public function getNoDobWeakMatch(): ?AmlSettingsConfidenceNoDobWeakMatch - { - return $this->fields['noDobWeakMatch'] ?? null; - } - - public function setNoDobWeakMatch(null|AmlSettingsConfidenceNoDobWeakMatch|array $noDobWeakMatch): static - { - if ($noDobWeakMatch !== null && !($noDobWeakMatch instanceof AmlSettingsConfidenceNoDobWeakMatch)) { - $noDobWeakMatch = AmlSettingsConfidenceNoDobWeakMatch::from($noDobWeakMatch); - } - - $this->fields['noDobWeakMatch'] = $noDobWeakMatch; - - return $this; - } - - public function getDobExactMatch(): ?AmlSettingsConfidenceDobExactMatch - { - return $this->fields['dobExactMatch'] ?? null; - } - - public function setDobExactMatch(null|AmlSettingsConfidenceDobExactMatch|array $dobExactMatch): static - { - if ($dobExactMatch !== null && !($dobExactMatch instanceof AmlSettingsConfidenceDobExactMatch)) { - $dobExactMatch = AmlSettingsConfidenceDobExactMatch::from($dobExactMatch); - } - - $this->fields['dobExactMatch'] = $dobExactMatch; - - return $this; - } - - public function getDobInexactMatch(): ?AmlSettingsConfidenceDobInexactMatch + public function getDob(): ?AmlSettingsConfidenceDob { - return $this->fields['dobInexactMatch'] ?? null; + return $this->fields['dob'] ?? null; } - public function setDobInexactMatch(null|AmlSettingsConfidenceDobInexactMatch|array $dobInexactMatch): static + public function setDob(null|AmlSettingsConfidenceDob|array $dob): static { - if ($dobInexactMatch !== null && !($dobInexactMatch instanceof AmlSettingsConfidenceDobInexactMatch)) { - $dobInexactMatch = AmlSettingsConfidenceDobInexactMatch::from($dobInexactMatch); + if ($dob !== null && !($dob instanceof AmlSettingsConfidenceDob)) { + $dob = AmlSettingsConfidenceDob::from($dob); } - $this->fields['dobInexactMatch'] = $dobInexactMatch; + $this->fields['dob'] = $dob; return $this; } - public function getYobExactMatch(): ?AmlSettingsConfidenceYobExactMatch + public function getNoDob(): ?AmlSettingsConfidenceNoDob { - return $this->fields['yobExactMatch'] ?? null; + return $this->fields['noDob'] ?? null; } - public function setYobExactMatch(null|AmlSettingsConfidenceYobExactMatch|array $yobExactMatch): static + public function setNoDob(null|AmlSettingsConfidenceNoDob|array $noDob): static { - if ($yobExactMatch !== null && !($yobExactMatch instanceof AmlSettingsConfidenceYobExactMatch)) { - $yobExactMatch = AmlSettingsConfidenceYobExactMatch::from($yobExactMatch); + if ($noDob !== null && !($noDob instanceof AmlSettingsConfidenceNoDob)) { + $noDob = AmlSettingsConfidenceNoDob::from($noDob); } - $this->fields['yobExactMatch'] = $yobExactMatch; + $this->fields['noDob'] = $noDob; return $this; } - public function getYobInexactMatch(): ?AmlSettingsConfidenceYobInexactMatch + public function getYob(): ?AmlSettingsConfidenceYob { - return $this->fields['yobInexactMatch'] ?? null; + return $this->fields['yob'] ?? null; } - public function setYobInexactMatch(null|AmlSettingsConfidenceYobInexactMatch|array $yobInexactMatch): static + public function setYob(null|AmlSettingsConfidenceYob|array $yob): static { - if ($yobInexactMatch !== null && !($yobInexactMatch instanceof AmlSettingsConfidenceYobInexactMatch)) { - $yobInexactMatch = AmlSettingsConfidenceYobInexactMatch::from($yobInexactMatch); + if ($yob !== null && !($yob instanceof AmlSettingsConfidenceYob)) { + $yob = AmlSettingsConfidenceYob::from($yob); } - $this->fields['yobInexactMatch'] = $yobInexactMatch; + $this->fields['yob'] = $yob; return $this; } - public function getInexactYobExactMatch(): ?AmlSettingsConfidenceInexactYobExactMatch + public function getInexactYob(): ?AmlSettingsConfidenceInexactYob { - return $this->fields['inexactYobExactMatch'] ?? null; + return $this->fields['inexactYob'] ?? null; } - public function setInexactYobExactMatch(null|AmlSettingsConfidenceInexactYobExactMatch|array $inexactYobExactMatch): static + public function setInexactYob(null|AmlSettingsConfidenceInexactYob|array $inexactYob): static { - if ($inexactYobExactMatch !== null && !($inexactYobExactMatch instanceof AmlSettingsConfidenceInexactYobExactMatch)) { - $inexactYobExactMatch = AmlSettingsConfidenceInexactYobExactMatch::from($inexactYobExactMatch); + if ($inexactYob !== null && !($inexactYob instanceof AmlSettingsConfidenceInexactYob)) { + $inexactYob = AmlSettingsConfidenceInexactYob::from($inexactYob); } - $this->fields['inexactYobExactMatch'] = $inexactYobExactMatch; - - return $this; - } - - public function getInexactYobInexactMatch(): ?AmlSettingsConfidenceInexactYobInexactMatch - { - return $this->fields['inexactYobInexactMatch'] ?? null; - } - - public function setInexactYobInexactMatch(null|AmlSettingsConfidenceInexactYobInexactMatch|array $inexactYobInexactMatch): static - { - if ($inexactYobInexactMatch !== null && !($inexactYobInexactMatch instanceof AmlSettingsConfidenceInexactYobInexactMatch)) { - $inexactYobInexactMatch = AmlSettingsConfidenceInexactYobInexactMatch::from($inexactYobInexactMatch); - } - - $this->fields['inexactYobInexactMatch'] = $inexactYobInexactMatch; + $this->fields['inexactYob'] = $inexactYob; return $this; } @@ -202,32 +107,17 @@ public function setInexactYobInexactMatch(null|AmlSettingsConfidenceInexactYobIn public function jsonSerialize(): array { $data = []; - if (array_key_exists('noDobExactMatch', $this->fields)) { - $data['noDobExactMatch'] = $this->fields['noDobExactMatch']?->jsonSerialize(); - } - if (array_key_exists('noDobInexactMatch', $this->fields)) { - $data['noDobInexactMatch'] = $this->fields['noDobInexactMatch']?->jsonSerialize(); - } - if (array_key_exists('noDobWeakMatch', $this->fields)) { - $data['noDobWeakMatch'] = $this->fields['noDobWeakMatch']?->jsonSerialize(); - } - if (array_key_exists('dobExactMatch', $this->fields)) { - $data['dobExactMatch'] = $this->fields['dobExactMatch']?->jsonSerialize(); - } - if (array_key_exists('dobInexactMatch', $this->fields)) { - $data['dobInexactMatch'] = $this->fields['dobInexactMatch']?->jsonSerialize(); - } - if (array_key_exists('yobExactMatch', $this->fields)) { - $data['yobExactMatch'] = $this->fields['yobExactMatch']?->jsonSerialize(); + if (array_key_exists('dob', $this->fields)) { + $data['dob'] = $this->fields['dob']?->jsonSerialize(); } - if (array_key_exists('yobInexactMatch', $this->fields)) { - $data['yobInexactMatch'] = $this->fields['yobInexactMatch']?->jsonSerialize(); + if (array_key_exists('noDob', $this->fields)) { + $data['noDob'] = $this->fields['noDob']?->jsonSerialize(); } - if (array_key_exists('inexactYobExactMatch', $this->fields)) { - $data['inexactYobExactMatch'] = $this->fields['inexactYobExactMatch']?->jsonSerialize(); + if (array_key_exists('yob', $this->fields)) { + $data['yob'] = $this->fields['yob']?->jsonSerialize(); } - if (array_key_exists('inexactYobInexactMatch', $this->fields)) { - $data['inexactYobInexactMatch'] = $this->fields['inexactYobInexactMatch']?->jsonSerialize(); + if (array_key_exists('inexactYob', $this->fields)) { + $data['inexactYob'] = $this->fields['inexactYob']?->jsonSerialize(); } return $data; diff --git a/src/Model/AmlSettingsConfidenceDob.php b/src/Model/AmlSettingsConfidenceDob.php new file mode 100644 index 000000000..5e644b7f4 --- /dev/null +++ b/src/Model/AmlSettingsConfidenceDob.php @@ -0,0 +1,81 @@ +setExactMatch($data['exactMatch']); + } + if (array_key_exists('inexactMatch', $data)) { + $this->setInexactMatch($data['inexactMatch']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getExactMatch(): ?AmlCompoundConfidence + { + return $this->fields['exactMatch'] ?? null; + } + + public function setExactMatch(null|AmlCompoundConfidence|array $exactMatch): static + { + if ($exactMatch !== null && !($exactMatch instanceof AmlCompoundConfidence)) { + $exactMatch = AmlCompoundConfidence::from($exactMatch); + } + + $this->fields['exactMatch'] = $exactMatch; + + return $this; + } + + public function getInexactMatch(): ?AmlCompoundConfidence + { + return $this->fields['inexactMatch'] ?? null; + } + + public function setInexactMatch(null|AmlCompoundConfidence|array $inexactMatch): static + { + if ($inexactMatch !== null && !($inexactMatch instanceof AmlCompoundConfidence)) { + $inexactMatch = AmlCompoundConfidence::from($inexactMatch); + } + + $this->fields['inexactMatch'] = $inexactMatch; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('exactMatch', $this->fields)) { + $data['exactMatch'] = $this->fields['exactMatch']?->jsonSerialize(); + } + if (array_key_exists('inexactMatch', $this->fields)) { + $data['inexactMatch'] = $this->fields['inexactMatch']?->jsonSerialize(); + } + + return $data; + } +} diff --git a/src/Model/AmlSettingsConfidenceDobInexactMatch.php b/src/Model/AmlSettingsConfidenceDobInexactMatch.php deleted file mode 100644 index a0b9fa09c..000000000 --- a/src/Model/AmlSettingsConfidenceDobInexactMatch.php +++ /dev/null @@ -1,91 +0,0 @@ -setMatchingCountry($data['matchingCountry']); - } - if (array_key_exists('mismatchingCountry', $data)) { - $this->setMismatchingCountry($data['mismatchingCountry']); - } - if (array_key_exists('noCountry', $data)) { - $this->setNoCountry($data['noCountry']); - } - } - - public static function from(array $data = []): self - { - return new self($data); - } - - public function getMatchingCountry(): ?string - { - return $this->fields['matchingCountry'] ?? null; - } - - public function setMatchingCountry(null|string $matchingCountry): static - { - $this->fields['matchingCountry'] = $matchingCountry; - - return $this; - } - - public function getMismatchingCountry(): ?string - { - return $this->fields['mismatchingCountry'] ?? null; - } - - public function setMismatchingCountry(null|string $mismatchingCountry): static - { - $this->fields['mismatchingCountry'] = $mismatchingCountry; - - return $this; - } - - public function getNoCountry(): ?string - { - return $this->fields['noCountry'] ?? null; - } - - public function setNoCountry(null|string $noCountry): static - { - $this->fields['noCountry'] = $noCountry; - - return $this; - } - - public function jsonSerialize(): array - { - $data = []; - if (array_key_exists('matchingCountry', $this->fields)) { - $data['matchingCountry'] = $this->fields['matchingCountry']; - } - if (array_key_exists('mismatchingCountry', $this->fields)) { - $data['mismatchingCountry'] = $this->fields['mismatchingCountry']; - } - if (array_key_exists('noCountry', $this->fields)) { - $data['noCountry'] = $this->fields['noCountry']; - } - - return $data; - } -} diff --git a/src/Model/AmlSettingsConfidenceInexactYob.php b/src/Model/AmlSettingsConfidenceInexactYob.php new file mode 100644 index 000000000..6cbe4e867 --- /dev/null +++ b/src/Model/AmlSettingsConfidenceInexactYob.php @@ -0,0 +1,81 @@ +setExactMatch($data['exactMatch']); + } + if (array_key_exists('inexactMatch', $data)) { + $this->setInexactMatch($data['inexactMatch']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getExactMatch(): ?AmlCompoundConfidence + { + return $this->fields['exactMatch'] ?? null; + } + + public function setExactMatch(null|AmlCompoundConfidence|array $exactMatch): static + { + if ($exactMatch !== null && !($exactMatch instanceof AmlCompoundConfidence)) { + $exactMatch = AmlCompoundConfidence::from($exactMatch); + } + + $this->fields['exactMatch'] = $exactMatch; + + return $this; + } + + public function getInexactMatch(): ?AmlCompoundConfidence + { + return $this->fields['inexactMatch'] ?? null; + } + + public function setInexactMatch(null|AmlCompoundConfidence|array $inexactMatch): static + { + if ($inexactMatch !== null && !($inexactMatch instanceof AmlCompoundConfidence)) { + $inexactMatch = AmlCompoundConfidence::from($inexactMatch); + } + + $this->fields['inexactMatch'] = $inexactMatch; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('exactMatch', $this->fields)) { + $data['exactMatch'] = $this->fields['exactMatch']?->jsonSerialize(); + } + if (array_key_exists('inexactMatch', $this->fields)) { + $data['inexactMatch'] = $this->fields['inexactMatch']?->jsonSerialize(); + } + + return $data; + } +} diff --git a/src/Model/AmlSettingsConfidenceInexactYobExactMatch.php b/src/Model/AmlSettingsConfidenceInexactYobExactMatch.php deleted file mode 100644 index 4f1b0cf85..000000000 --- a/src/Model/AmlSettingsConfidenceInexactYobExactMatch.php +++ /dev/null @@ -1,91 +0,0 @@ -setMatchingCountry($data['matchingCountry']); - } - if (array_key_exists('mismatchingCountry', $data)) { - $this->setMismatchingCountry($data['mismatchingCountry']); - } - if (array_key_exists('noCountry', $data)) { - $this->setNoCountry($data['noCountry']); - } - } - - public static function from(array $data = []): self - { - return new self($data); - } - - public function getMatchingCountry(): ?string - { - return $this->fields['matchingCountry'] ?? null; - } - - public function setMatchingCountry(null|string $matchingCountry): static - { - $this->fields['matchingCountry'] = $matchingCountry; - - return $this; - } - - public function getMismatchingCountry(): ?string - { - return $this->fields['mismatchingCountry'] ?? null; - } - - public function setMismatchingCountry(null|string $mismatchingCountry): static - { - $this->fields['mismatchingCountry'] = $mismatchingCountry; - - return $this; - } - - public function getNoCountry(): ?string - { - return $this->fields['noCountry'] ?? null; - } - - public function setNoCountry(null|string $noCountry): static - { - $this->fields['noCountry'] = $noCountry; - - return $this; - } - - public function jsonSerialize(): array - { - $data = []; - if (array_key_exists('matchingCountry', $this->fields)) { - $data['matchingCountry'] = $this->fields['matchingCountry']; - } - if (array_key_exists('mismatchingCountry', $this->fields)) { - $data['mismatchingCountry'] = $this->fields['mismatchingCountry']; - } - if (array_key_exists('noCountry', $this->fields)) { - $data['noCountry'] = $this->fields['noCountry']; - } - - return $data; - } -} diff --git a/src/Model/AmlSettingsConfidenceInexactYobInexactMatch.php b/src/Model/AmlSettingsConfidenceInexactYobInexactMatch.php deleted file mode 100644 index 41f5a8669..000000000 --- a/src/Model/AmlSettingsConfidenceInexactYobInexactMatch.php +++ /dev/null @@ -1,91 +0,0 @@ -setMatchingCountry($data['matchingCountry']); - } - if (array_key_exists('mismatchingCountry', $data)) { - $this->setMismatchingCountry($data['mismatchingCountry']); - } - if (array_key_exists('noCountry', $data)) { - $this->setNoCountry($data['noCountry']); - } - } - - public static function from(array $data = []): self - { - return new self($data); - } - - public function getMatchingCountry(): ?string - { - return $this->fields['matchingCountry'] ?? null; - } - - public function setMatchingCountry(null|string $matchingCountry): static - { - $this->fields['matchingCountry'] = $matchingCountry; - - return $this; - } - - public function getMismatchingCountry(): ?string - { - return $this->fields['mismatchingCountry'] ?? null; - } - - public function setMismatchingCountry(null|string $mismatchingCountry): static - { - $this->fields['mismatchingCountry'] = $mismatchingCountry; - - return $this; - } - - public function getNoCountry(): ?string - { - return $this->fields['noCountry'] ?? null; - } - - public function setNoCountry(null|string $noCountry): static - { - $this->fields['noCountry'] = $noCountry; - - return $this; - } - - public function jsonSerialize(): array - { - $data = []; - if (array_key_exists('matchingCountry', $this->fields)) { - $data['matchingCountry'] = $this->fields['matchingCountry']; - } - if (array_key_exists('mismatchingCountry', $this->fields)) { - $data['mismatchingCountry'] = $this->fields['mismatchingCountry']; - } - if (array_key_exists('noCountry', $this->fields)) { - $data['noCountry'] = $this->fields['noCountry']; - } - - return $data; - } -} diff --git a/src/Model/AmlSettingsConfidenceNoDob.php b/src/Model/AmlSettingsConfidenceNoDob.php new file mode 100644 index 000000000..ea4a3788a --- /dev/null +++ b/src/Model/AmlSettingsConfidenceNoDob.php @@ -0,0 +1,103 @@ +setExactMatch($data['exactMatch']); + } + if (array_key_exists('inexactMatch', $data)) { + $this->setInexactMatch($data['inexactMatch']); + } + if (array_key_exists('weakMatch', $data)) { + $this->setWeakMatch($data['weakMatch']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getExactMatch(): ?AmlCompoundConfidence + { + return $this->fields['exactMatch'] ?? null; + } + + public function setExactMatch(null|AmlCompoundConfidence|array $exactMatch): static + { + if ($exactMatch !== null && !($exactMatch instanceof AmlCompoundConfidence)) { + $exactMatch = AmlCompoundConfidence::from($exactMatch); + } + + $this->fields['exactMatch'] = $exactMatch; + + return $this; + } + + public function getInexactMatch(): ?AmlCompoundConfidence + { + return $this->fields['inexactMatch'] ?? null; + } + + public function setInexactMatch(null|AmlCompoundConfidence|array $inexactMatch): static + { + if ($inexactMatch !== null && !($inexactMatch instanceof AmlCompoundConfidence)) { + $inexactMatch = AmlCompoundConfidence::from($inexactMatch); + } + + $this->fields['inexactMatch'] = $inexactMatch; + + return $this; + } + + public function getWeakMatch(): ?AmlCompoundConfidence + { + return $this->fields['weakMatch'] ?? null; + } + + public function setWeakMatch(null|AmlCompoundConfidence|array $weakMatch): static + { + if ($weakMatch !== null && !($weakMatch instanceof AmlCompoundConfidence)) { + $weakMatch = AmlCompoundConfidence::from($weakMatch); + } + + $this->fields['weakMatch'] = $weakMatch; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('exactMatch', $this->fields)) { + $data['exactMatch'] = $this->fields['exactMatch']?->jsonSerialize(); + } + if (array_key_exists('inexactMatch', $this->fields)) { + $data['inexactMatch'] = $this->fields['inexactMatch']?->jsonSerialize(); + } + if (array_key_exists('weakMatch', $this->fields)) { + $data['weakMatch'] = $this->fields['weakMatch']?->jsonSerialize(); + } + + return $data; + } +} diff --git a/src/Model/AmlSettingsConfidenceNoDobExactMatch.php b/src/Model/AmlSettingsConfidenceNoDobExactMatch.php deleted file mode 100644 index b92c9396c..000000000 --- a/src/Model/AmlSettingsConfidenceNoDobExactMatch.php +++ /dev/null @@ -1,91 +0,0 @@ -setMatchingCountry($data['matchingCountry']); - } - if (array_key_exists('mismatchingCountry', $data)) { - $this->setMismatchingCountry($data['mismatchingCountry']); - } - if (array_key_exists('noCountry', $data)) { - $this->setNoCountry($data['noCountry']); - } - } - - public static function from(array $data = []): self - { - return new self($data); - } - - public function getMatchingCountry(): ?string - { - return $this->fields['matchingCountry'] ?? null; - } - - public function setMatchingCountry(null|string $matchingCountry): static - { - $this->fields['matchingCountry'] = $matchingCountry; - - return $this; - } - - public function getMismatchingCountry(): ?string - { - return $this->fields['mismatchingCountry'] ?? null; - } - - public function setMismatchingCountry(null|string $mismatchingCountry): static - { - $this->fields['mismatchingCountry'] = $mismatchingCountry; - - return $this; - } - - public function getNoCountry(): ?string - { - return $this->fields['noCountry'] ?? null; - } - - public function setNoCountry(null|string $noCountry): static - { - $this->fields['noCountry'] = $noCountry; - - return $this; - } - - public function jsonSerialize(): array - { - $data = []; - if (array_key_exists('matchingCountry', $this->fields)) { - $data['matchingCountry'] = $this->fields['matchingCountry']; - } - if (array_key_exists('mismatchingCountry', $this->fields)) { - $data['mismatchingCountry'] = $this->fields['mismatchingCountry']; - } - if (array_key_exists('noCountry', $this->fields)) { - $data['noCountry'] = $this->fields['noCountry']; - } - - return $data; - } -} diff --git a/src/Model/AmlSettingsConfidenceNoDobInexactMatch.php b/src/Model/AmlSettingsConfidenceNoDobInexactMatch.php deleted file mode 100644 index 135aee854..000000000 --- a/src/Model/AmlSettingsConfidenceNoDobInexactMatch.php +++ /dev/null @@ -1,91 +0,0 @@ -setMatchingCountry($data['matchingCountry']); - } - if (array_key_exists('mismatchingCountry', $data)) { - $this->setMismatchingCountry($data['mismatchingCountry']); - } - if (array_key_exists('noCountry', $data)) { - $this->setNoCountry($data['noCountry']); - } - } - - public static function from(array $data = []): self - { - return new self($data); - } - - public function getMatchingCountry(): ?string - { - return $this->fields['matchingCountry'] ?? null; - } - - public function setMatchingCountry(null|string $matchingCountry): static - { - $this->fields['matchingCountry'] = $matchingCountry; - - return $this; - } - - public function getMismatchingCountry(): ?string - { - return $this->fields['mismatchingCountry'] ?? null; - } - - public function setMismatchingCountry(null|string $mismatchingCountry): static - { - $this->fields['mismatchingCountry'] = $mismatchingCountry; - - return $this; - } - - public function getNoCountry(): ?string - { - return $this->fields['noCountry'] ?? null; - } - - public function setNoCountry(null|string $noCountry): static - { - $this->fields['noCountry'] = $noCountry; - - return $this; - } - - public function jsonSerialize(): array - { - $data = []; - if (array_key_exists('matchingCountry', $this->fields)) { - $data['matchingCountry'] = $this->fields['matchingCountry']; - } - if (array_key_exists('mismatchingCountry', $this->fields)) { - $data['mismatchingCountry'] = $this->fields['mismatchingCountry']; - } - if (array_key_exists('noCountry', $this->fields)) { - $data['noCountry'] = $this->fields['noCountry']; - } - - return $data; - } -} diff --git a/src/Model/AmlSettingsConfidenceNoDobWeakMatch.php b/src/Model/AmlSettingsConfidenceNoDobWeakMatch.php deleted file mode 100644 index 58dbf53b8..000000000 --- a/src/Model/AmlSettingsConfidenceNoDobWeakMatch.php +++ /dev/null @@ -1,91 +0,0 @@ -setMatchingCountry($data['matchingCountry']); - } - if (array_key_exists('mismatchingCountry', $data)) { - $this->setMismatchingCountry($data['mismatchingCountry']); - } - if (array_key_exists('noCountry', $data)) { - $this->setNoCountry($data['noCountry']); - } - } - - public static function from(array $data = []): self - { - return new self($data); - } - - public function getMatchingCountry(): ?string - { - return $this->fields['matchingCountry'] ?? null; - } - - public function setMatchingCountry(null|string $matchingCountry): static - { - $this->fields['matchingCountry'] = $matchingCountry; - - return $this; - } - - public function getMismatchingCountry(): ?string - { - return $this->fields['mismatchingCountry'] ?? null; - } - - public function setMismatchingCountry(null|string $mismatchingCountry): static - { - $this->fields['mismatchingCountry'] = $mismatchingCountry; - - return $this; - } - - public function getNoCountry(): ?string - { - return $this->fields['noCountry'] ?? null; - } - - public function setNoCountry(null|string $noCountry): static - { - $this->fields['noCountry'] = $noCountry; - - return $this; - } - - public function jsonSerialize(): array - { - $data = []; - if (array_key_exists('matchingCountry', $this->fields)) { - $data['matchingCountry'] = $this->fields['matchingCountry']; - } - if (array_key_exists('mismatchingCountry', $this->fields)) { - $data['mismatchingCountry'] = $this->fields['mismatchingCountry']; - } - if (array_key_exists('noCountry', $this->fields)) { - $data['noCountry'] = $this->fields['noCountry']; - } - - return $data; - } -} diff --git a/src/Model/AmlSettingsConfidenceYob.php b/src/Model/AmlSettingsConfidenceYob.php new file mode 100644 index 000000000..75c23ca1b --- /dev/null +++ b/src/Model/AmlSettingsConfidenceYob.php @@ -0,0 +1,81 @@ +setExactMatch($data['exactMatch']); + } + if (array_key_exists('inexactMatch', $data)) { + $this->setInexactMatch($data['inexactMatch']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getExactMatch(): ?AmlCompoundConfidence + { + return $this->fields['exactMatch'] ?? null; + } + + public function setExactMatch(null|AmlCompoundConfidence|array $exactMatch): static + { + if ($exactMatch !== null && !($exactMatch instanceof AmlCompoundConfidence)) { + $exactMatch = AmlCompoundConfidence::from($exactMatch); + } + + $this->fields['exactMatch'] = $exactMatch; + + return $this; + } + + public function getInexactMatch(): ?AmlCompoundConfidence + { + return $this->fields['inexactMatch'] ?? null; + } + + public function setInexactMatch(null|AmlCompoundConfidence|array $inexactMatch): static + { + if ($inexactMatch !== null && !($inexactMatch instanceof AmlCompoundConfidence)) { + $inexactMatch = AmlCompoundConfidence::from($inexactMatch); + } + + $this->fields['inexactMatch'] = $inexactMatch; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('exactMatch', $this->fields)) { + $data['exactMatch'] = $this->fields['exactMatch']?->jsonSerialize(); + } + if (array_key_exists('inexactMatch', $this->fields)) { + $data['inexactMatch'] = $this->fields['inexactMatch']?->jsonSerialize(); + } + + return $data; + } +} diff --git a/src/Model/Awepay.php b/src/Model/Awepay.php index 3184a5d85..97bbbcf16 100644 --- a/src/Model/Awepay.php +++ b/src/Model/Awepay.php @@ -26,6 +26,9 @@ public function __construct(array $data = []) if (array_key_exists('credentials', $data)) { $this->setCredentials($data['credentials']); } + if (array_key_exists('settings', $data)) { + $this->setSettings($data['settings']); + } } public static function from(array $data = []): self @@ -49,12 +52,31 @@ public function setCredentials(AwepayCredentials|array $credentials): static return $this; } + public function getSettings(): ?AwepaySettings + { + return $this->fields['settings'] ?? null; + } + + public function setSettings(null|AwepaySettings|array $settings): static + { + if ($settings !== null && !($settings instanceof AwepaySettings)) { + $settings = AwepaySettings::from($settings); + } + + $this->fields['settings'] = $settings; + + return $this; + } + public function jsonSerialize(): array { $data = []; if (array_key_exists('credentials', $this->fields)) { $data['credentials'] = $this->fields['credentials']?->jsonSerialize(); } + if (array_key_exists('settings', $this->fields)) { + $data['settings'] = $this->fields['settings']?->jsonSerialize(); + } return parent::jsonSerialize() + $data; } diff --git a/src/Model/AwepayCredentials.php b/src/Model/AwepayCredentials.php index a46205b6b..daf8b45c4 100644 --- a/src/Model/AwepayCredentials.php +++ b/src/Model/AwepayCredentials.php @@ -27,6 +27,9 @@ public function __construct(array $data = []) if (array_key_exists('rcode', $data)) { $this->setRcode($data['rcode']); } + if (array_key_exists('secretKey', $data)) { + $this->setSecretKey($data['secretKey']); + } } public static function from(array $data = []): self @@ -58,6 +61,18 @@ public function setRcode(string $rcode): static return $this; } + public function getSecretKey(): ?string + { + return $this->fields['secretKey'] ?? null; + } + + public function setSecretKey(null|string $secretKey): static + { + $this->fields['secretKey'] = $secretKey; + + return $this; + } + public function jsonSerialize(): array { $data = []; @@ -67,6 +82,9 @@ public function jsonSerialize(): array if (array_key_exists('rcode', $this->fields)) { $data['rcode'] = $this->fields['rcode']; } + if (array_key_exists('secretKey', $this->fields)) { + $data['secretKey'] = $this->fields['secretKey']; + } return $data; } diff --git a/src/Model/AwepaySettings.php b/src/Model/AwepaySettings.php new file mode 100644 index 000000000..f9ea25dbe --- /dev/null +++ b/src/Model/AwepaySettings.php @@ -0,0 +1,55 @@ +setUseP2pRest($data['useP2pRest']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getUseP2pRest(): ?bool + { + return $this->fields['useP2pRest'] ?? null; + } + + public function setUseP2pRest(null|bool $useP2pRest): static + { + $this->fields['useP2pRest'] = $useP2pRest; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('useP2pRest', $this->fields)) { + $data['useP2pRest'] = $this->fields['useP2pRest']; + } + + return $data; + } +} diff --git a/src/Model/DepositRequest.php b/src/Model/DepositRequest.php index 822377fab..83222cee1 100644 --- a/src/Model/DepositRequest.php +++ b/src/Model/DepositRequest.php @@ -23,6 +23,8 @@ class DepositRequest implements JsonSerializable public const STATUS_PENDING = 'pending'; + public const STATUS_INITIATED = 'initiated'; + public const STATUS_COMPLETED = 'completed'; public const STATUS_EXPIRED = 'expired'; @@ -43,6 +45,9 @@ public function __construct(array $data = []) if (array_key_exists('transactionId', $data)) { $this->setTransactionId($data['transactionId']); } + if (array_key_exists('transactionIds', $data)) { + $this->setTransactionIds($data['transactionIds']); + } if (array_key_exists('status', $data)) { $this->setStatus($data['status']); } @@ -67,6 +72,9 @@ public function __construct(array $data = []) if (array_key_exists('properties', $data)) { $this->setProperties($data['properties']); } + if (array_key_exists('notificationUrl', $data)) { + $this->setNotificationUrl($data['notificationUrl']); + } if (array_key_exists('createdTime', $data)) { $this->setCreatedTime($data['createdTime']); } @@ -120,6 +128,24 @@ public function getTransactionId(): ?string return $this->fields['transactionId'] ?? null; } + /** + * @return null|string[] + */ + public function getTransactionIds(): ?array + { + return $this->fields['transactionIds'] ?? null; + } + + /** + * @param null|string[] $transactionIds + */ + public function setTransactionIds(null|array $transactionIds): static + { + $this->fields['transactionIds'] = $transactionIds; + + return $this; + } + public function getStatus(): ?string { return $this->fields['status'] ?? null; @@ -212,6 +238,18 @@ public function getProperties(): ?array return $this->fields['properties'] ?? null; } + public function getNotificationUrl(): ?string + { + return $this->fields['notificationUrl'] ?? null; + } + + public function setNotificationUrl(null|string $notificationUrl): static + { + $this->fields['notificationUrl'] = $notificationUrl; + + return $this; + } + public function getCreatedTime(): ?DateTimeImmutable { return $this->fields['createdTime'] ?? null; @@ -261,6 +299,9 @@ public function jsonSerialize(): array if (array_key_exists('transactionId', $this->fields)) { $data['transactionId'] = $this->fields['transactionId']; } + if (array_key_exists('transactionIds', $this->fields)) { + $data['transactionIds'] = $this->fields['transactionIds']; + } if (array_key_exists('status', $this->fields)) { $data['status'] = $this->fields['status']; } @@ -285,6 +326,9 @@ public function jsonSerialize(): array if (array_key_exists('properties', $this->fields)) { $data['properties'] = $this->fields['properties']; } + if (array_key_exists('notificationUrl', $this->fields)) { + $data['notificationUrl'] = $this->fields['notificationUrl']; + } if (array_key_exists('createdTime', $this->fields)) { $data['createdTime'] = $this->fields['createdTime']?->format(DateTimeInterface::RFC3339); } diff --git a/src/Model/DepositRequestEmbedded.php b/src/Model/DepositRequestEmbedded.php index bc202716c..b1002f7b9 100644 --- a/src/Model/DepositRequestEmbedded.php +++ b/src/Model/DepositRequestEmbedded.php @@ -27,8 +27,8 @@ public function __construct(array $data = []) if (array_key_exists('website', $data)) { $this->setWebsite($data['website']); } - if (array_key_exists('transaction', $data)) { - $this->setTransaction($data['transaction']); + if (array_key_exists('transactions', $data)) { + $this->setTransactions($data['transactions']); } } @@ -61,14 +61,14 @@ public function setWebsite(null|object $website): static return $this; } - public function getTransaction(): ?object + public function getTransactions(): ?array { - return $this->fields['transaction'] ?? null; + return $this->fields['transactions'] ?? null; } - public function setTransaction(null|object $transaction): static + public function setTransactions(null|array $transactions): static { - $this->fields['transaction'] = $transaction; + $this->fields['transactions'] = $transactions; return $this; } @@ -82,8 +82,8 @@ public function jsonSerialize(): array if (array_key_exists('website', $this->fields)) { $data['website'] = $this->fields['website']; } - if (array_key_exists('transaction', $this->fields)) { - $data['transaction'] = $this->fields['transaction']; + if (array_key_exists('transactions', $this->fields)) { + $data['transactions'] = $this->fields['transactions']; } return $data; diff --git a/src/Model/DepositStrategy.php b/src/Model/DepositStrategy.php index 48d022d9e..06734a043 100644 --- a/src/Model/DepositStrategy.php +++ b/src/Model/DepositStrategy.php @@ -99,15 +99,15 @@ public function setAmounts(DepositStrategyAmounts|array $amounts): static return $this; } - public function getCustomAmount(): DepositRequestCustomAmount + public function getCustomAmount(): PostDepositRequestCustomAmount { return $this->fields['customAmount']; } - public function setCustomAmount(DepositRequestCustomAmount|array $customAmount): static + public function setCustomAmount(PostDepositRequestCustomAmount|array $customAmount): static { - if (!($customAmount instanceof DepositRequestCustomAmount)) { - $customAmount = DepositRequestCustomAmount::from($customAmount); + if (!($customAmount instanceof PostDepositRequestCustomAmount)) { + $customAmount = PostDepositRequestCustomAmount::from($customAmount); } $this->fields['customAmount'] = $customAmount; diff --git a/src/Model/Dispute.php b/src/Model/Dispute.php index fe89740d3..0628c9be9 100644 --- a/src/Model/Dispute.php +++ b/src/Model/Dispute.php @@ -19,334 +19,6 @@ class Dispute implements JsonSerializable { - public const REASON_CODE__1000 = '1000'; - - public const REASON_CODE__10_1 = '10.1'; - - public const REASON_CODE__10_2 = '10.2'; - - public const REASON_CODE__10_3 = '10.3'; - - public const REASON_CODE__10_4 = '10.4'; - - public const REASON_CODE__10_5 = '10.5'; - - public const REASON_CODE__11_1 = '11.1'; - - public const REASON_CODE__11_2 = '11.2'; - - public const REASON_CODE__11_3 = '11.3'; - - public const REASON_CODE__12 = '12'; - - public const REASON_CODE__12_1 = '12.1'; - - public const REASON_CODE__12_2 = '12.2'; - - public const REASON_CODE__12_3 = '12.3'; - - public const REASON_CODE__12_4 = '12.4'; - - public const REASON_CODE__12_5 = '12.5'; - - public const REASON_CODE__12_6 = '12.6'; - - public const REASON_CODE__12_7 = '12.7'; - - public const REASON_CODE__13_1 = '13.1'; - - public const REASON_CODE__13_2 = '13.2'; - - public const REASON_CODE__13_3 = '13.3'; - - public const REASON_CODE__13_4 = '13.4'; - - public const REASON_CODE__13_5 = '13.5'; - - public const REASON_CODE__13_6 = '13.6'; - - public const REASON_CODE__13_7 = '13.7'; - - public const REASON_CODE__13_8 = '13.8'; - - public const REASON_CODE__13_9 = '13.9'; - - public const REASON_CODE__30 = '30'; - - public const REASON_CODE__31 = '31'; - - public const REASON_CODE__35 = '35'; - - public const REASON_CODE__37 = '37'; - - public const REASON_CODE__40 = '40'; - - public const REASON_CODE__41 = '41'; - - public const REASON_CODE__42 = '42'; - - public const REASON_CODE__46 = '46'; - - public const REASON_CODE__47 = '47'; - - public const REASON_CODE__49 = '49'; - - public const REASON_CODE__50 = '50'; - - public const REASON_CODE__53 = '53'; - - public const REASON_CODE__54 = '54'; - - public const REASON_CODE__55 = '55'; - - public const REASON_CODE__57 = '57'; - - public const REASON_CODE__59 = '59'; - - public const REASON_CODE__60 = '60'; - - public const REASON_CODE__62 = '62'; - - public const REASON_CODE__70 = '70'; - - public const REASON_CODE__71 = '71'; - - public const REASON_CODE__72 = '72'; - - public const REASON_CODE__73 = '73'; - - public const REASON_CODE__74 = '74'; - - public const REASON_CODE__75 = '75'; - - public const REASON_CODE__76 = '76'; - - public const REASON_CODE__77 = '77'; - - public const REASON_CODE__79 = '79'; - - public const REASON_CODE__80 = '80'; - - public const REASON_CODE__81 = '81'; - - public const REASON_CODE__82 = '82'; - - public const REASON_CODE__83 = '83'; - - public const REASON_CODE__85 = '85'; - - public const REASON_CODE__86 = '86'; - - public const REASON_CODE__93 = '93'; - - public const REASON_CODE__00 = '00'; - - public const REASON_CODE__63 = '63'; - - public const REASON_CODE_A01 = 'A01'; - - public const REASON_CODE_A02 = 'A02'; - - public const REASON_CODE_A08 = 'A08'; - - public const REASON_CODE_F10 = 'F10'; - - public const REASON_CODE_F14 = 'F14'; - - public const REASON_CODE_F22 = 'F22'; - - public const REASON_CODE_F24 = 'F24'; - - public const REASON_CODE_F29 = 'F29'; - - public const REASON_CODE_C02 = 'C02'; - - public const REASON_CODE_C04 = 'C04'; - - public const REASON_CODE_C05 = 'C05'; - - public const REASON_CODE_C08 = 'C08'; - - public const REASON_CODE_C14 = 'C14'; - - public const REASON_CODE_C18 = 'C18'; - - public const REASON_CODE_C28 = 'C28'; - - public const REASON_CODE_C31 = 'C31'; - - public const REASON_CODE_C32 = 'C32'; - - public const REASON_CODE_M10 = 'M10'; - - public const REASON_CODE_M49 = 'M49'; - - public const REASON_CODE_P01 = 'P01'; - - public const REASON_CODE_P03 = 'P03'; - - public const REASON_CODE_P04 = 'P04'; - - public const REASON_CODE_P05 = 'P05'; - - public const REASON_CODE_P07 = 'P07'; - - public const REASON_CODE_P08 = 'P08'; - - public const REASON_CODE_P22 = 'P22'; - - public const REASON_CODE_P23 = 'P23'; - - public const REASON_CODE_R03 = 'R03'; - - public const REASON_CODE_R13 = 'R13'; - - public const REASON_CODE_M01 = 'M01'; - - public const REASON_CODE_FR1 = 'FR1'; - - public const REASON_CODE_FR4 = 'FR4'; - - public const REASON_CODE_FR6 = 'FR6'; - - public const REASON_CODE_AL = 'AL'; - - public const REASON_CODE_AP = 'AP'; - - public const REASON_CODE_AW = 'AW'; - - public const REASON_CODE_CA = 'CA'; - - public const REASON_CODE_CD = 'CD'; - - public const REASON_CODE_CR = 'CR'; - - public const REASON_CODE_DA = 'DA'; - - public const REASON_CODE_DP = 'DP'; - - public const REASON_CODE_DP1 = 'DP1'; - - public const REASON_CODE_EX = 'EX'; - - public const REASON_CODE_IC = 'IC'; - - public const REASON_CODE_IN = 'IN'; - - public const REASON_CODE_IS = 'IS'; - - public const REASON_CODE_LP = 'LP'; - - public const REASON_CODE_N = 'N'; - - public const REASON_CODE_NA = 'NA'; - - public const REASON_CODE_NC = 'NC'; - - public const REASON_CODE_P = 'P'; - - public const REASON_CODE_RG = 'RG'; - - public const REASON_CODE_RM = 'RM'; - - public const REASON_CODE_RN1 = 'RN1'; - - public const REASON_CODE_RN2 = 'RN2'; - - public const REASON_CODE_SV = 'SV'; - - public const REASON_CODE_TF = 'TF'; - - public const REASON_CODE_TNM = 'TNM'; - - public const REASON_CODE_UA01 = 'UA01'; - - public const REASON_CODE_UA02 = 'UA02'; - - public const REASON_CODE_UA32 = 'UA32'; - - public const REASON_CODE_UA99 = 'UA99'; - - public const REASON_CODE_UA03 = 'UA03'; - - public const REASON_CODE_UA10 = 'UA10'; - - public const REASON_CODE_UA11 = 'UA11'; - - public const REASON_CODE_UA12 = 'UA12'; - - public const REASON_CODE_UA18 = 'UA18'; - - public const REASON_CODE_UA20 = 'UA20'; - - public const REASON_CODE_UA21 = 'UA21'; - - public const REASON_CODE_UA22 = 'UA22'; - - public const REASON_CODE_UA23 = 'UA23'; - - public const REASON_CODE_UA28 = 'UA28'; - - public const REASON_CODE_UA30 = 'UA30'; - - public const REASON_CODE_UA31 = 'UA31'; - - public const REASON_CODE_UA38 = 'UA38'; - - public const REASON_CODE_DUPLICATE = 'duplicate'; - - public const REASON_CODE_FRAUDULENT = 'fraudulent'; - - public const REASON_CODE_SUBSCRIPTION_CANCELED = 'subscription_canceled'; - - public const REASON_CODE_PRODUCT_UNACCEPTABLE = 'product_unacceptable'; - - public const REASON_CODE_PRODUCT_NOT_RECEIVED = 'product_not_received'; - - public const REASON_CODE_UNRECOGNIZED = 'unrecognized'; - - public const REASON_CODE_CREDIT_NOT_PROCESSED = 'credit_not_processed'; - - public const REASON_CODE_CUSTOMER_INITIATED = 'customer_initiated'; - - public const REASON_CODE_INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details'; - - public const REASON_CODE_INSUFFICIENT_FUNDS = 'insufficient_funds'; - - public const REASON_CODE_BANK_CANNOT_PROCESS = 'bank_cannot_process'; - - public const REASON_CODE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized'; - - public const REASON_CODE_GENERAL = 'general'; - - public const REASON_CODE_PRE_CHARGEBACK_ALERT = 'pre-chargeback-alert'; - - public const REASON_CODE__0 = '0'; - - public const REASON_CODE__1 = '1'; - - public const REASON_CODE__2 = '2'; - - public const REASON_CODE__3 = '3'; - - public const REASON_CODE__4 = '4'; - - public const REASON_CODE__5 = '5'; - - public const REASON_CODE__6 = '6'; - - public const REASON_CODE__7 = '7'; - - public const REASON_CODE__8 = '8'; - - public const REASON_CODE__9 = '9'; - - public const REASON_CODE__51 = '51'; - - public const REASON_CODE_A = 'A'; - - public const REASON_CODE_B = 'B'; - public const CATEGORY_FRAUD = 'fraud'; public const CATEGORY_AUTHORIZATION = 'authorization'; @@ -471,36 +143,36 @@ public function getCustomerId(): ?string return $this->fields['customerId'] ?? null; } - public function getTransactionId(): string + public function getTransactionId(): ?string { - return $this->fields['transactionId']; + return $this->fields['transactionId'] ?? null; } - public function setTransactionId(string $transactionId): static + public function setTransactionId(null|string $transactionId): static { $this->fields['transactionId'] = $transactionId; return $this; } - public function getCurrency(): string + public function getCurrency(): ?string { - return $this->fields['currency']; + return $this->fields['currency'] ?? null; } - public function setCurrency(string $currency): static + public function setCurrency(null|string $currency): static { $this->fields['currency'] = $currency; return $this; } - public function getAmount(): float + public function getAmount(): ?float { - return $this->fields['amount']; + return $this->fields['amount'] ?? null; } - public function setAmount(float|string $amount): static + public function setAmount(null|float|string $amount): static { if (is_string($amount)) { $amount = (float) $amount; @@ -535,12 +207,12 @@ public function setCaseId(null|string $caseId): static return $this; } - public function getReasonCode(): string + public function getReasonCode(): ?string { - return $this->fields['reasonCode']; + return $this->fields['reasonCode'] ?? null; } - public function setReasonCode(string $reasonCode): static + public function setReasonCode(null|string $reasonCode): static { $this->fields['reasonCode'] = $reasonCode; @@ -557,38 +229,38 @@ public function getCategory(): ?string return $this->fields['category'] ?? null; } - public function getType(): string + public function getType(): ?string { - return $this->fields['type']; + return $this->fields['type'] ?? null; } - public function setType(string $type): static + public function setType(null|string $type): static { $this->fields['type'] = $type; return $this; } - public function getStatus(): string + public function getStatus(): ?string { - return $this->fields['status']; + return $this->fields['status'] ?? null; } - public function setStatus(string $status): static + public function setStatus(null|string $status): static { $this->fields['status'] = $status; return $this; } - public function getPostedTime(): DateTimeImmutable + public function getPostedTime(): ?DateTimeImmutable { - return $this->fields['postedTime']; + return $this->fields['postedTime'] ?? null; } - public function setPostedTime(DateTimeImmutable|string $postedTime): static + public function setPostedTime(null|DateTimeImmutable|string $postedTime): static { - if (!($postedTime instanceof DateTimeImmutable)) { + if ($postedTime !== null && !($postedTime instanceof DateTimeImmutable)) { $postedTime = new DateTimeImmutable($postedTime); } diff --git a/src/Model/GatewayAccount.php b/src/Model/GatewayAccount.php index b71f3b965..09214b885 100644 --- a/src/Model/GatewayAccount.php +++ b/src/Model/GatewayAccount.php @@ -78,6 +78,9 @@ protected function __construct(array $data = []) if (array_key_exists('dccForceCurrency', $data)) { $this->setDccForceCurrency($data['dccForceCurrency']); } + if (array_key_exists('dccForceRounding', $data)) { + $this->setDccForceRounding($data['dccForceRounding']); + } if (array_key_exists('descriptor', $data)) { $this->setDescriptor($data['descriptor']); } @@ -657,6 +660,18 @@ public function setDccForceCurrency(null|string $dccForceCurrency): static return $this; } + public function getDccForceRounding(): ?bool + { + return $this->fields['dccForceRounding'] ?? null; + } + + public function setDccForceRounding(null|bool $dccForceRounding): static + { + $this->fields['dccForceRounding'] = $dccForceRounding; + + return $this; + } + public function getDescriptor(): ?string { return $this->fields['descriptor'] ?? null; @@ -936,6 +951,9 @@ public function jsonSerialize(): array if (array_key_exists('dccForceCurrency', $this->fields)) { $data['dccForceCurrency'] = $this->fields['dccForceCurrency']; } + if (array_key_exists('dccForceRounding', $this->fields)) { + $data['dccForceRounding'] = $this->fields['dccForceRounding']; + } if (array_key_exists('descriptor', $this->fields)) { $data['descriptor'] = $this->fields['descriptor']; } diff --git a/src/Model/Invoice.php b/src/Model/Invoice.php index f60fb5305..ffcb45f39 100644 --- a/src/Model/Invoice.php +++ b/src/Model/Invoice.php @@ -21,6 +21,8 @@ class Invoice implements JsonSerializable { public const STATUS_DRAFT = 'draft'; + public const STATUS_QUOTATION = 'quotation'; + public const STATUS_UNPAID = 'unpaid'; public const STATUS_PAID = 'paid'; @@ -71,6 +73,9 @@ public function __construct(array $data = []) if (array_key_exists('subscriptionId', $data)) { $this->setSubscriptionId($data['subscriptionId']); } + if (array_key_exists('quoteId', $data)) { + $this->setQuoteId($data['quoteId']); + } if (array_key_exists('currency', $data)) { $this->setCurrency($data['currency']); } @@ -179,6 +184,9 @@ public function __construct(array $data = []) if (array_key_exists('organizationId', $data)) { $this->setOrganizationId($data['organizationId']); } + if (array_key_exists('delinquencyTime', $data)) { + $this->setDelinquencyTime($data['delinquencyTime']); + } if (array_key_exists('_links', $data)) { $this->setLinks($data['_links']); } @@ -219,6 +227,11 @@ public function getSubscriptionId(): ?string return $this->fields['subscriptionId'] ?? null; } + public function getQuoteId(): ?string + { + return $this->fields['quoteId'] ?? null; + } + public function getCurrency(): string { return $this->fields['currency']; @@ -542,6 +555,22 @@ public function setOrganizationId(null|string $organizationId): static return $this; } + public function getDelinquencyTime(): ?DateTimeImmutable + { + return $this->fields['delinquencyTime'] ?? null; + } + + public function setDelinquencyTime(null|DateTimeImmutable|string $delinquencyTime): static + { + if ($delinquencyTime !== null && !($delinquencyTime instanceof DateTimeImmutable)) { + $delinquencyTime = new DateTimeImmutable($delinquencyTime); + } + + $this->fields['delinquencyTime'] = $delinquencyTime; + + return $this; + } + /** * @return null|ResourceLink[] */ @@ -581,6 +610,9 @@ public function jsonSerialize(): array if (array_key_exists('subscriptionId', $this->fields)) { $data['subscriptionId'] = $this->fields['subscriptionId']; } + if (array_key_exists('quoteId', $this->fields)) { + $data['quoteId'] = $this->fields['quoteId']; + } if (array_key_exists('currency', $this->fields)) { $data['currency'] = $this->fields['currency']; } @@ -689,6 +721,9 @@ public function jsonSerialize(): array if (array_key_exists('organizationId', $this->fields)) { $data['organizationId'] = $this->fields['organizationId']; } + if (array_key_exists('delinquencyTime', $this->fields)) { + $data['delinquencyTime'] = $this->fields['delinquencyTime']?->format(DateTimeInterface::RFC3339); + } if (array_key_exists('_links', $this->fields)) { $data['_links'] = $this->fields['_links']; } @@ -720,6 +755,13 @@ private function setSubscriptionId(null|string $subscriptionId): static return $this; } + private function setQuoteId(null|string $quoteId): static + { + $this->fields['quoteId'] = $quoteId; + + return $this; + } + private function setAmount(null|float|string $amount): static { if (is_string($amount)) { diff --git a/src/Model/KlarnaSettings.php b/src/Model/KlarnaSettings.php index 731c99dd4..69c3d7aab 100644 --- a/src/Model/KlarnaSettings.php +++ b/src/Model/KlarnaSettings.php @@ -30,6 +30,9 @@ public function __construct(array $data = []) if (array_key_exists('region', $data)) { $this->setRegion($data['region']); } + if (array_key_exists('usePayNowStandalone', $data)) { + $this->setUsePayNowStandalone($data['usePayNowStandalone']); + } } public static function from(array $data = []): self @@ -49,12 +52,27 @@ public function setRegion(string $region): static return $this; } + public function getUsePayNowStandalone(): ?bool + { + return $this->fields['usePayNowStandalone'] ?? null; + } + + public function setUsePayNowStandalone(null|bool $usePayNowStandalone): static + { + $this->fields['usePayNowStandalone'] = $usePayNowStandalone; + + return $this; + } + public function jsonSerialize(): array { $data = []; if (array_key_exists('region', $this->fields)) { $data['region'] = $this->fields['region']; } + if (array_key_exists('usePayNowStandalone', $this->fields)) { + $data['usePayNowStandalone'] = $this->fields['usePayNowStandalone']; + } return $data; } diff --git a/src/Model/KycRequestDocument.php b/src/Model/KycRequestDocument.php index 8ca9506a1..e69b3e335 100644 --- a/src/Model/KycRequestDocument.php +++ b/src/Model/KycRequestDocument.php @@ -33,6 +33,9 @@ public function __construct(array $data = []) if (array_key_exists('faceProofRequired', $data)) { $this->setFaceProofRequired($data['faceProofRequired']); } + if (array_key_exists('faceLivenessRequired', $data)) { + $this->setFaceLivenessRequired($data['faceLivenessRequired']); + } } public static function from(array $data = []): self @@ -94,6 +97,18 @@ public function setFaceProofRequired(null|bool $faceProofRequired): static return $this; } + public function getFaceLivenessRequired(): ?bool + { + return $this->fields['faceLivenessRequired'] ?? null; + } + + public function setFaceLivenessRequired(null|bool $faceLivenessRequired): static + { + $this->fields['faceLivenessRequired'] = $faceLivenessRequired; + + return $this; + } + public function jsonSerialize(): array { $data = []; @@ -109,6 +124,9 @@ public function jsonSerialize(): array if (array_key_exists('faceProofRequired', $this->fields)) { $data['faceProofRequired'] = $this->fields['faceProofRequired']; } + if (array_key_exists('faceLivenessRequired', $this->fields)) { + $data['faceLivenessRequired'] = $this->fields['faceLivenessRequired']; + } return $data; } diff --git a/src/Model/OneTimeOrder.php b/src/Model/OneTimeSale.php similarity index 92% rename from src/Model/OneTimeOrder.php rename to src/Model/OneTimeSale.php index 863ef6b0c..76a5a7ad5 100644 --- a/src/Model/OneTimeOrder.php +++ b/src/Model/OneTimeSale.php @@ -17,7 +17,7 @@ use DateTimeInterface; use JsonSerializable; -class OneTimeOrder implements Subscription, JsonSerializable +class OneTimeSale implements SubscriptionOrOneTimeSale, JsonSerializable { public const STATUS_PENDING = 'pending'; @@ -172,6 +172,9 @@ public function __construct(array $data = []) if (array_key_exists('lineItems', $data)) { $this->setLineItems($data['lineItems']); } + if (array_key_exists('delinquencyPeriod', $data)) { + $this->setDelinquencyPeriod($data['delinquencyPeriod']); + } if (array_key_exists('abandonReminderNumber', $data)) { $this->setAbandonReminderNumber($data['abandonReminderNumber']); } @@ -208,6 +211,9 @@ public function __construct(array $data = []) if (array_key_exists('recurringInterval', $data)) { $this->setRecurringInterval($data['recurringInterval']); } + if (array_key_exists('richBillingPortalId', $data)) { + $this->setRichBillingPortalId($data['richBillingPortalId']); + } if (array_key_exists('autopay', $data)) { $this->setAutopay($data['autopay']); } @@ -504,15 +510,15 @@ public function getLinks(): ?array return $this->fields['_links'] ?? null; } - public function getEmbedded(): ?OneTimeOrderEmbedded + public function getEmbedded(): ?OneTimeSaleEmbedded { return $this->fields['_embedded'] ?? null; } - public function setEmbedded(null|OneTimeOrderEmbedded|array $embedded): static + public function setEmbedded(null|OneTimeSaleEmbedded|array $embedded): static { - if ($embedded !== null && !($embedded instanceof OneTimeOrderEmbedded)) { - $embedded = OneTimeOrderEmbedded::from($embedded); + if ($embedded !== null && !($embedded instanceof OneTimeSaleEmbedded)) { + $embedded = OneTimeSaleEmbedded::from($embedded); } $this->fields['_embedded'] = $embedded; @@ -525,15 +531,15 @@ public function getInTrial(): ?bool return $this->fields['inTrial'] ?? null; } - public function getTrial(): ?SubscriptionOrderTrial + public function getTrial(): ?SubscriptionTrial { return $this->fields['trial'] ?? null; } - public function setTrial(null|SubscriptionOrderTrial|array $trial): static + public function setTrial(null|SubscriptionTrial|array $trial): static { - if ($trial !== null && !($trial instanceof SubscriptionOrderTrial)) { - $trial = SubscriptionOrderTrial::from($trial); + if ($trial !== null && !($trial instanceof SubscriptionTrial)) { + $trial = SubscriptionTrial::from($trial); } $this->fields['trial'] = $trial; @@ -542,13 +548,25 @@ public function setTrial(null|SubscriptionOrderTrial|array $trial): static } /** - * @return null|SubscriptionOrderLineItems[] + * @return null|SubscriptionLineItems[] */ public function getLineItems(): ?array { return $this->fields['lineItems'] ?? null; } + public function getDelinquencyPeriod(): ?string + { + return $this->fields['delinquencyPeriod'] ?? null; + } + + public function setDelinquencyPeriod(null|string $delinquencyPeriod): static + { + $this->fields['delinquencyPeriod'] = $delinquencyPeriod; + + return $this; + } + public function getAbandonReminderNumber(): ?int { return $this->fields['abandonReminderNumber'] ?? null; @@ -571,15 +589,15 @@ public function getTrialReminderNumber(): ?int return $this->fields['trialReminderNumber'] ?? null; } - public function getLineItemSubtotal(): ?SubscriptionOrderLineItemSubtotal + public function getLineItemSubtotal(): ?SubscriptionLineItemSubtotal { return $this->fields['lineItemSubtotal'] ?? null; } - public function setLineItemSubtotal(null|SubscriptionOrderLineItemSubtotal|array $lineItemSubtotal): static + public function setLineItemSubtotal(null|SubscriptionLineItemSubtotal|array $lineItemSubtotal): static { - if ($lineItemSubtotal !== null && !($lineItemSubtotal instanceof SubscriptionOrderLineItemSubtotal)) { - $lineItemSubtotal = SubscriptionOrderLineItemSubtotal::from($lineItemSubtotal); + if ($lineItemSubtotal !== null && !($lineItemSubtotal instanceof SubscriptionLineItemSubtotal)) { + $lineItemSubtotal = SubscriptionLineItemSubtotal::from($lineItemSubtotal); } $this->fields['lineItemSubtotal'] = $lineItemSubtotal; @@ -651,15 +669,15 @@ public function setStartTime(null|DateTimeImmutable|string $startTime): static return $this; } - public function getRecurringInterval(): ?SubscriptionOrderRecurringInterval + public function getRecurringInterval(): ?SubscriptionRecurringInterval { return $this->fields['recurringInterval'] ?? null; } - public function setRecurringInterval(null|SubscriptionOrderRecurringInterval|array $recurringInterval): static + public function setRecurringInterval(null|SubscriptionRecurringInterval|array $recurringInterval): static { - if ($recurringInterval !== null && !($recurringInterval instanceof SubscriptionOrderRecurringInterval)) { - $recurringInterval = SubscriptionOrderRecurringInterval::from($recurringInterval); + if ($recurringInterval !== null && !($recurringInterval instanceof SubscriptionRecurringInterval)) { + $recurringInterval = SubscriptionRecurringInterval::from($recurringInterval); } $this->fields['recurringInterval'] = $recurringInterval; @@ -667,6 +685,18 @@ public function setRecurringInterval(null|SubscriptionOrderRecurringInterval|arr return $this; } + public function getRichBillingPortalId(): ?string + { + return $this->fields['richBillingPortalId'] ?? null; + } + + public function setRichBillingPortalId(null|string $richBillingPortalId): static + { + $this->fields['richBillingPortalId'] = $richBillingPortalId; + + return $this; + } + public function getAutopay(): ?bool { return $this->fields['autopay'] ?? null; @@ -812,6 +842,9 @@ public function jsonSerialize(): array if (array_key_exists('lineItems', $this->fields)) { $data['lineItems'] = $this->fields['lineItems']; } + if (array_key_exists('delinquencyPeriod', $this->fields)) { + $data['delinquencyPeriod'] = $this->fields['delinquencyPeriod']; + } if (array_key_exists('abandonReminderNumber', $this->fields)) { $data['abandonReminderNumber'] = $this->fields['abandonReminderNumber']; } @@ -848,6 +881,9 @@ public function jsonSerialize(): array if (array_key_exists('recurringInterval', $this->fields)) { $data['recurringInterval'] = $this->fields['recurringInterval']?->jsonSerialize(); } + if (array_key_exists('richBillingPortalId', $this->fields)) { + $data['richBillingPortalId'] = $this->fields['richBillingPortalId']; + } if (array_key_exists('autopay', $this->fields)) { $data['autopay'] = $this->fields['autopay']; } @@ -982,12 +1018,12 @@ private function setInTrial(null|bool $inTrial): static } /** - * @param null|array[]|SubscriptionOrderLineItems[] $lineItems + * @param null|array[]|SubscriptionLineItems[] $lineItems */ private function setLineItems(null|array $lineItems): static { $lineItems = $lineItems !== null ? array_map( - fn ($value) => $value instanceof SubscriptionOrderLineItems ? $value : SubscriptionOrderLineItems::from($value), + fn ($value) => $value instanceof SubscriptionLineItems ? $value : SubscriptionLineItems::from($value), $lineItems, ) : null; diff --git a/src/Model/OneTimeOrderEmbedded.php b/src/Model/OneTimeSaleEmbedded.php similarity index 98% rename from src/Model/OneTimeOrderEmbedded.php rename to src/Model/OneTimeSaleEmbedded.php index 39f881b38..4e34131f7 100644 --- a/src/Model/OneTimeOrderEmbedded.php +++ b/src/Model/OneTimeSaleEmbedded.php @@ -15,7 +15,7 @@ use JsonSerializable; -class OneTimeOrderEmbedded implements JsonSerializable +class OneTimeSaleEmbedded implements JsonSerializable { private array $fields = []; diff --git a/src/Model/OrderItem.php b/src/Model/OrderItem.php index 653cc36bd..674249d0c 100644 --- a/src/Model/OrderItem.php +++ b/src/Model/OrderItem.php @@ -30,6 +30,9 @@ public function __construct(array $data = []) if (array_key_exists('quantity', $data)) { $this->setQuantity($data['quantity']); } + if (array_key_exists('quantityFilled', $data)) { + $this->setQuantityFilled($data['quantityFilled']); + } if (array_key_exists('plan', $data)) { $this->setPlan($data['plan']); } @@ -84,6 +87,18 @@ public function setQuantity(null|int $quantity): static return $this; } + public function getQuantityFilled(): ?int + { + return $this->fields['quantityFilled'] ?? null; + } + + public function setQuantityFilled(null|int $quantityFilled): static + { + $this->fields['quantityFilled'] = $quantityFilled; + + return $this; + } + public function getPlan(): OrderItemPlan { return $this->fields['plan']; @@ -131,15 +146,15 @@ public function getIsGrandfathered(): ?bool return $this->fields['isGrandfathered'] ?? null; } - public function getEmbedded(): ?QuoteItemsEmbedded + public function getEmbedded(): ?QuoteCreateOrderItemsEmbedded { return $this->fields['_embedded'] ?? null; } - public function setEmbedded(null|QuoteItemsEmbedded|array $embedded): static + public function setEmbedded(null|QuoteCreateOrderItemsEmbedded|array $embedded): static { - if ($embedded !== null && !($embedded instanceof QuoteItemsEmbedded)) { - $embedded = QuoteItemsEmbedded::from($embedded); + if ($embedded !== null && !($embedded instanceof QuoteCreateOrderItemsEmbedded)) { + $embedded = QuoteCreateOrderItemsEmbedded::from($embedded); } $this->fields['_embedded'] = $embedded; @@ -159,6 +174,9 @@ public function jsonSerialize(): array if (array_key_exists('quantity', $this->fields)) { $data['quantity'] = $this->fields['quantity']; } + if (array_key_exists('quantityFilled', $this->fields)) { + $data['quantityFilled'] = $this->fields['quantityFilled']; + } if (array_key_exists('plan', $this->fields)) { $data['plan'] = $this->fields['plan']?->jsonSerialize(); } diff --git a/src/Model/OrderItemUsageLimits.php b/src/Model/OrderItemUsageLimits.php index c5411a9e4..029de4410 100644 --- a/src/Model/OrderItemUsageLimits.php +++ b/src/Model/OrderItemUsageLimits.php @@ -34,15 +34,15 @@ public static function from(array $data = []): self return new self($data); } - public function getSoftLimit(): ?OrderItemUsageLimitsSoftLimit + public function getSoftLimit(): ?QuoteCreateOrderItemsUsageLimitsSoftLimit { return $this->fields['softLimit'] ?? null; } - public function setSoftLimit(null|OrderItemUsageLimitsSoftLimit|array $softLimit): static + public function setSoftLimit(null|QuoteCreateOrderItemsUsageLimitsSoftLimit|array $softLimit): static { - if ($softLimit !== null && !($softLimit instanceof OrderItemUsageLimitsSoftLimit)) { - $softLimit = OrderItemUsageLimitsSoftLimit::from($softLimit); + if ($softLimit !== null && !($softLimit instanceof QuoteCreateOrderItemsUsageLimitsSoftLimit)) { + $softLimit = QuoteCreateOrderItemsUsageLimitsSoftLimit::from($softLimit); } $this->fields['softLimit'] = $softLimit; @@ -50,15 +50,15 @@ public function setSoftLimit(null|OrderItemUsageLimitsSoftLimit|array $softLimit return $this; } - public function getHardLimit(): ?OrderItemUsageLimitsHardLimit + public function getHardLimit(): ?QuoteCreateOrderItemsUsageLimitsHardLimit { return $this->fields['hardLimit'] ?? null; } - public function setHardLimit(null|OrderItemUsageLimitsHardLimit|array $hardLimit): static + public function setHardLimit(null|QuoteCreateOrderItemsUsageLimitsHardLimit|array $hardLimit): static { - if ($hardLimit !== null && !($hardLimit instanceof OrderItemUsageLimitsHardLimit)) { - $hardLimit = OrderItemUsageLimitsHardLimit::from($hardLimit); + if ($hardLimit !== null && !($hardLimit instanceof QuoteCreateOrderItemsUsageLimitsHardLimit)) { + $hardLimit = QuoteCreateOrderItemsUsageLimitsHardLimit::from($hardLimit); } $this->fields['hardLimit'] = $hardLimit; diff --git a/src/Model/PaymentInstrumentCreateToken.php b/src/Model/PaymentInstrumentCreateToken.php index eb407069e..4bbfb1649 100644 --- a/src/Model/PaymentInstrumentCreateToken.php +++ b/src/Model/PaymentInstrumentCreateToken.php @@ -213,6 +213,8 @@ class PaymentInstrumentCreateToken implements PostPaymentInstrumentRequest, Json public const METHOD_PIASTRIX = 'Piastrix'; + public const METHOD_PIX = 'PIX'; + public const METHOD_PAY_TABS = 'PayTabs'; public const METHOD_PAYSAFECARD = 'Paysafecard'; @@ -303,6 +305,8 @@ class PaymentInstrumentCreateToken implements PostPaymentInstrumentRequest, Json public const METHOD_WE_CHAT_PAY = 'WeChat Pay'; + public const METHOD_WIRE = 'wire'; + public const METHOD_X_PAY_P2_P = 'XPay-P2P'; public const METHOD_X_PAY_QR = 'XPay-QR'; diff --git a/src/Model/PostDepositRequest.php b/src/Model/PostDepositRequest.php index f8ccf17f8..1be31733b 100644 --- a/src/Model/PostDepositRequest.php +++ b/src/Model/PostDepositRequest.php @@ -53,6 +53,9 @@ public function __construct(array $data = []) if (array_key_exists('customPropertySetId', $data)) { $this->setCustomPropertySetId($data['customPropertySetId']); } + if (array_key_exists('notificationUrl', $data)) { + $this->setNotificationUrl($data['notificationUrl']); + } } public static function from(array $data = []): self @@ -142,15 +145,15 @@ public function setAmountLimits(null|PostDepositRequestAmountLimits|array $amoun return $this; } - public function getCustomAmount(): ?DepositRequestCustomAmount + public function getCustomAmount(): ?PostDepositRequestCustomAmount { return $this->fields['customAmount'] ?? null; } - public function setCustomAmount(null|DepositRequestCustomAmount|array $customAmount): static + public function setCustomAmount(null|PostDepositRequestCustomAmount|array $customAmount): static { - if ($customAmount !== null && !($customAmount instanceof DepositRequestCustomAmount)) { - $customAmount = DepositRequestCustomAmount::from($customAmount); + if ($customAmount !== null && !($customAmount instanceof PostDepositRequestCustomAmount)) { + $customAmount = PostDepositRequestCustomAmount::from($customAmount); } $this->fields['customAmount'] = $customAmount; @@ -198,6 +201,18 @@ public function setCustomPropertySetId(null|string $customPropertySetId): static return $this; } + public function getNotificationUrl(): ?string + { + return $this->fields['notificationUrl'] ?? null; + } + + public function setNotificationUrl(null|string $notificationUrl): static + { + $this->fields['notificationUrl'] = $notificationUrl; + + return $this; + } + public function jsonSerialize(): array { $data = []; @@ -231,6 +246,9 @@ public function jsonSerialize(): array if (array_key_exists('customPropertySetId', $this->fields)) { $data['customPropertySetId'] = $this->fields['customPropertySetId']; } + if (array_key_exists('notificationUrl', $this->fields)) { + $data['notificationUrl'] = $this->fields['notificationUrl']; + } return $data; } diff --git a/src/Model/PostDepositRequestCustomAmount.php b/src/Model/PostDepositRequestCustomAmount.php new file mode 100644 index 000000000..05854492b --- /dev/null +++ b/src/Model/PostDepositRequestCustomAmount.php @@ -0,0 +1,103 @@ +setMinimum($data['minimum']); + } + if (array_key_exists('multipleOf', $data)) { + $this->setMultipleOf($data['multipleOf']); + } + if (array_key_exists('maximum', $data)) { + $this->setMaximum($data['maximum']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getMinimum(): float + { + return $this->fields['minimum']; + } + + public function setMinimum(float|string $minimum): static + { + if (is_string($minimum)) { + $minimum = (float) $minimum; + } + + $this->fields['minimum'] = $minimum; + + return $this; + } + + public function getMultipleOf(): float + { + return $this->fields['multipleOf']; + } + + public function setMultipleOf(float|string $multipleOf): static + { + if (is_string($multipleOf)) { + $multipleOf = (float) $multipleOf; + } + + $this->fields['multipleOf'] = $multipleOf; + + return $this; + } + + public function getMaximum(): float + { + return $this->fields['maximum']; + } + + public function setMaximum(float|string $maximum): static + { + if (is_string($maximum)) { + $maximum = (float) $maximum; + } + + $this->fields['maximum'] = $maximum; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('minimum', $this->fields)) { + $data['minimum'] = $this->fields['minimum']; + } + if (array_key_exists('multipleOf', $this->fields)) { + $data['multipleOf'] = $this->fields['multipleOf']; + } + if (array_key_exists('maximum', $this->fields)) { + $data['maximum'] = $this->fields['maximum']; + } + + return $data; + } +} diff --git a/src/Model/PostDisputeRequest.php b/src/Model/PostDisputeRequest.php new file mode 100644 index 000000000..e503bac79 --- /dev/null +++ b/src/Model/PostDisputeRequest.php @@ -0,0 +1,597 @@ +setTransactionId($data['transactionId']); + } + if (array_key_exists('currency', $data)) { + $this->setCurrency($data['currency']); + } + if (array_key_exists('amount', $data)) { + $this->setAmount($data['amount']); + } + if (array_key_exists('acquirerReferenceNumber', $data)) { + $this->setAcquirerReferenceNumber($data['acquirerReferenceNumber']); + } + if (array_key_exists('caseId', $data)) { + $this->setCaseId($data['caseId']); + } + if (array_key_exists('reasonCode', $data)) { + $this->setReasonCode($data['reasonCode']); + } + if (array_key_exists('type', $data)) { + $this->setType($data['type']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + if (array_key_exists('postedTime', $data)) { + $this->setPostedTime($data['postedTime']); + } + if (array_key_exists('deadlineTime', $data)) { + $this->setDeadlineTime($data['deadlineTime']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getTransactionId(): string + { + return $this->fields['transactionId']; + } + + public function setTransactionId(string $transactionId): static + { + $this->fields['transactionId'] = $transactionId; + + return $this; + } + + public function getCurrency(): string + { + return $this->fields['currency']; + } + + public function setCurrency(string $currency): static + { + $this->fields['currency'] = $currency; + + return $this; + } + + public function getAmount(): float + { + return $this->fields['amount']; + } + + public function setAmount(float|string $amount): static + { + if (is_string($amount)) { + $amount = (float) $amount; + } + + $this->fields['amount'] = $amount; + + return $this; + } + + public function getAcquirerReferenceNumber(): ?string + { + return $this->fields['acquirerReferenceNumber'] ?? null; + } + + public function setAcquirerReferenceNumber(null|string $acquirerReferenceNumber): static + { + $this->fields['acquirerReferenceNumber'] = $acquirerReferenceNumber; + + return $this; + } + + public function getCaseId(): ?string + { + return $this->fields['caseId'] ?? null; + } + + public function setCaseId(null|string $caseId): static + { + $this->fields['caseId'] = $caseId; + + return $this; + } + + public function getReasonCode(): string + { + return $this->fields['reasonCode']; + } + + public function setReasonCode(string $reasonCode): static + { + $this->fields['reasonCode'] = $reasonCode; + + return $this; + } + + public function getType(): string + { + return $this->fields['type']; + } + + public function setType(string $type): static + { + $this->fields['type'] = $type; + + return $this; + } + + public function getStatus(): string + { + return $this->fields['status']; + } + + public function setStatus(string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + public function getPostedTime(): DateTimeImmutable + { + return $this->fields['postedTime']; + } + + public function setPostedTime(DateTimeImmutable|string $postedTime): static + { + if (!($postedTime instanceof DateTimeImmutable)) { + $postedTime = new DateTimeImmutable($postedTime); + } + + $this->fields['postedTime'] = $postedTime; + + return $this; + } + + public function getDeadlineTime(): ?DateTimeImmutable + { + return $this->fields['deadlineTime'] ?? null; + } + + public function setDeadlineTime(null|DateTimeImmutable|string $deadlineTime): static + { + if ($deadlineTime !== null && !($deadlineTime instanceof DateTimeImmutable)) { + $deadlineTime = new DateTimeImmutable($deadlineTime); + } + + $this->fields['deadlineTime'] = $deadlineTime; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('transactionId', $this->fields)) { + $data['transactionId'] = $this->fields['transactionId']; + } + if (array_key_exists('currency', $this->fields)) { + $data['currency'] = $this->fields['currency']; + } + if (array_key_exists('amount', $this->fields)) { + $data['amount'] = $this->fields['amount']; + } + if (array_key_exists('acquirerReferenceNumber', $this->fields)) { + $data['acquirerReferenceNumber'] = $this->fields['acquirerReferenceNumber']; + } + if (array_key_exists('caseId', $this->fields)) { + $data['caseId'] = $this->fields['caseId']; + } + if (array_key_exists('reasonCode', $this->fields)) { + $data['reasonCode'] = $this->fields['reasonCode']; + } + if (array_key_exists('type', $this->fields)) { + $data['type'] = $this->fields['type']; + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + if (array_key_exists('postedTime', $this->fields)) { + $data['postedTime'] = $this->fields['postedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('deadlineTime', $this->fields)) { + $data['deadlineTime'] = $this->fields['deadlineTime']?->format(DateTimeInterface::RFC3339); + } + + return $data; + } +} diff --git a/src/Model/Quote.php b/src/Model/Quote.php index 3729e0637..72cb76c5c 100644 --- a/src/Model/Quote.php +++ b/src/Model/Quote.php @@ -14,532 +14,102 @@ namespace Rebilly\Sdk\Model; use DateTimeImmutable; -use DateTimeInterface; -use JsonSerializable; -class Quote implements JsonSerializable +interface Quote { - public const TYPE_SUBSCRIPTION_ORDER = 'subscription-order'; - - public const TYPE_ONE_TIME_ORDER = 'one-time-order'; - - public const STATUS_DRAFT = 'draft'; - - public const STATUS_ISSUED = 'issued'; - - public const STATUS_ACCEPTED = 'accepted'; - - public const STATUS_REJECTED = 'rejected'; - - public const STATUS_CANCELED = 'canceled'; - - public const STATUS_EXPIRED = 'expired'; - - private array $fields = []; - - public function __construct(array $data = []) - { - if (array_key_exists('id', $data)) { - $this->setId($data['id']); - } - if (array_key_exists('type', $data)) { - $this->setType($data['type']); - } - if (array_key_exists('status', $data)) { - $this->setStatus($data['status']); - } - if (array_key_exists('websiteId', $data)) { - $this->setWebsiteId($data['websiteId']); - } - if (array_key_exists('customerId', $data)) { - $this->setCustomerId($data['customerId']); - } - if (array_key_exists('orderId', $data)) { - $this->setOrderId($data['orderId']); - } - if (array_key_exists('items', $data)) { - $this->setItems($data['items']); - } - if (array_key_exists('deliveryAddress', $data)) { - $this->setDeliveryAddress($data['deliveryAddress']); - } - if (array_key_exists('billingAddress', $data)) { - $this->setBillingAddress($data['billingAddress']); - } - if (array_key_exists('invoicePreview', $data)) { - $this->setInvoicePreview($data['invoicePreview']); - } - if (array_key_exists('paymentTerms', $data)) { - $this->setPaymentTerms($data['paymentTerms']); - } - if (array_key_exists('expirationTime', $data)) { - $this->setExpirationTime($data['expirationTime']); - } - if (array_key_exists('issuedTime', $data)) { - $this->setIssuedTime($data['issuedTime']); - } - if (array_key_exists('acceptedTime', $data)) { - $this->setAcceptedTime($data['acceptedTime']); - } - if (array_key_exists('rejectedTime', $data)) { - $this->setRejectedTime($data['rejectedTime']); - } - if (array_key_exists('canceledTime', $data)) { - $this->setCanceledTime($data['canceledTime']); - } - if (array_key_exists('redirectUrl', $data)) { - $this->setRedirectUrl($data['redirectUrl']); - } - if (array_key_exists('signature', $data)) { - $this->setSignature($data['signature']); - } - if (array_key_exists('shipping', $data)) { - $this->setShipping($data['shipping']); - } - if (array_key_exists('tax', $data)) { - $this->setTax($data['tax']); - } - if (array_key_exists('couponIds', $data)) { - $this->setCouponIds($data['couponIds']); - } - if (array_key_exists('_links', $data)) { - $this->setLinks($data['_links']); - } - if (array_key_exists('_embedded', $data)) { - $this->setEmbedded($data['_embedded']); - } - } - - public static function from(array $data = []): self - { - return new self($data); - } - - public function getId(): ?string - { - return $this->fields['id'] ?? null; - } - - public function getType(): ?string - { - return $this->fields['type'] ?? null; - } - - public function getStatus(): ?string - { - return $this->fields['status'] ?? null; - } - - public function getWebsiteId(): string - { - return $this->fields['websiteId']; - } - - public function setWebsiteId(string $websiteId): static - { - $this->fields['websiteId'] = $websiteId; - - return $this; - } - - public function getCustomerId(): string - { - return $this->fields['customerId']; - } - - public function setCustomerId(string $customerId): static - { - $this->fields['customerId'] = $customerId; - - return $this; - } - - public function getOrderId(): ?string - { - return $this->fields['orderId'] ?? null; - } + public function getId(): ?string; + + public function getType(): ?string; + + public function getAction(): string; + + /** + * @return null|string[] + */ + public function getAcceptanceConditions(): ?array; + + /** + * @param null|string[] $acceptanceConditions + */ + public function setAcceptanceConditions(null|array $acceptanceConditions): static; + + /** + * @return null|QuoteCreateOrderAcceptanceFulfillment[] + */ + public function getAcceptanceFulfillment(): ?array; + + public function getInvoiceId(): ?string; + + public function getWebsiteId(): string; + + public function setWebsiteId(string $websiteId): static; + + public function getCustomerId(): string; + + public function setCustomerId(string $customerId): static; /** - * @return QuoteItems[] + * @return QuoteCreateOrderItems[] */ - public function getItems(): array - { - return $this->fields['items']; - } + public function getItems(): array; /** - * @param array[]|QuoteItems[] $items + * @param array[]|QuoteCreateOrderItems[] $items */ - public function setItems(array $items): static - { - $items = array_map( - fn ($value) => $value instanceof QuoteItems ? $value : QuoteItems::from($value), - $items, - ); - - $this->fields['items'] = $items; - - return $this; - } - - public function getDeliveryAddress(): ?ContactObject - { - return $this->fields['deliveryAddress'] ?? null; - } - - public function setDeliveryAddress(null|ContactObject|array $deliveryAddress): static - { - if ($deliveryAddress !== null && !($deliveryAddress instanceof ContactObject)) { - $deliveryAddress = ContactObject::from($deliveryAddress); - } - - $this->fields['deliveryAddress'] = $deliveryAddress; - - return $this; - } - - public function getBillingAddress(): ?ContactObject - { - return $this->fields['billingAddress'] ?? null; - } - - public function setBillingAddress(null|ContactObject|array $billingAddress): static - { - if ($billingAddress !== null && !($billingAddress instanceof ContactObject)) { - $billingAddress = ContactObject::from($billingAddress); - } - - $this->fields['billingAddress'] = $billingAddress; - - return $this; - } - - public function getInvoicePreview(): ?QuoteInvoicePreview - { - return $this->fields['invoicePreview'] ?? null; - } - - public function setInvoicePreview(null|QuoteInvoicePreview|array $invoicePreview): static - { - if ($invoicePreview !== null && !($invoicePreview instanceof QuoteInvoicePreview)) { - $invoicePreview = QuoteInvoicePreview::from($invoicePreview); - } - - $this->fields['invoicePreview'] = $invoicePreview; - - return $this; - } - - public function getPaymentTerms(): ?string - { - return $this->fields['paymentTerms'] ?? null; - } - - public function setPaymentTerms(null|string $paymentTerms): static - { - $this->fields['paymentTerms'] = $paymentTerms; - - return $this; - } - - public function getExpirationTime(): ?DateTimeImmutable - { - return $this->fields['expirationTime'] ?? null; - } - - public function setExpirationTime(null|DateTimeImmutable|string $expirationTime): static - { - if ($expirationTime !== null && !($expirationTime instanceof DateTimeImmutable)) { - $expirationTime = new DateTimeImmutable($expirationTime); - } - - $this->fields['expirationTime'] = $expirationTime; - - return $this; - } - - public function getIssuedTime(): ?DateTimeImmutable - { - return $this->fields['issuedTime'] ?? null; - } - - public function getAcceptedTime(): ?DateTimeImmutable - { - return $this->fields['acceptedTime'] ?? null; - } - - public function getRejectedTime(): ?DateTimeImmutable - { - return $this->fields['rejectedTime'] ?? null; - } + public function setItems(array $items): static; + + public function getInvoicePreview(): ?QuoteCreateOrderInvoicePreview; - public function getCanceledTime(): ?DateTimeImmutable - { - return $this->fields['canceledTime'] ?? null; - } + public function setInvoicePreview(null|QuoteCreateOrderInvoicePreview|array $invoicePreview): static; - public function getRedirectUrl(): ?string - { - return $this->fields['redirectUrl'] ?? null; - } - - public function setRedirectUrl(null|string $redirectUrl): static - { - $this->fields['redirectUrl'] = $redirectUrl; + public function getPaymentTerms(): ?string; - return $this; - } + public function setPaymentTerms(null|string $paymentTerms): static; - public function getSignature(): ?QuoteSignature - { - return $this->fields['signature'] ?? null; - } + public function getExpirationTime(): ?DateTimeImmutable; - public function setSignature(null|QuoteSignature|array $signature): static - { - if ($signature !== null && !($signature instanceof QuoteSignature)) { - $signature = QuoteSignature::from($signature); - } + public function setExpirationTime(null|DateTimeImmutable|string $expirationTime): static; - $this->fields['signature'] = $signature; + public function getIssuedTime(): ?DateTimeImmutable; - return $this; - } + public function getAcceptedTime(): ?DateTimeImmutable; - public function getShipping(): ?Shipping - { - return $this->fields['shipping'] ?? null; - } + public function getRejectedTime(): ?DateTimeImmutable; - public function setShipping(null|Shipping|array $shipping): static - { - if ($shipping !== null && !($shipping instanceof Shipping)) { - $shipping = ShippingFactory::from($shipping); - } + public function getCanceledTime(): ?DateTimeImmutable; - $this->fields['shipping'] = $shipping; + public function getRedirectUrl(): ?string; - return $this; - } + public function setRedirectUrl(null|string $redirectUrl): static; - public function getTax(): ?Taxes - { - return $this->fields['tax'] ?? null; - } + public function getSignature(): ?QuoteCreateOrderSignature; - public function setTax(null|Taxes|array $tax): static - { - if ($tax !== null && !($tax instanceof Taxes)) { - $tax = TaxesFactory::from($tax); - } + public function setSignature(null|QuoteCreateOrderSignature|array $signature): static; - $this->fields['tax'] = $tax; + public function getShipping(): ?Shipping; - return $this; - } + public function setShipping(null|Shipping|array $shipping): static; + + public function getTax(): ?Taxes; + + public function setTax(null|Taxes|array $tax): static; /** * @return null|string[] */ - public function getCouponIds(): ?array - { - return $this->fields['couponIds'] ?? null; - } + public function getCouponIds(): ?array; /** * @param null|string[] $couponIds */ - public function setCouponIds(null|array $couponIds): static - { - $this->fields['couponIds'] = $couponIds; - - return $this; - } + public function setCouponIds(null|array $couponIds): static; /** * @return null|ResourceLink[] */ - public function getLinks(): ?array - { - return $this->fields['_links'] ?? null; - } - - public function getEmbedded(): ?QuoteEmbedded - { - return $this->fields['_embedded'] ?? null; - } - - public function setEmbedded(null|QuoteEmbedded|array $embedded): static - { - if ($embedded !== null && !($embedded instanceof QuoteEmbedded)) { - $embedded = QuoteEmbedded::from($embedded); - } - - $this->fields['_embedded'] = $embedded; - - return $this; - } - - public function jsonSerialize(): array - { - $data = []; - if (array_key_exists('id', $this->fields)) { - $data['id'] = $this->fields['id']; - } - if (array_key_exists('type', $this->fields)) { - $data['type'] = $this->fields['type']; - } - if (array_key_exists('status', $this->fields)) { - $data['status'] = $this->fields['status']; - } - if (array_key_exists('websiteId', $this->fields)) { - $data['websiteId'] = $this->fields['websiteId']; - } - if (array_key_exists('customerId', $this->fields)) { - $data['customerId'] = $this->fields['customerId']; - } - if (array_key_exists('orderId', $this->fields)) { - $data['orderId'] = $this->fields['orderId']; - } - if (array_key_exists('items', $this->fields)) { - $data['items'] = $this->fields['items']; - } - if (array_key_exists('deliveryAddress', $this->fields)) { - $data['deliveryAddress'] = $this->fields['deliveryAddress']?->jsonSerialize(); - } - if (array_key_exists('billingAddress', $this->fields)) { - $data['billingAddress'] = $this->fields['billingAddress']?->jsonSerialize(); - } - if (array_key_exists('invoicePreview', $this->fields)) { - $data['invoicePreview'] = $this->fields['invoicePreview']?->jsonSerialize(); - } - if (array_key_exists('paymentTerms', $this->fields)) { - $data['paymentTerms'] = $this->fields['paymentTerms']; - } - if (array_key_exists('expirationTime', $this->fields)) { - $data['expirationTime'] = $this->fields['expirationTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('issuedTime', $this->fields)) { - $data['issuedTime'] = $this->fields['issuedTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('acceptedTime', $this->fields)) { - $data['acceptedTime'] = $this->fields['acceptedTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('rejectedTime', $this->fields)) { - $data['rejectedTime'] = $this->fields['rejectedTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('canceledTime', $this->fields)) { - $data['canceledTime'] = $this->fields['canceledTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('redirectUrl', $this->fields)) { - $data['redirectUrl'] = $this->fields['redirectUrl']; - } - if (array_key_exists('signature', $this->fields)) { - $data['signature'] = $this->fields['signature']?->jsonSerialize(); - } - if (array_key_exists('shipping', $this->fields)) { - $data['shipping'] = $this->fields['shipping']?->jsonSerialize(); - } - if (array_key_exists('tax', $this->fields)) { - $data['tax'] = $this->fields['tax']?->jsonSerialize(); - } - if (array_key_exists('couponIds', $this->fields)) { - $data['couponIds'] = $this->fields['couponIds']; - } - if (array_key_exists('_links', $this->fields)) { - $data['_links'] = $this->fields['_links']; - } - if (array_key_exists('_embedded', $this->fields)) { - $data['_embedded'] = $this->fields['_embedded']?->jsonSerialize(); - } - - return $data; - } - - private function setId(null|string $id): static - { - $this->fields['id'] = $id; - - return $this; - } - - private function setType(null|string $type): static - { - $this->fields['type'] = $type; - - return $this; - } - - private function setStatus(null|string $status): static - { - $this->fields['status'] = $status; - - return $this; - } - - private function setOrderId(null|string $orderId): static - { - $this->fields['orderId'] = $orderId; - - return $this; - } - - private function setIssuedTime(null|DateTimeImmutable|string $issuedTime): static - { - if ($issuedTime !== null && !($issuedTime instanceof DateTimeImmutable)) { - $issuedTime = new DateTimeImmutable($issuedTime); - } - - $this->fields['issuedTime'] = $issuedTime; - - return $this; - } - - private function setAcceptedTime(null|DateTimeImmutable|string $acceptedTime): static - { - if ($acceptedTime !== null && !($acceptedTime instanceof DateTimeImmutable)) { - $acceptedTime = new DateTimeImmutable($acceptedTime); - } - - $this->fields['acceptedTime'] = $acceptedTime; - - return $this; - } - - private function setRejectedTime(null|DateTimeImmutable|string $rejectedTime): static - { - if ($rejectedTime !== null && !($rejectedTime instanceof DateTimeImmutable)) { - $rejectedTime = new DateTimeImmutable($rejectedTime); - } - - $this->fields['rejectedTime'] = $rejectedTime; - - return $this; - } - - private function setCanceledTime(null|DateTimeImmutable|string $canceledTime): static - { - if ($canceledTime !== null && !($canceledTime instanceof DateTimeImmutable)) { - $canceledTime = new DateTimeImmutable($canceledTime); - } - - $this->fields['canceledTime'] = $canceledTime; - - return $this; - } - - /** - * @param null|array[]|ResourceLink[] $links - */ - private function setLinks(null|array $links): static - { - $links = $links !== null ? array_map( - fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), - $links, - ) : null; + public function getLinks(): ?array; - $this->fields['_links'] = $links; + public function getEmbedded(): ?QuoteCreateOrderEmbedded; - return $this; - } + public function setEmbedded(null|QuoteCreateOrderEmbedded|array $embedded): static; } diff --git a/src/Model/QuoteChangeOrder.php b/src/Model/QuoteChangeOrder.php new file mode 100644 index 000000000..6fd6f60d1 --- /dev/null +++ b/src/Model/QuoteChangeOrder.php @@ -0,0 +1,747 @@ +setId($data['id']); + } + if (array_key_exists('type', $data)) { + $this->setType($data['type']); + } + if (array_key_exists('acceptanceConditions', $data)) { + $this->setAcceptanceConditions($data['acceptanceConditions']); + } + if (array_key_exists('acceptanceFulfillment', $data)) { + $this->setAcceptanceFulfillment($data['acceptanceFulfillment']); + } + if (array_key_exists('orderId', $data)) { + $this->setOrderId($data['orderId']); + } + if (array_key_exists('invoiceId', $data)) { + $this->setInvoiceId($data['invoiceId']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + if (array_key_exists('websiteId', $data)) { + $this->setWebsiteId($data['websiteId']); + } + if (array_key_exists('customerId', $data)) { + $this->setCustomerId($data['customerId']); + } + if (array_key_exists('items', $data)) { + $this->setItems($data['items']); + } + if (array_key_exists('renewalPolicy', $data)) { + $this->setRenewalPolicy($data['renewalPolicy']); + } + if (array_key_exists('prorated', $data)) { + $this->setProrated($data['prorated']); + } + if (array_key_exists('effectiveTime', $data)) { + $this->setEffectiveTime($data['effectiveTime']); + } + if (array_key_exists('keepTrial', $data)) { + $this->setKeepTrial($data['keepTrial']); + } + if (array_key_exists('invoicePreview', $data)) { + $this->setInvoicePreview($data['invoicePreview']); + } + if (array_key_exists('paymentTerms', $data)) { + $this->setPaymentTerms($data['paymentTerms']); + } + if (array_key_exists('expirationTime', $data)) { + $this->setExpirationTime($data['expirationTime']); + } + if (array_key_exists('issuedTime', $data)) { + $this->setIssuedTime($data['issuedTime']); + } + if (array_key_exists('acceptedTime', $data)) { + $this->setAcceptedTime($data['acceptedTime']); + } + if (array_key_exists('rejectedTime', $data)) { + $this->setRejectedTime($data['rejectedTime']); + } + if (array_key_exists('canceledTime', $data)) { + $this->setCanceledTime($data['canceledTime']); + } + if (array_key_exists('redirectUrl', $data)) { + $this->setRedirectUrl($data['redirectUrl']); + } + if (array_key_exists('signature', $data)) { + $this->setSignature($data['signature']); + } + if (array_key_exists('shipping', $data)) { + $this->setShipping($data['shipping']); + } + if (array_key_exists('tax', $data)) { + $this->setTax($data['tax']); + } + if (array_key_exists('couponIds', $data)) { + $this->setCouponIds($data['couponIds']); + } + if (array_key_exists('_links', $data)) { + $this->setLinks($data['_links']); + } + if (array_key_exists('_embedded', $data)) { + $this->setEmbedded($data['_embedded']); + } + if (array_key_exists('renewalTime', $data)) { + $this->setRenewalTime($data['renewalTime']); + } + if (array_key_exists('deliveryAddress', $data)) { + $this->setDeliveryAddress($data['deliveryAddress']); + } + if (array_key_exists('paymentInstrumentId', $data)) { + $this->setPaymentInstrumentId($data['paymentInstrumentId']); + } + if (array_key_exists('billingAddress', $data)) { + $this->setBillingAddress($data['billingAddress']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getAction(): string + { + return 'change'; + } + + public function getId(): ?string + { + return $this->fields['id'] ?? null; + } + + public function getType(): ?string + { + return $this->fields['type'] ?? null; + } + + /** + * @return null|string[] + */ + public function getAcceptanceConditions(): ?array + { + return $this->fields['acceptanceConditions'] ?? null; + } + + /** + * @param null|string[] $acceptanceConditions + */ + public function setAcceptanceConditions(null|array $acceptanceConditions): static + { + $this->fields['acceptanceConditions'] = $acceptanceConditions; + + return $this; + } + + /** + * @return null|QuoteCreateOrderAcceptanceFulfillment[] + */ + public function getAcceptanceFulfillment(): ?array + { + return $this->fields['acceptanceFulfillment'] ?? null; + } + + public function getOrderId(): string + { + return $this->fields['orderId']; + } + + public function setOrderId(string $orderId): static + { + $this->fields['orderId'] = $orderId; + + return $this; + } + + public function getInvoiceId(): ?string + { + return $this->fields['invoiceId'] ?? null; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function getWebsiteId(): string + { + return $this->fields['websiteId']; + } + + public function setWebsiteId(string $websiteId): static + { + $this->fields['websiteId'] = $websiteId; + + return $this; + } + + public function getCustomerId(): string + { + return $this->fields['customerId']; + } + + public function setCustomerId(string $customerId): static + { + $this->fields['customerId'] = $customerId; + + return $this; + } + + /** + * @return QuoteCreateOrderItems[] + */ + public function getItems(): array + { + return $this->fields['items']; + } + + /** + * @param array[]|QuoteCreateOrderItems[] $items + */ + public function setItems(array $items): static + { + $items = array_map( + fn ($value) => $value instanceof QuoteCreateOrderItems ? $value : QuoteCreateOrderItems::from($value), + $items, + ); + + $this->fields['items'] = $items; + + return $this; + } + + public function getRenewalPolicy(): ?string + { + return $this->fields['renewalPolicy'] ?? null; + } + + public function setRenewalPolicy(null|string $renewalPolicy): static + { + $this->fields['renewalPolicy'] = $renewalPolicy; + + return $this; + } + + public function getProrated(): ?bool + { + return $this->fields['prorated'] ?? null; + } + + public function setProrated(null|bool $prorated): static + { + $this->fields['prorated'] = $prorated; + + return $this; + } + + public function getEffectiveTime(): ?DateTimeImmutable + { + return $this->fields['effectiveTime'] ?? null; + } + + public function setEffectiveTime(null|DateTimeImmutable|string $effectiveTime): static + { + if ($effectiveTime !== null && !($effectiveTime instanceof DateTimeImmutable)) { + $effectiveTime = new DateTimeImmutable($effectiveTime); + } + + $this->fields['effectiveTime'] = $effectiveTime; + + return $this; + } + + public function getKeepTrial(): ?bool + { + return $this->fields['keepTrial'] ?? null; + } + + public function setKeepTrial(null|bool $keepTrial): static + { + $this->fields['keepTrial'] = $keepTrial; + + return $this; + } + + public function getInvoicePreview(): ?QuoteCreateOrderInvoicePreview + { + return $this->fields['invoicePreview'] ?? null; + } + + public function setInvoicePreview(null|QuoteCreateOrderInvoicePreview|array $invoicePreview): static + { + if ($invoicePreview !== null && !($invoicePreview instanceof QuoteCreateOrderInvoicePreview)) { + $invoicePreview = QuoteCreateOrderInvoicePreview::from($invoicePreview); + } + + $this->fields['invoicePreview'] = $invoicePreview; + + return $this; + } + + public function getPaymentTerms(): ?string + { + return $this->fields['paymentTerms'] ?? null; + } + + public function setPaymentTerms(null|string $paymentTerms): static + { + $this->fields['paymentTerms'] = $paymentTerms; + + return $this; + } + + public function getExpirationTime(): ?DateTimeImmutable + { + return $this->fields['expirationTime'] ?? null; + } + + public function setExpirationTime(null|DateTimeImmutable|string $expirationTime): static + { + if ($expirationTime !== null && !($expirationTime instanceof DateTimeImmutable)) { + $expirationTime = new DateTimeImmutable($expirationTime); + } + + $this->fields['expirationTime'] = $expirationTime; + + return $this; + } + + public function getIssuedTime(): ?DateTimeImmutable + { + return $this->fields['issuedTime'] ?? null; + } + + public function getAcceptedTime(): ?DateTimeImmutable + { + return $this->fields['acceptedTime'] ?? null; + } + + public function getRejectedTime(): ?DateTimeImmutable + { + return $this->fields['rejectedTime'] ?? null; + } + + public function getCanceledTime(): ?DateTimeImmutable + { + return $this->fields['canceledTime'] ?? null; + } + + public function getRedirectUrl(): ?string + { + return $this->fields['redirectUrl'] ?? null; + } + + public function setRedirectUrl(null|string $redirectUrl): static + { + $this->fields['redirectUrl'] = $redirectUrl; + + return $this; + } + + public function getSignature(): ?QuoteCreateOrderSignature + { + return $this->fields['signature'] ?? null; + } + + public function setSignature(null|QuoteCreateOrderSignature|array $signature): static + { + if ($signature !== null && !($signature instanceof QuoteCreateOrderSignature)) { + $signature = QuoteCreateOrderSignature::from($signature); + } + + $this->fields['signature'] = $signature; + + return $this; + } + + public function getShipping(): ?Shipping + { + return $this->fields['shipping'] ?? null; + } + + public function setShipping(null|Shipping|array $shipping): static + { + if ($shipping !== null && !($shipping instanceof Shipping)) { + $shipping = ShippingFactory::from($shipping); + } + + $this->fields['shipping'] = $shipping; + + return $this; + } + + public function getTax(): ?Taxes + { + return $this->fields['tax'] ?? null; + } + + public function setTax(null|Taxes|array $tax): static + { + if ($tax !== null && !($tax instanceof Taxes)) { + $tax = TaxesFactory::from($tax); + } + + $this->fields['tax'] = $tax; + + return $this; + } + + /** + * @return null|string[] + */ + public function getCouponIds(): ?array + { + return $this->fields['couponIds'] ?? null; + } + + /** + * @param null|string[] $couponIds + */ + public function setCouponIds(null|array $couponIds): static + { + $this->fields['couponIds'] = $couponIds; + + return $this; + } + + /** + * @return null|ResourceLink[] + */ + public function getLinks(): ?array + { + return $this->fields['_links'] ?? null; + } + + public function getEmbedded(): ?QuoteCreateOrderEmbedded + { + return $this->fields['_embedded'] ?? null; + } + + public function setEmbedded(null|QuoteCreateOrderEmbedded|array $embedded): static + { + if ($embedded !== null && !($embedded instanceof QuoteCreateOrderEmbedded)) { + $embedded = QuoteCreateOrderEmbedded::from($embedded); + } + + $this->fields['_embedded'] = $embedded; + + return $this; + } + + public function getRenewalTime(): ?DateTimeImmutable + { + return $this->fields['renewalTime'] ?? null; + } + + public function setRenewalTime(null|DateTimeImmutable|string $renewalTime): static + { + if ($renewalTime !== null && !($renewalTime instanceof DateTimeImmutable)) { + $renewalTime = new DateTimeImmutable($renewalTime); + } + + $this->fields['renewalTime'] = $renewalTime; + + return $this; + } + + public function getDeliveryAddress(): ?ContactObject + { + return $this->fields['deliveryAddress'] ?? null; + } + + public function setDeliveryAddress(null|ContactObject|array $deliveryAddress): static + { + if ($deliveryAddress !== null && !($deliveryAddress instanceof ContactObject)) { + $deliveryAddress = ContactObject::from($deliveryAddress); + } + + $this->fields['deliveryAddress'] = $deliveryAddress; + + return $this; + } + + public function getPaymentInstrumentId(): ?string + { + return $this->fields['paymentInstrumentId'] ?? null; + } + + public function setPaymentInstrumentId(null|string $paymentInstrumentId): static + { + $this->fields['paymentInstrumentId'] = $paymentInstrumentId; + + return $this; + } + + public function getBillingAddress(): ?ContactObject + { + return $this->fields['billingAddress'] ?? null; + } + + public function setBillingAddress(null|ContactObject|array $billingAddress): static + { + if ($billingAddress !== null && !($billingAddress instanceof ContactObject)) { + $billingAddress = ContactObject::from($billingAddress); + } + + $this->fields['billingAddress'] = $billingAddress; + + return $this; + } + + public function jsonSerialize(): array + { + $data = [ + 'action' => 'change', + ]; + if (array_key_exists('id', $this->fields)) { + $data['id'] = $this->fields['id']; + } + if (array_key_exists('type', $this->fields)) { + $data['type'] = $this->fields['type']; + } + if (array_key_exists('acceptanceConditions', $this->fields)) { + $data['acceptanceConditions'] = $this->fields['acceptanceConditions']; + } + if (array_key_exists('acceptanceFulfillment', $this->fields)) { + $data['acceptanceFulfillment'] = $this->fields['acceptanceFulfillment']; + } + if (array_key_exists('orderId', $this->fields)) { + $data['orderId'] = $this->fields['orderId']; + } + if (array_key_exists('invoiceId', $this->fields)) { + $data['invoiceId'] = $this->fields['invoiceId']; + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + if (array_key_exists('websiteId', $this->fields)) { + $data['websiteId'] = $this->fields['websiteId']; + } + if (array_key_exists('customerId', $this->fields)) { + $data['customerId'] = $this->fields['customerId']; + } + if (array_key_exists('items', $this->fields)) { + $data['items'] = $this->fields['items']; + } + if (array_key_exists('renewalPolicy', $this->fields)) { + $data['renewalPolicy'] = $this->fields['renewalPolicy']; + } + if (array_key_exists('prorated', $this->fields)) { + $data['prorated'] = $this->fields['prorated']; + } + if (array_key_exists('effectiveTime', $this->fields)) { + $data['effectiveTime'] = $this->fields['effectiveTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('keepTrial', $this->fields)) { + $data['keepTrial'] = $this->fields['keepTrial']; + } + if (array_key_exists('invoicePreview', $this->fields)) { + $data['invoicePreview'] = $this->fields['invoicePreview']?->jsonSerialize(); + } + if (array_key_exists('paymentTerms', $this->fields)) { + $data['paymentTerms'] = $this->fields['paymentTerms']; + } + if (array_key_exists('expirationTime', $this->fields)) { + $data['expirationTime'] = $this->fields['expirationTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('issuedTime', $this->fields)) { + $data['issuedTime'] = $this->fields['issuedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('acceptedTime', $this->fields)) { + $data['acceptedTime'] = $this->fields['acceptedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('rejectedTime', $this->fields)) { + $data['rejectedTime'] = $this->fields['rejectedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('canceledTime', $this->fields)) { + $data['canceledTime'] = $this->fields['canceledTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('redirectUrl', $this->fields)) { + $data['redirectUrl'] = $this->fields['redirectUrl']; + } + if (array_key_exists('signature', $this->fields)) { + $data['signature'] = $this->fields['signature']?->jsonSerialize(); + } + if (array_key_exists('shipping', $this->fields)) { + $data['shipping'] = $this->fields['shipping']?->jsonSerialize(); + } + if (array_key_exists('tax', $this->fields)) { + $data['tax'] = $this->fields['tax']?->jsonSerialize(); + } + if (array_key_exists('couponIds', $this->fields)) { + $data['couponIds'] = $this->fields['couponIds']; + } + if (array_key_exists('_links', $this->fields)) { + $data['_links'] = $this->fields['_links']; + } + if (array_key_exists('_embedded', $this->fields)) { + $data['_embedded'] = $this->fields['_embedded']?->jsonSerialize(); + } + if (array_key_exists('renewalTime', $this->fields)) { + $data['renewalTime'] = $this->fields['renewalTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('deliveryAddress', $this->fields)) { + $data['deliveryAddress'] = $this->fields['deliveryAddress']?->jsonSerialize(); + } + if (array_key_exists('paymentInstrumentId', $this->fields)) { + $data['paymentInstrumentId'] = $this->fields['paymentInstrumentId']; + } + if (array_key_exists('billingAddress', $this->fields)) { + $data['billingAddress'] = $this->fields['billingAddress']?->jsonSerialize(); + } + + return $data; + } + + private function setId(null|string $id): static + { + $this->fields['id'] = $id; + + return $this; + } + + private function setType(null|string $type): static + { + $this->fields['type'] = $type; + + return $this; + } + + /** + * @param null|array[]|QuoteCreateOrderAcceptanceFulfillment[] $acceptanceFulfillment + */ + private function setAcceptanceFulfillment(null|array $acceptanceFulfillment): static + { + $acceptanceFulfillment = $acceptanceFulfillment !== null ? array_map( + fn ($value) => $value instanceof QuoteCreateOrderAcceptanceFulfillment ? $value : QuoteCreateOrderAcceptanceFulfillment::from($value), + $acceptanceFulfillment, + ) : null; + + $this->fields['acceptanceFulfillment'] = $acceptanceFulfillment; + + return $this; + } + + private function setInvoiceId(null|string $invoiceId): static + { + $this->fields['invoiceId'] = $invoiceId; + + return $this; + } + + private function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + private function setIssuedTime(null|DateTimeImmutable|string $issuedTime): static + { + if ($issuedTime !== null && !($issuedTime instanceof DateTimeImmutable)) { + $issuedTime = new DateTimeImmutable($issuedTime); + } + + $this->fields['issuedTime'] = $issuedTime; + + return $this; + } + + private function setAcceptedTime(null|DateTimeImmutable|string $acceptedTime): static + { + if ($acceptedTime !== null && !($acceptedTime instanceof DateTimeImmutable)) { + $acceptedTime = new DateTimeImmutable($acceptedTime); + } + + $this->fields['acceptedTime'] = $acceptedTime; + + return $this; + } + + private function setRejectedTime(null|DateTimeImmutable|string $rejectedTime): static + { + if ($rejectedTime !== null && !($rejectedTime instanceof DateTimeImmutable)) { + $rejectedTime = new DateTimeImmutable($rejectedTime); + } + + $this->fields['rejectedTime'] = $rejectedTime; + + return $this; + } + + private function setCanceledTime(null|DateTimeImmutable|string $canceledTime): static + { + if ($canceledTime !== null && !($canceledTime instanceof DateTimeImmutable)) { + $canceledTime = new DateTimeImmutable($canceledTime); + } + + $this->fields['canceledTime'] = $canceledTime; + + return $this; + } + + /** + * @param null|array[]|ResourceLink[] $links + */ + private function setLinks(null|array $links): static + { + $links = $links !== null ? array_map( + fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), + $links, + ) : null; + + $this->fields['_links'] = $links; + + return $this; + } +} diff --git a/src/Model/QuoteCreateOrder.php b/src/Model/QuoteCreateOrder.php new file mode 100644 index 000000000..1b96df5d8 --- /dev/null +++ b/src/Model/QuoteCreateOrder.php @@ -0,0 +1,747 @@ +setId($data['id']); + } + if (array_key_exists('type', $data)) { + $this->setType($data['type']); + } + if (array_key_exists('acceptanceConditions', $data)) { + $this->setAcceptanceConditions($data['acceptanceConditions']); + } + if (array_key_exists('acceptanceFulfillment', $data)) { + $this->setAcceptanceFulfillment($data['acceptanceFulfillment']); + } + if (array_key_exists('orderId', $data)) { + $this->setOrderId($data['orderId']); + } + if (array_key_exists('invoiceId', $data)) { + $this->setInvoiceId($data['invoiceId']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + if (array_key_exists('websiteId', $data)) { + $this->setWebsiteId($data['websiteId']); + } + if (array_key_exists('customerId', $data)) { + $this->setCustomerId($data['customerId']); + } + if (array_key_exists('items', $data)) { + $this->setItems($data['items']); + } + if (array_key_exists('deliveryAddress', $data)) { + $this->setDeliveryAddress($data['deliveryAddress']); + } + if (array_key_exists('billingAddress', $data)) { + $this->setBillingAddress($data['billingAddress']); + } + if (array_key_exists('invoicePreview', $data)) { + $this->setInvoicePreview($data['invoicePreview']); + } + if (array_key_exists('paymentTerms', $data)) { + $this->setPaymentTerms($data['paymentTerms']); + } + if (array_key_exists('expirationTime', $data)) { + $this->setExpirationTime($data['expirationTime']); + } + if (array_key_exists('issuedTime', $data)) { + $this->setIssuedTime($data['issuedTime']); + } + if (array_key_exists('acceptedTime', $data)) { + $this->setAcceptedTime($data['acceptedTime']); + } + if (array_key_exists('rejectedTime', $data)) { + $this->setRejectedTime($data['rejectedTime']); + } + if (array_key_exists('canceledTime', $data)) { + $this->setCanceledTime($data['canceledTime']); + } + if (array_key_exists('redirectUrl', $data)) { + $this->setRedirectUrl($data['redirectUrl']); + } + if (array_key_exists('signature', $data)) { + $this->setSignature($data['signature']); + } + if (array_key_exists('shipping', $data)) { + $this->setShipping($data['shipping']); + } + if (array_key_exists('tax', $data)) { + $this->setTax($data['tax']); + } + if (array_key_exists('couponIds', $data)) { + $this->setCouponIds($data['couponIds']); + } + if (array_key_exists('_links', $data)) { + $this->setLinks($data['_links']); + } + if (array_key_exists('_embedded', $data)) { + $this->setEmbedded($data['_embedded']); + } + if (array_key_exists('effectiveTime', $data)) { + $this->setEffectiveTime($data['effectiveTime']); + } + if (array_key_exists('renewalPolicy', $data)) { + $this->setRenewalPolicy($data['renewalPolicy']); + } + if (array_key_exists('renewalTime', $data)) { + $this->setRenewalTime($data['renewalTime']); + } + if (array_key_exists('prorated', $data)) { + $this->setProrated($data['prorated']); + } + if (array_key_exists('paymentInstrumentId', $data)) { + $this->setPaymentInstrumentId($data['paymentInstrumentId']); + } + if (array_key_exists('keepTrial', $data)) { + $this->setKeepTrial($data['keepTrial']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getAction(): string + { + return 'create'; + } + + public function getId(): ?string + { + return $this->fields['id'] ?? null; + } + + public function getType(): ?string + { + return $this->fields['type'] ?? null; + } + + /** + * @return null|string[] + */ + public function getAcceptanceConditions(): ?array + { + return $this->fields['acceptanceConditions'] ?? null; + } + + /** + * @param null|string[] $acceptanceConditions + */ + public function setAcceptanceConditions(null|array $acceptanceConditions): static + { + $this->fields['acceptanceConditions'] = $acceptanceConditions; + + return $this; + } + + /** + * @return null|QuoteCreateOrderAcceptanceFulfillment[] + */ + public function getAcceptanceFulfillment(): ?array + { + return $this->fields['acceptanceFulfillment'] ?? null; + } + + public function getOrderId(): ?string + { + return $this->fields['orderId'] ?? null; + } + + public function getInvoiceId(): ?string + { + return $this->fields['invoiceId'] ?? null; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function getWebsiteId(): string + { + return $this->fields['websiteId']; + } + + public function setWebsiteId(string $websiteId): static + { + $this->fields['websiteId'] = $websiteId; + + return $this; + } + + public function getCustomerId(): string + { + return $this->fields['customerId']; + } + + public function setCustomerId(string $customerId): static + { + $this->fields['customerId'] = $customerId; + + return $this; + } + + /** + * @return QuoteCreateOrderItems[] + */ + public function getItems(): array + { + return $this->fields['items']; + } + + /** + * @param array[]|QuoteCreateOrderItems[] $items + */ + public function setItems(array $items): static + { + $items = array_map( + fn ($value) => $value instanceof QuoteCreateOrderItems ? $value : QuoteCreateOrderItems::from($value), + $items, + ); + + $this->fields['items'] = $items; + + return $this; + } + + public function getDeliveryAddress(): ?ContactObject + { + return $this->fields['deliveryAddress'] ?? null; + } + + public function setDeliveryAddress(null|ContactObject|array $deliveryAddress): static + { + if ($deliveryAddress !== null && !($deliveryAddress instanceof ContactObject)) { + $deliveryAddress = ContactObject::from($deliveryAddress); + } + + $this->fields['deliveryAddress'] = $deliveryAddress; + + return $this; + } + + public function getBillingAddress(): ?ContactObject + { + return $this->fields['billingAddress'] ?? null; + } + + public function setBillingAddress(null|ContactObject|array $billingAddress): static + { + if ($billingAddress !== null && !($billingAddress instanceof ContactObject)) { + $billingAddress = ContactObject::from($billingAddress); + } + + $this->fields['billingAddress'] = $billingAddress; + + return $this; + } + + public function getInvoicePreview(): ?QuoteCreateOrderInvoicePreview + { + return $this->fields['invoicePreview'] ?? null; + } + + public function setInvoicePreview(null|QuoteCreateOrderInvoicePreview|array $invoicePreview): static + { + if ($invoicePreview !== null && !($invoicePreview instanceof QuoteCreateOrderInvoicePreview)) { + $invoicePreview = QuoteCreateOrderInvoicePreview::from($invoicePreview); + } + + $this->fields['invoicePreview'] = $invoicePreview; + + return $this; + } + + public function getPaymentTerms(): ?string + { + return $this->fields['paymentTerms'] ?? null; + } + + public function setPaymentTerms(null|string $paymentTerms): static + { + $this->fields['paymentTerms'] = $paymentTerms; + + return $this; + } + + public function getExpirationTime(): ?DateTimeImmutable + { + return $this->fields['expirationTime'] ?? null; + } + + public function setExpirationTime(null|DateTimeImmutable|string $expirationTime): static + { + if ($expirationTime !== null && !($expirationTime instanceof DateTimeImmutable)) { + $expirationTime = new DateTimeImmutable($expirationTime); + } + + $this->fields['expirationTime'] = $expirationTime; + + return $this; + } + + public function getIssuedTime(): ?DateTimeImmutable + { + return $this->fields['issuedTime'] ?? null; + } + + public function getAcceptedTime(): ?DateTimeImmutable + { + return $this->fields['acceptedTime'] ?? null; + } + + public function getRejectedTime(): ?DateTimeImmutable + { + return $this->fields['rejectedTime'] ?? null; + } + + public function getCanceledTime(): ?DateTimeImmutable + { + return $this->fields['canceledTime'] ?? null; + } + + public function getRedirectUrl(): ?string + { + return $this->fields['redirectUrl'] ?? null; + } + + public function setRedirectUrl(null|string $redirectUrl): static + { + $this->fields['redirectUrl'] = $redirectUrl; + + return $this; + } + + public function getSignature(): ?QuoteCreateOrderSignature + { + return $this->fields['signature'] ?? null; + } + + public function setSignature(null|QuoteCreateOrderSignature|array $signature): static + { + if ($signature !== null && !($signature instanceof QuoteCreateOrderSignature)) { + $signature = QuoteCreateOrderSignature::from($signature); + } + + $this->fields['signature'] = $signature; + + return $this; + } + + public function getShipping(): ?Shipping + { + return $this->fields['shipping'] ?? null; + } + + public function setShipping(null|Shipping|array $shipping): static + { + if ($shipping !== null && !($shipping instanceof Shipping)) { + $shipping = ShippingFactory::from($shipping); + } + + $this->fields['shipping'] = $shipping; + + return $this; + } + + public function getTax(): ?Taxes + { + return $this->fields['tax'] ?? null; + } + + public function setTax(null|Taxes|array $tax): static + { + if ($tax !== null && !($tax instanceof Taxes)) { + $tax = TaxesFactory::from($tax); + } + + $this->fields['tax'] = $tax; + + return $this; + } + + /** + * @return null|string[] + */ + public function getCouponIds(): ?array + { + return $this->fields['couponIds'] ?? null; + } + + /** + * @param null|string[] $couponIds + */ + public function setCouponIds(null|array $couponIds): static + { + $this->fields['couponIds'] = $couponIds; + + return $this; + } + + /** + * @return null|ResourceLink[] + */ + public function getLinks(): ?array + { + return $this->fields['_links'] ?? null; + } + + public function getEmbedded(): ?QuoteCreateOrderEmbedded + { + return $this->fields['_embedded'] ?? null; + } + + public function setEmbedded(null|QuoteCreateOrderEmbedded|array $embedded): static + { + if ($embedded !== null && !($embedded instanceof QuoteCreateOrderEmbedded)) { + $embedded = QuoteCreateOrderEmbedded::from($embedded); + } + + $this->fields['_embedded'] = $embedded; + + return $this; + } + + public function getEffectiveTime(): ?DateTimeImmutable + { + return $this->fields['effectiveTime'] ?? null; + } + + public function setEffectiveTime(null|DateTimeImmutable|string $effectiveTime): static + { + if ($effectiveTime !== null && !($effectiveTime instanceof DateTimeImmutable)) { + $effectiveTime = new DateTimeImmutable($effectiveTime); + } + + $this->fields['effectiveTime'] = $effectiveTime; + + return $this; + } + + public function getRenewalPolicy(): ?string + { + return $this->fields['renewalPolicy'] ?? null; + } + + public function setRenewalPolicy(null|string $renewalPolicy): static + { + $this->fields['renewalPolicy'] = $renewalPolicy; + + return $this; + } + + public function getRenewalTime(): ?DateTimeImmutable + { + return $this->fields['renewalTime'] ?? null; + } + + public function setRenewalTime(null|DateTimeImmutable|string $renewalTime): static + { + if ($renewalTime !== null && !($renewalTime instanceof DateTimeImmutable)) { + $renewalTime = new DateTimeImmutable($renewalTime); + } + + $this->fields['renewalTime'] = $renewalTime; + + return $this; + } + + public function getProrated(): ?bool + { + return $this->fields['prorated'] ?? null; + } + + public function setProrated(null|bool $prorated): static + { + $this->fields['prorated'] = $prorated; + + return $this; + } + + public function getPaymentInstrumentId(): ?string + { + return $this->fields['paymentInstrumentId'] ?? null; + } + + public function setPaymentInstrumentId(null|string $paymentInstrumentId): static + { + $this->fields['paymentInstrumentId'] = $paymentInstrumentId; + + return $this; + } + + public function getKeepTrial(): ?bool + { + return $this->fields['keepTrial'] ?? null; + } + + public function setKeepTrial(null|bool $keepTrial): static + { + $this->fields['keepTrial'] = $keepTrial; + + return $this; + } + + public function jsonSerialize(): array + { + $data = [ + 'action' => 'create', + ]; + if (array_key_exists('id', $this->fields)) { + $data['id'] = $this->fields['id']; + } + if (array_key_exists('type', $this->fields)) { + $data['type'] = $this->fields['type']; + } + if (array_key_exists('acceptanceConditions', $this->fields)) { + $data['acceptanceConditions'] = $this->fields['acceptanceConditions']; + } + if (array_key_exists('acceptanceFulfillment', $this->fields)) { + $data['acceptanceFulfillment'] = $this->fields['acceptanceFulfillment']; + } + if (array_key_exists('orderId', $this->fields)) { + $data['orderId'] = $this->fields['orderId']; + } + if (array_key_exists('invoiceId', $this->fields)) { + $data['invoiceId'] = $this->fields['invoiceId']; + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + if (array_key_exists('websiteId', $this->fields)) { + $data['websiteId'] = $this->fields['websiteId']; + } + if (array_key_exists('customerId', $this->fields)) { + $data['customerId'] = $this->fields['customerId']; + } + if (array_key_exists('items', $this->fields)) { + $data['items'] = $this->fields['items']; + } + if (array_key_exists('deliveryAddress', $this->fields)) { + $data['deliveryAddress'] = $this->fields['deliveryAddress']?->jsonSerialize(); + } + if (array_key_exists('billingAddress', $this->fields)) { + $data['billingAddress'] = $this->fields['billingAddress']?->jsonSerialize(); + } + if (array_key_exists('invoicePreview', $this->fields)) { + $data['invoicePreview'] = $this->fields['invoicePreview']?->jsonSerialize(); + } + if (array_key_exists('paymentTerms', $this->fields)) { + $data['paymentTerms'] = $this->fields['paymentTerms']; + } + if (array_key_exists('expirationTime', $this->fields)) { + $data['expirationTime'] = $this->fields['expirationTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('issuedTime', $this->fields)) { + $data['issuedTime'] = $this->fields['issuedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('acceptedTime', $this->fields)) { + $data['acceptedTime'] = $this->fields['acceptedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('rejectedTime', $this->fields)) { + $data['rejectedTime'] = $this->fields['rejectedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('canceledTime', $this->fields)) { + $data['canceledTime'] = $this->fields['canceledTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('redirectUrl', $this->fields)) { + $data['redirectUrl'] = $this->fields['redirectUrl']; + } + if (array_key_exists('signature', $this->fields)) { + $data['signature'] = $this->fields['signature']?->jsonSerialize(); + } + if (array_key_exists('shipping', $this->fields)) { + $data['shipping'] = $this->fields['shipping']?->jsonSerialize(); + } + if (array_key_exists('tax', $this->fields)) { + $data['tax'] = $this->fields['tax']?->jsonSerialize(); + } + if (array_key_exists('couponIds', $this->fields)) { + $data['couponIds'] = $this->fields['couponIds']; + } + if (array_key_exists('_links', $this->fields)) { + $data['_links'] = $this->fields['_links']; + } + if (array_key_exists('_embedded', $this->fields)) { + $data['_embedded'] = $this->fields['_embedded']?->jsonSerialize(); + } + if (array_key_exists('effectiveTime', $this->fields)) { + $data['effectiveTime'] = $this->fields['effectiveTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('renewalPolicy', $this->fields)) { + $data['renewalPolicy'] = $this->fields['renewalPolicy']; + } + if (array_key_exists('renewalTime', $this->fields)) { + $data['renewalTime'] = $this->fields['renewalTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('prorated', $this->fields)) { + $data['prorated'] = $this->fields['prorated']; + } + if (array_key_exists('paymentInstrumentId', $this->fields)) { + $data['paymentInstrumentId'] = $this->fields['paymentInstrumentId']; + } + if (array_key_exists('keepTrial', $this->fields)) { + $data['keepTrial'] = $this->fields['keepTrial']; + } + + return $data; + } + + private function setId(null|string $id): static + { + $this->fields['id'] = $id; + + return $this; + } + + private function setType(null|string $type): static + { + $this->fields['type'] = $type; + + return $this; + } + + /** + * @param null|array[]|QuoteCreateOrderAcceptanceFulfillment[] $acceptanceFulfillment + */ + private function setAcceptanceFulfillment(null|array $acceptanceFulfillment): static + { + $acceptanceFulfillment = $acceptanceFulfillment !== null ? array_map( + fn ($value) => $value instanceof QuoteCreateOrderAcceptanceFulfillment ? $value : QuoteCreateOrderAcceptanceFulfillment::from($value), + $acceptanceFulfillment, + ) : null; + + $this->fields['acceptanceFulfillment'] = $acceptanceFulfillment; + + return $this; + } + + private function setOrderId(null|string $orderId): static + { + $this->fields['orderId'] = $orderId; + + return $this; + } + + private function setInvoiceId(null|string $invoiceId): static + { + $this->fields['invoiceId'] = $invoiceId; + + return $this; + } + + private function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + private function setIssuedTime(null|DateTimeImmutable|string $issuedTime): static + { + if ($issuedTime !== null && !($issuedTime instanceof DateTimeImmutable)) { + $issuedTime = new DateTimeImmutable($issuedTime); + } + + $this->fields['issuedTime'] = $issuedTime; + + return $this; + } + + private function setAcceptedTime(null|DateTimeImmutable|string $acceptedTime): static + { + if ($acceptedTime !== null && !($acceptedTime instanceof DateTimeImmutable)) { + $acceptedTime = new DateTimeImmutable($acceptedTime); + } + + $this->fields['acceptedTime'] = $acceptedTime; + + return $this; + } + + private function setRejectedTime(null|DateTimeImmutable|string $rejectedTime): static + { + if ($rejectedTime !== null && !($rejectedTime instanceof DateTimeImmutable)) { + $rejectedTime = new DateTimeImmutable($rejectedTime); + } + + $this->fields['rejectedTime'] = $rejectedTime; + + return $this; + } + + private function setCanceledTime(null|DateTimeImmutable|string $canceledTime): static + { + if ($canceledTime !== null && !($canceledTime instanceof DateTimeImmutable)) { + $canceledTime = new DateTimeImmutable($canceledTime); + } + + $this->fields['canceledTime'] = $canceledTime; + + return $this; + } + + /** + * @param null|array[]|ResourceLink[] $links + */ + private function setLinks(null|array $links): static + { + $links = $links !== null ? array_map( + fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), + $links, + ) : null; + + $this->fields['_links'] = $links; + + return $this; + } +} diff --git a/src/Model/QuoteCreateOrderAcceptanceFulfillment.php b/src/Model/QuoteCreateOrderAcceptanceFulfillment.php new file mode 100644 index 000000000..f7e896b9a --- /dev/null +++ b/src/Model/QuoteCreateOrderAcceptanceFulfillment.php @@ -0,0 +1,79 @@ +setCondition($data['condition']); + } + if (array_key_exists('isFulfilled', $data)) { + $this->setIsFulfilled($data['isFulfilled']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getCondition(): ?string + { + return $this->fields['condition'] ?? null; + } + + public function setCondition(null|string $condition): static + { + $this->fields['condition'] = $condition; + + return $this; + } + + public function getIsFulfilled(): ?bool + { + return $this->fields['isFulfilled'] ?? null; + } + + public function setIsFulfilled(null|bool $isFulfilled): static + { + $this->fields['isFulfilled'] = $isFulfilled; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('condition', $this->fields)) { + $data['condition'] = $this->fields['condition']; + } + if (array_key_exists('isFulfilled', $this->fields)) { + $data['isFulfilled'] = $this->fields['isFulfilled']; + } + + return $data; + } +} diff --git a/src/Model/QuoteEmbedded.php b/src/Model/QuoteCreateOrderEmbedded.php similarity index 78% rename from src/Model/QuoteEmbedded.php rename to src/Model/QuoteCreateOrderEmbedded.php index 9e3f3ee59..a669a7992 100644 --- a/src/Model/QuoteEmbedded.php +++ b/src/Model/QuoteCreateOrderEmbedded.php @@ -15,7 +15,7 @@ use JsonSerializable; -class QuoteEmbedded implements JsonSerializable +class QuoteCreateOrderEmbedded implements JsonSerializable { private array $fields = []; @@ -30,6 +30,9 @@ public function __construct(array $data = []) if (array_key_exists('order', $data)) { $this->setOrder($data['order']); } + if (array_key_exists('invoice', $data)) { + $this->setInvoice($data['invoice']); + } } public static function from(array $data = []): self @@ -73,6 +76,18 @@ public function setOrder(null|object $order): static return $this; } + public function getInvoice(): ?object + { + return $this->fields['invoice'] ?? null; + } + + public function setInvoice(null|object $invoice): static + { + $this->fields['invoice'] = $invoice; + + return $this; + } + public function jsonSerialize(): array { $data = []; @@ -85,6 +100,9 @@ public function jsonSerialize(): array if (array_key_exists('order', $this->fields)) { $data['order'] = $this->fields['order']; } + if (array_key_exists('invoice', $this->fields)) { + $data['invoice'] = $this->fields['invoice']; + } return $data; } diff --git a/src/Model/QuoteInvoicePreview.php b/src/Model/QuoteCreateOrderInvoicePreview.php similarity index 71% rename from src/Model/QuoteInvoicePreview.php rename to src/Model/QuoteCreateOrderInvoicePreview.php index 12b3dde3e..fbb56f66a 100644 --- a/src/Model/QuoteInvoicePreview.php +++ b/src/Model/QuoteCreateOrderInvoicePreview.php @@ -15,7 +15,7 @@ use JsonSerializable; -class QuoteInvoicePreview implements JsonSerializable +class QuoteCreateOrderInvoicePreview implements JsonSerializable { private array $fields = []; @@ -52,15 +52,15 @@ public function setCurrency(null|string $currency): static return $this; } - public function getInitialAmounts(): ?QuoteInvoicePreviewInitialAmounts + public function getInitialAmounts(): ?QuoteCreateOrderInvoicePreviewInitialAmounts { return $this->fields['initialAmounts'] ?? null; } - public function setInitialAmounts(null|QuoteInvoicePreviewInitialAmounts|array $initialAmounts): static + public function setInitialAmounts(null|QuoteCreateOrderInvoicePreviewInitialAmounts|array $initialAmounts): static { - if ($initialAmounts !== null && !($initialAmounts instanceof QuoteInvoicePreviewInitialAmounts)) { - $initialAmounts = QuoteInvoicePreviewInitialAmounts::from($initialAmounts); + if ($initialAmounts !== null && !($initialAmounts instanceof QuoteCreateOrderInvoicePreviewInitialAmounts)) { + $initialAmounts = QuoteCreateOrderInvoicePreviewInitialAmounts::from($initialAmounts); } $this->fields['initialAmounts'] = $initialAmounts; @@ -68,15 +68,15 @@ public function setInitialAmounts(null|QuoteInvoicePreviewInitialAmounts|array $ return $this; } - public function getRecurringAmounts(): ?QuoteInvoicePreviewRecurringAmounts + public function getRecurringAmounts(): ?QuoteCreateOrderInvoicePreviewRecurringAmounts { return $this->fields['recurringAmounts'] ?? null; } - public function setRecurringAmounts(null|QuoteInvoicePreviewRecurringAmounts|array $recurringAmounts): static + public function setRecurringAmounts(null|QuoteCreateOrderInvoicePreviewRecurringAmounts|array $recurringAmounts): static { - if ($recurringAmounts !== null && !($recurringAmounts instanceof QuoteInvoicePreviewRecurringAmounts)) { - $recurringAmounts = QuoteInvoicePreviewRecurringAmounts::from($recurringAmounts); + if ($recurringAmounts !== null && !($recurringAmounts instanceof QuoteCreateOrderInvoicePreviewRecurringAmounts)) { + $recurringAmounts = QuoteCreateOrderInvoicePreviewRecurringAmounts::from($recurringAmounts); } $this->fields['recurringAmounts'] = $recurringAmounts; @@ -85,7 +85,7 @@ public function setRecurringAmounts(null|QuoteInvoicePreviewRecurringAmounts|arr } /** - * @return null|QuoteInvoicePreviewItems[] + * @return null|QuoteCreateOrderInvoicePreviewItems[] */ public function getItems(): ?array { @@ -93,12 +93,12 @@ public function getItems(): ?array } /** - * @param null|array[]|QuoteInvoicePreviewItems[] $items + * @param null|array[]|QuoteCreateOrderInvoicePreviewItems[] $items */ public function setItems(null|array $items): static { $items = $items !== null ? array_map( - fn ($value) => $value instanceof QuoteInvoicePreviewItems ? $value : QuoteInvoicePreviewItems::from($value), + fn ($value) => $value instanceof QuoteCreateOrderInvoicePreviewItems ? $value : QuoteCreateOrderInvoicePreviewItems::from($value), $items, ) : null; diff --git a/src/Model/QuoteInvoicePreviewInitialAmounts.php b/src/Model/QuoteCreateOrderInvoicePreviewInitialAmounts.php similarity index 97% rename from src/Model/QuoteInvoicePreviewInitialAmounts.php rename to src/Model/QuoteCreateOrderInvoicePreviewInitialAmounts.php index 4af0a7615..faeef6761 100644 --- a/src/Model/QuoteInvoicePreviewInitialAmounts.php +++ b/src/Model/QuoteCreateOrderInvoicePreviewInitialAmounts.php @@ -15,7 +15,7 @@ use JsonSerializable; -class QuoteInvoicePreviewInitialAmounts implements JsonSerializable +class QuoteCreateOrderInvoicePreviewInitialAmounts implements JsonSerializable { private array $fields = []; diff --git a/src/Model/QuoteInvoicePreviewItems.php b/src/Model/QuoteCreateOrderInvoicePreviewItems.php similarity index 99% rename from src/Model/QuoteInvoicePreviewItems.php rename to src/Model/QuoteCreateOrderInvoicePreviewItems.php index 655e9338b..f5cb0472e 100644 --- a/src/Model/QuoteInvoicePreviewItems.php +++ b/src/Model/QuoteCreateOrderInvoicePreviewItems.php @@ -15,7 +15,7 @@ use JsonSerializable; -class QuoteInvoicePreviewItems implements JsonSerializable +class QuoteCreateOrderInvoicePreviewItems implements JsonSerializable { public const TYPE_DEBIT = 'debit'; diff --git a/src/Model/QuoteInvoicePreviewRecurringAmounts.php b/src/Model/QuoteCreateOrderInvoicePreviewRecurringAmounts.php similarity index 97% rename from src/Model/QuoteInvoicePreviewRecurringAmounts.php rename to src/Model/QuoteCreateOrderInvoicePreviewRecurringAmounts.php index c048b0fa9..b2b3b7d39 100644 --- a/src/Model/QuoteInvoicePreviewRecurringAmounts.php +++ b/src/Model/QuoteCreateOrderInvoicePreviewRecurringAmounts.php @@ -15,7 +15,7 @@ use JsonSerializable; -class QuoteInvoicePreviewRecurringAmounts implements JsonSerializable +class QuoteCreateOrderInvoicePreviewRecurringAmounts implements JsonSerializable { private array $fields = []; diff --git a/src/Model/QuoteItems.php b/src/Model/QuoteCreateOrderItems.php similarity index 81% rename from src/Model/QuoteItems.php rename to src/Model/QuoteCreateOrderItems.php index 2f2b1cb06..3e317f60d 100644 --- a/src/Model/QuoteItems.php +++ b/src/Model/QuoteCreateOrderItems.php @@ -17,7 +17,7 @@ use DateTimeInterface; use JsonSerializable; -class QuoteItems implements JsonSerializable +class QuoteCreateOrderItems implements JsonSerializable { private array $fields = []; @@ -38,6 +38,9 @@ public function __construct(array $data = []) if (array_key_exists('priceDescription', $data)) { $this->setPriceDescription($data['priceDescription']); } + if (array_key_exists('usageLimits', $data)) { + $this->setUsageLimits($data['usageLimits']); + } if (array_key_exists('createdTime', $data)) { $this->setCreatedTime($data['createdTime']); } @@ -111,6 +114,22 @@ public function setPriceDescription(null|string $priceDescription): static return $this; } + public function getUsageLimits(): ?QuoteCreateOrderItemsUsageLimits + { + return $this->fields['usageLimits'] ?? null; + } + + public function setUsageLimits(null|QuoteCreateOrderItemsUsageLimits|array $usageLimits): static + { + if ($usageLimits !== null && !($usageLimits instanceof QuoteCreateOrderItemsUsageLimits)) { + $usageLimits = QuoteCreateOrderItemsUsageLimits::from($usageLimits); + } + + $this->fields['usageLimits'] = $usageLimits; + + return $this; + } + public function getCreatedTime(): ?DateTimeImmutable { return $this->fields['createdTime'] ?? null; @@ -121,15 +140,15 @@ public function getUpdatedTime(): ?DateTimeImmutable return $this->fields['updatedTime'] ?? null; } - public function getEmbedded(): ?QuoteItemsEmbedded + public function getEmbedded(): ?QuoteCreateOrderItemsEmbedded { return $this->fields['_embedded'] ?? null; } - public function setEmbedded(null|QuoteItemsEmbedded|array $embedded): static + public function setEmbedded(null|QuoteCreateOrderItemsEmbedded|array $embedded): static { - if ($embedded !== null && !($embedded instanceof QuoteItemsEmbedded)) { - $embedded = QuoteItemsEmbedded::from($embedded); + if ($embedded !== null && !($embedded instanceof QuoteCreateOrderItemsEmbedded)) { + $embedded = QuoteCreateOrderItemsEmbedded::from($embedded); } $this->fields['_embedded'] = $embedded; @@ -155,6 +174,9 @@ public function jsonSerialize(): array if (array_key_exists('priceDescription', $this->fields)) { $data['priceDescription'] = $this->fields['priceDescription']; } + if (array_key_exists('usageLimits', $this->fields)) { + $data['usageLimits'] = $this->fields['usageLimits']?->jsonSerialize(); + } if (array_key_exists('createdTime', $this->fields)) { $data['createdTime'] = $this->fields['createdTime']?->format(DateTimeInterface::RFC3339); } diff --git a/src/Model/QuoteItemsEmbedded.php b/src/Model/QuoteCreateOrderItemsEmbedded.php similarity index 94% rename from src/Model/QuoteItemsEmbedded.php rename to src/Model/QuoteCreateOrderItemsEmbedded.php index 5d2344116..fa4646e0b 100644 --- a/src/Model/QuoteItemsEmbedded.php +++ b/src/Model/QuoteCreateOrderItemsEmbedded.php @@ -15,7 +15,7 @@ use JsonSerializable; -class QuoteItemsEmbedded implements JsonSerializable +class QuoteCreateOrderItemsEmbedded implements JsonSerializable { private array $fields = []; diff --git a/src/Model/QuoteCreateOrderItemsUsageLimits.php b/src/Model/QuoteCreateOrderItemsUsageLimits.php new file mode 100644 index 000000000..0874da648 --- /dev/null +++ b/src/Model/QuoteCreateOrderItemsUsageLimits.php @@ -0,0 +1,81 @@ +setSoftLimit($data['softLimit']); + } + if (array_key_exists('hardLimit', $data)) { + $this->setHardLimit($data['hardLimit']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getSoftLimit(): ?QuoteCreateOrderItemsUsageLimitsSoftLimit + { + return $this->fields['softLimit'] ?? null; + } + + public function setSoftLimit(null|QuoteCreateOrderItemsUsageLimitsSoftLimit|array $softLimit): static + { + if ($softLimit !== null && !($softLimit instanceof QuoteCreateOrderItemsUsageLimitsSoftLimit)) { + $softLimit = QuoteCreateOrderItemsUsageLimitsSoftLimit::from($softLimit); + } + + $this->fields['softLimit'] = $softLimit; + + return $this; + } + + public function getHardLimit(): ?QuoteCreateOrderItemsUsageLimitsHardLimit + { + return $this->fields['hardLimit'] ?? null; + } + + public function setHardLimit(null|QuoteCreateOrderItemsUsageLimitsHardLimit|array $hardLimit): static + { + if ($hardLimit !== null && !($hardLimit instanceof QuoteCreateOrderItemsUsageLimitsHardLimit)) { + $hardLimit = QuoteCreateOrderItemsUsageLimitsHardLimit::from($hardLimit); + } + + $this->fields['hardLimit'] = $hardLimit; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('softLimit', $this->fields)) { + $data['softLimit'] = $this->fields['softLimit']?->jsonSerialize(); + } + if (array_key_exists('hardLimit', $this->fields)) { + $data['hardLimit'] = $this->fields['hardLimit']?->jsonSerialize(); + } + + return $data; + } +} diff --git a/src/Model/OrderItemUsageLimitsSoftLimit.php b/src/Model/QuoteCreateOrderItemsUsageLimitsHardLimit.php similarity index 95% rename from src/Model/OrderItemUsageLimitsSoftLimit.php rename to src/Model/QuoteCreateOrderItemsUsageLimitsHardLimit.php index 8fd17e673..5d91e9a94 100644 --- a/src/Model/OrderItemUsageLimitsSoftLimit.php +++ b/src/Model/QuoteCreateOrderItemsUsageLimitsHardLimit.php @@ -15,7 +15,7 @@ use JsonSerializable; -class OrderItemUsageLimitsSoftLimit implements JsonSerializable +class QuoteCreateOrderItemsUsageLimitsHardLimit implements JsonSerializable { private array $fields = []; diff --git a/src/Model/OrderItemUsageLimitsHardLimit.php b/src/Model/QuoteCreateOrderItemsUsageLimitsSoftLimit.php similarity index 95% rename from src/Model/OrderItemUsageLimitsHardLimit.php rename to src/Model/QuoteCreateOrderItemsUsageLimitsSoftLimit.php index cafd099b3..3da9322de 100644 --- a/src/Model/OrderItemUsageLimitsHardLimit.php +++ b/src/Model/QuoteCreateOrderItemsUsageLimitsSoftLimit.php @@ -15,7 +15,7 @@ use JsonSerializable; -class OrderItemUsageLimitsHardLimit implements JsonSerializable +class QuoteCreateOrderItemsUsageLimitsSoftLimit implements JsonSerializable { private array $fields = []; diff --git a/src/Model/QuoteSignature.php b/src/Model/QuoteCreateOrderSignature.php similarity index 96% rename from src/Model/QuoteSignature.php rename to src/Model/QuoteCreateOrderSignature.php index a55481eaf..c95dbfca3 100644 --- a/src/Model/QuoteSignature.php +++ b/src/Model/QuoteCreateOrderSignature.php @@ -15,7 +15,7 @@ use JsonSerializable; -class QuoteSignature implements JsonSerializable +class QuoteCreateOrderSignature implements JsonSerializable { private array $fields = []; diff --git a/src/Model/QuoteFactory.php b/src/Model/QuoteFactory.php new file mode 100644 index 000000000..966c3d396 --- /dev/null +++ b/src/Model/QuoteFactory.php @@ -0,0 +1,29 @@ + QuoteChangeOrder::from($data), + 'create' => QuoteCreateOrder::from($data), + 'reactivate' => QuoteReactivateOrder::from($data), + default => throw new UnknownDiscriminatorValueException(), + }; + } +} diff --git a/src/Model/QuoteReactivateOrder.php b/src/Model/QuoteReactivateOrder.php new file mode 100644 index 000000000..62c87c4aa --- /dev/null +++ b/src/Model/QuoteReactivateOrder.php @@ -0,0 +1,747 @@ +setId($data['id']); + } + if (array_key_exists('type', $data)) { + $this->setType($data['type']); + } + if (array_key_exists('acceptanceConditions', $data)) { + $this->setAcceptanceConditions($data['acceptanceConditions']); + } + if (array_key_exists('acceptanceFulfillment', $data)) { + $this->setAcceptanceFulfillment($data['acceptanceFulfillment']); + } + if (array_key_exists('orderId', $data)) { + $this->setOrderId($data['orderId']); + } + if (array_key_exists('invoiceId', $data)) { + $this->setInvoiceId($data['invoiceId']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + if (array_key_exists('websiteId', $data)) { + $this->setWebsiteId($data['websiteId']); + } + if (array_key_exists('customerId', $data)) { + $this->setCustomerId($data['customerId']); + } + if (array_key_exists('items', $data)) { + $this->setItems($data['items']); + } + if (array_key_exists('effectiveTime', $data)) { + $this->setEffectiveTime($data['effectiveTime']); + } + if (array_key_exists('renewalTime', $data)) { + $this->setRenewalTime($data['renewalTime']); + } + if (array_key_exists('paymentInstrumentId', $data)) { + $this->setPaymentInstrumentId($data['paymentInstrumentId']); + } + if (array_key_exists('invoicePreview', $data)) { + $this->setInvoicePreview($data['invoicePreview']); + } + if (array_key_exists('paymentTerms', $data)) { + $this->setPaymentTerms($data['paymentTerms']); + } + if (array_key_exists('expirationTime', $data)) { + $this->setExpirationTime($data['expirationTime']); + } + if (array_key_exists('issuedTime', $data)) { + $this->setIssuedTime($data['issuedTime']); + } + if (array_key_exists('acceptedTime', $data)) { + $this->setAcceptedTime($data['acceptedTime']); + } + if (array_key_exists('rejectedTime', $data)) { + $this->setRejectedTime($data['rejectedTime']); + } + if (array_key_exists('canceledTime', $data)) { + $this->setCanceledTime($data['canceledTime']); + } + if (array_key_exists('redirectUrl', $data)) { + $this->setRedirectUrl($data['redirectUrl']); + } + if (array_key_exists('signature', $data)) { + $this->setSignature($data['signature']); + } + if (array_key_exists('shipping', $data)) { + $this->setShipping($data['shipping']); + } + if (array_key_exists('tax', $data)) { + $this->setTax($data['tax']); + } + if (array_key_exists('couponIds', $data)) { + $this->setCouponIds($data['couponIds']); + } + if (array_key_exists('_links', $data)) { + $this->setLinks($data['_links']); + } + if (array_key_exists('_embedded', $data)) { + $this->setEmbedded($data['_embedded']); + } + if (array_key_exists('renewalPolicy', $data)) { + $this->setRenewalPolicy($data['renewalPolicy']); + } + if (array_key_exists('deliveryAddress', $data)) { + $this->setDeliveryAddress($data['deliveryAddress']); + } + if (array_key_exists('prorated', $data)) { + $this->setProrated($data['prorated']); + } + if (array_key_exists('keepTrial', $data)) { + $this->setKeepTrial($data['keepTrial']); + } + if (array_key_exists('billingAddress', $data)) { + $this->setBillingAddress($data['billingAddress']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getAction(): string + { + return 'reactivate'; + } + + public function getId(): ?string + { + return $this->fields['id'] ?? null; + } + + public function getType(): ?string + { + return $this->fields['type'] ?? null; + } + + /** + * @return null|string[] + */ + public function getAcceptanceConditions(): ?array + { + return $this->fields['acceptanceConditions'] ?? null; + } + + /** + * @param null|string[] $acceptanceConditions + */ + public function setAcceptanceConditions(null|array $acceptanceConditions): static + { + $this->fields['acceptanceConditions'] = $acceptanceConditions; + + return $this; + } + + /** + * @return null|QuoteCreateOrderAcceptanceFulfillment[] + */ + public function getAcceptanceFulfillment(): ?array + { + return $this->fields['acceptanceFulfillment'] ?? null; + } + + public function getOrderId(): string + { + return $this->fields['orderId']; + } + + public function setOrderId(string $orderId): static + { + $this->fields['orderId'] = $orderId; + + return $this; + } + + public function getInvoiceId(): ?string + { + return $this->fields['invoiceId'] ?? null; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function getWebsiteId(): string + { + return $this->fields['websiteId']; + } + + public function setWebsiteId(string $websiteId): static + { + $this->fields['websiteId'] = $websiteId; + + return $this; + } + + public function getCustomerId(): string + { + return $this->fields['customerId']; + } + + public function setCustomerId(string $customerId): static + { + $this->fields['customerId'] = $customerId; + + return $this; + } + + /** + * @return QuoteCreateOrderItems[] + */ + public function getItems(): array + { + return $this->fields['items']; + } + + /** + * @param array[]|QuoteCreateOrderItems[] $items + */ + public function setItems(array $items): static + { + $items = array_map( + fn ($value) => $value instanceof QuoteCreateOrderItems ? $value : QuoteCreateOrderItems::from($value), + $items, + ); + + $this->fields['items'] = $items; + + return $this; + } + + public function getEffectiveTime(): ?DateTimeImmutable + { + return $this->fields['effectiveTime'] ?? null; + } + + public function setEffectiveTime(null|DateTimeImmutable|string $effectiveTime): static + { + if ($effectiveTime !== null && !($effectiveTime instanceof DateTimeImmutable)) { + $effectiveTime = new DateTimeImmutable($effectiveTime); + } + + $this->fields['effectiveTime'] = $effectiveTime; + + return $this; + } + + public function getRenewalTime(): ?DateTimeImmutable + { + return $this->fields['renewalTime'] ?? null; + } + + public function setRenewalTime(null|DateTimeImmutable|string $renewalTime): static + { + if ($renewalTime !== null && !($renewalTime instanceof DateTimeImmutable)) { + $renewalTime = new DateTimeImmutable($renewalTime); + } + + $this->fields['renewalTime'] = $renewalTime; + + return $this; + } + + public function getPaymentInstrumentId(): ?string + { + return $this->fields['paymentInstrumentId'] ?? null; + } + + public function setPaymentInstrumentId(null|string $paymentInstrumentId): static + { + $this->fields['paymentInstrumentId'] = $paymentInstrumentId; + + return $this; + } + + public function getInvoicePreview(): ?QuoteCreateOrderInvoicePreview + { + return $this->fields['invoicePreview'] ?? null; + } + + public function setInvoicePreview(null|QuoteCreateOrderInvoicePreview|array $invoicePreview): static + { + if ($invoicePreview !== null && !($invoicePreview instanceof QuoteCreateOrderInvoicePreview)) { + $invoicePreview = QuoteCreateOrderInvoicePreview::from($invoicePreview); + } + + $this->fields['invoicePreview'] = $invoicePreview; + + return $this; + } + + public function getPaymentTerms(): ?string + { + return $this->fields['paymentTerms'] ?? null; + } + + public function setPaymentTerms(null|string $paymentTerms): static + { + $this->fields['paymentTerms'] = $paymentTerms; + + return $this; + } + + public function getExpirationTime(): ?DateTimeImmutable + { + return $this->fields['expirationTime'] ?? null; + } + + public function setExpirationTime(null|DateTimeImmutable|string $expirationTime): static + { + if ($expirationTime !== null && !($expirationTime instanceof DateTimeImmutable)) { + $expirationTime = new DateTimeImmutable($expirationTime); + } + + $this->fields['expirationTime'] = $expirationTime; + + return $this; + } + + public function getIssuedTime(): ?DateTimeImmutable + { + return $this->fields['issuedTime'] ?? null; + } + + public function getAcceptedTime(): ?DateTimeImmutable + { + return $this->fields['acceptedTime'] ?? null; + } + + public function getRejectedTime(): ?DateTimeImmutable + { + return $this->fields['rejectedTime'] ?? null; + } + + public function getCanceledTime(): ?DateTimeImmutable + { + return $this->fields['canceledTime'] ?? null; + } + + public function getRedirectUrl(): ?string + { + return $this->fields['redirectUrl'] ?? null; + } + + public function setRedirectUrl(null|string $redirectUrl): static + { + $this->fields['redirectUrl'] = $redirectUrl; + + return $this; + } + + public function getSignature(): ?QuoteCreateOrderSignature + { + return $this->fields['signature'] ?? null; + } + + public function setSignature(null|QuoteCreateOrderSignature|array $signature): static + { + if ($signature !== null && !($signature instanceof QuoteCreateOrderSignature)) { + $signature = QuoteCreateOrderSignature::from($signature); + } + + $this->fields['signature'] = $signature; + + return $this; + } + + public function getShipping(): ?Shipping + { + return $this->fields['shipping'] ?? null; + } + + public function setShipping(null|Shipping|array $shipping): static + { + if ($shipping !== null && !($shipping instanceof Shipping)) { + $shipping = ShippingFactory::from($shipping); + } + + $this->fields['shipping'] = $shipping; + + return $this; + } + + public function getTax(): ?Taxes + { + return $this->fields['tax'] ?? null; + } + + public function setTax(null|Taxes|array $tax): static + { + if ($tax !== null && !($tax instanceof Taxes)) { + $tax = TaxesFactory::from($tax); + } + + $this->fields['tax'] = $tax; + + return $this; + } + + /** + * @return null|string[] + */ + public function getCouponIds(): ?array + { + return $this->fields['couponIds'] ?? null; + } + + /** + * @param null|string[] $couponIds + */ + public function setCouponIds(null|array $couponIds): static + { + $this->fields['couponIds'] = $couponIds; + + return $this; + } + + /** + * @return null|ResourceLink[] + */ + public function getLinks(): ?array + { + return $this->fields['_links'] ?? null; + } + + public function getEmbedded(): ?QuoteCreateOrderEmbedded + { + return $this->fields['_embedded'] ?? null; + } + + public function setEmbedded(null|QuoteCreateOrderEmbedded|array $embedded): static + { + if ($embedded !== null && !($embedded instanceof QuoteCreateOrderEmbedded)) { + $embedded = QuoteCreateOrderEmbedded::from($embedded); + } + + $this->fields['_embedded'] = $embedded; + + return $this; + } + + public function getRenewalPolicy(): ?string + { + return $this->fields['renewalPolicy'] ?? null; + } + + public function setRenewalPolicy(null|string $renewalPolicy): static + { + $this->fields['renewalPolicy'] = $renewalPolicy; + + return $this; + } + + public function getDeliveryAddress(): ?ContactObject + { + return $this->fields['deliveryAddress'] ?? null; + } + + public function setDeliveryAddress(null|ContactObject|array $deliveryAddress): static + { + if ($deliveryAddress !== null && !($deliveryAddress instanceof ContactObject)) { + $deliveryAddress = ContactObject::from($deliveryAddress); + } + + $this->fields['deliveryAddress'] = $deliveryAddress; + + return $this; + } + + public function getProrated(): ?bool + { + return $this->fields['prorated'] ?? null; + } + + public function setProrated(null|bool $prorated): static + { + $this->fields['prorated'] = $prorated; + + return $this; + } + + public function getKeepTrial(): ?bool + { + return $this->fields['keepTrial'] ?? null; + } + + public function setKeepTrial(null|bool $keepTrial): static + { + $this->fields['keepTrial'] = $keepTrial; + + return $this; + } + + public function getBillingAddress(): ?ContactObject + { + return $this->fields['billingAddress'] ?? null; + } + + public function setBillingAddress(null|ContactObject|array $billingAddress): static + { + if ($billingAddress !== null && !($billingAddress instanceof ContactObject)) { + $billingAddress = ContactObject::from($billingAddress); + } + + $this->fields['billingAddress'] = $billingAddress; + + return $this; + } + + public function jsonSerialize(): array + { + $data = [ + 'action' => 'reactivate', + ]; + if (array_key_exists('id', $this->fields)) { + $data['id'] = $this->fields['id']; + } + if (array_key_exists('type', $this->fields)) { + $data['type'] = $this->fields['type']; + } + if (array_key_exists('acceptanceConditions', $this->fields)) { + $data['acceptanceConditions'] = $this->fields['acceptanceConditions']; + } + if (array_key_exists('acceptanceFulfillment', $this->fields)) { + $data['acceptanceFulfillment'] = $this->fields['acceptanceFulfillment']; + } + if (array_key_exists('orderId', $this->fields)) { + $data['orderId'] = $this->fields['orderId']; + } + if (array_key_exists('invoiceId', $this->fields)) { + $data['invoiceId'] = $this->fields['invoiceId']; + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + if (array_key_exists('websiteId', $this->fields)) { + $data['websiteId'] = $this->fields['websiteId']; + } + if (array_key_exists('customerId', $this->fields)) { + $data['customerId'] = $this->fields['customerId']; + } + if (array_key_exists('items', $this->fields)) { + $data['items'] = $this->fields['items']; + } + if (array_key_exists('effectiveTime', $this->fields)) { + $data['effectiveTime'] = $this->fields['effectiveTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('renewalTime', $this->fields)) { + $data['renewalTime'] = $this->fields['renewalTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('paymentInstrumentId', $this->fields)) { + $data['paymentInstrumentId'] = $this->fields['paymentInstrumentId']; + } + if (array_key_exists('invoicePreview', $this->fields)) { + $data['invoicePreview'] = $this->fields['invoicePreview']?->jsonSerialize(); + } + if (array_key_exists('paymentTerms', $this->fields)) { + $data['paymentTerms'] = $this->fields['paymentTerms']; + } + if (array_key_exists('expirationTime', $this->fields)) { + $data['expirationTime'] = $this->fields['expirationTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('issuedTime', $this->fields)) { + $data['issuedTime'] = $this->fields['issuedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('acceptedTime', $this->fields)) { + $data['acceptedTime'] = $this->fields['acceptedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('rejectedTime', $this->fields)) { + $data['rejectedTime'] = $this->fields['rejectedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('canceledTime', $this->fields)) { + $data['canceledTime'] = $this->fields['canceledTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('redirectUrl', $this->fields)) { + $data['redirectUrl'] = $this->fields['redirectUrl']; + } + if (array_key_exists('signature', $this->fields)) { + $data['signature'] = $this->fields['signature']?->jsonSerialize(); + } + if (array_key_exists('shipping', $this->fields)) { + $data['shipping'] = $this->fields['shipping']?->jsonSerialize(); + } + if (array_key_exists('tax', $this->fields)) { + $data['tax'] = $this->fields['tax']?->jsonSerialize(); + } + if (array_key_exists('couponIds', $this->fields)) { + $data['couponIds'] = $this->fields['couponIds']; + } + if (array_key_exists('_links', $this->fields)) { + $data['_links'] = $this->fields['_links']; + } + if (array_key_exists('_embedded', $this->fields)) { + $data['_embedded'] = $this->fields['_embedded']?->jsonSerialize(); + } + if (array_key_exists('renewalPolicy', $this->fields)) { + $data['renewalPolicy'] = $this->fields['renewalPolicy']; + } + if (array_key_exists('deliveryAddress', $this->fields)) { + $data['deliveryAddress'] = $this->fields['deliveryAddress']?->jsonSerialize(); + } + if (array_key_exists('prorated', $this->fields)) { + $data['prorated'] = $this->fields['prorated']; + } + if (array_key_exists('keepTrial', $this->fields)) { + $data['keepTrial'] = $this->fields['keepTrial']; + } + if (array_key_exists('billingAddress', $this->fields)) { + $data['billingAddress'] = $this->fields['billingAddress']?->jsonSerialize(); + } + + return $data; + } + + private function setId(null|string $id): static + { + $this->fields['id'] = $id; + + return $this; + } + + private function setType(null|string $type): static + { + $this->fields['type'] = $type; + + return $this; + } + + /** + * @param null|array[]|QuoteCreateOrderAcceptanceFulfillment[] $acceptanceFulfillment + */ + private function setAcceptanceFulfillment(null|array $acceptanceFulfillment): static + { + $acceptanceFulfillment = $acceptanceFulfillment !== null ? array_map( + fn ($value) => $value instanceof QuoteCreateOrderAcceptanceFulfillment ? $value : QuoteCreateOrderAcceptanceFulfillment::from($value), + $acceptanceFulfillment, + ) : null; + + $this->fields['acceptanceFulfillment'] = $acceptanceFulfillment; + + return $this; + } + + private function setInvoiceId(null|string $invoiceId): static + { + $this->fields['invoiceId'] = $invoiceId; + + return $this; + } + + private function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + private function setIssuedTime(null|DateTimeImmutable|string $issuedTime): static + { + if ($issuedTime !== null && !($issuedTime instanceof DateTimeImmutable)) { + $issuedTime = new DateTimeImmutable($issuedTime); + } + + $this->fields['issuedTime'] = $issuedTime; + + return $this; + } + + private function setAcceptedTime(null|DateTimeImmutable|string $acceptedTime): static + { + if ($acceptedTime !== null && !($acceptedTime instanceof DateTimeImmutable)) { + $acceptedTime = new DateTimeImmutable($acceptedTime); + } + + $this->fields['acceptedTime'] = $acceptedTime; + + return $this; + } + + private function setRejectedTime(null|DateTimeImmutable|string $rejectedTime): static + { + if ($rejectedTime !== null && !($rejectedTime instanceof DateTimeImmutable)) { + $rejectedTime = new DateTimeImmutable($rejectedTime); + } + + $this->fields['rejectedTime'] = $rejectedTime; + + return $this; + } + + private function setCanceledTime(null|DateTimeImmutable|string $canceledTime): static + { + if ($canceledTime !== null && !($canceledTime instanceof DateTimeImmutable)) { + $canceledTime = new DateTimeImmutable($canceledTime); + } + + $this->fields['canceledTime'] = $canceledTime; + + return $this; + } + + /** + * @param null|array[]|ResourceLink[] $links + */ + private function setLinks(null|array $links): static + { + $links = $links !== null ? array_map( + fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), + $links, + ) : null; + + $this->fields['_links'] = $links; + + return $this; + } +} diff --git a/src/Model/ReportDeclinedTransactions.php b/src/Model/ReportDeclinedTransactions.php index 46693a697..6c212af71 100644 --- a/src/Model/ReportDeclinedTransactions.php +++ b/src/Model/ReportDeclinedTransactions.php @@ -21,9 +21,6 @@ class ReportDeclinedTransactions implements JsonSerializable public function __construct(array $data = []) { - if (array_key_exists('totalCount', $data)) { - $this->setTotalCount($data['totalCount']); - } if (array_key_exists('data', $data)) { $this->setData($data['data']); } @@ -34,18 +31,6 @@ public static function from(array $data = []): self return new self($data); } - public function getTotalCount(): ?int - { - return $this->fields['totalCount'] ?? null; - } - - public function setTotalCount(null|int $totalCount): static - { - $this->fields['totalCount'] = $totalCount; - - return $this; - } - /** * @return null|ReportDeclinedTransactionsData[] */ @@ -72,9 +57,6 @@ public function setData(null|array $data): static public function jsonSerialize(): array { $data = []; - if (array_key_exists('totalCount', $this->fields)) { - $data['totalCount'] = $this->fields['totalCount']; - } if (array_key_exists('data', $this->fields)) { $data['data'] = $this->fields['data']; } diff --git a/src/Model/RichBillingPortal.php b/src/Model/RichBillingPortal.php new file mode 100644 index 000000000..0a0d3b4bc --- /dev/null +++ b/src/Model/RichBillingPortal.php @@ -0,0 +1,246 @@ +setId($data['id']); + } + if (array_key_exists('websiteId', $data)) { + $this->setWebsiteId($data['websiteId']); + } + if (array_key_exists('name', $data)) { + $this->setName($data['name']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + if (array_key_exists('plans', $data)) { + $this->setPlans($data['plans']); + } + if (array_key_exists('addons', $data)) { + $this->setAddons($data['addons']); + } + if (array_key_exists('createdTime', $data)) { + $this->setCreatedTime($data['createdTime']); + } + if (array_key_exists('updatedTime', $data)) { + $this->setUpdatedTime($data['updatedTime']); + } + if (array_key_exists('_links', $data)) { + $this->setLinks($data['_links']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getId(): ?string + { + return $this->fields['id'] ?? null; + } + + public function getWebsiteId(): string + { + return $this->fields['websiteId']; + } + + public function setWebsiteId(string $websiteId): static + { + $this->fields['websiteId'] = $websiteId; + + return $this; + } + + public function getName(): string + { + return $this->fields['name']; + } + + public function setName(string $name): static + { + $this->fields['name'] = $name; + + return $this; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + /** + * @return RichBillingPortalPlans[] + */ + public function getPlans(): array + { + return $this->fields['plans']; + } + + /** + * @param array[]|RichBillingPortalPlans[] $plans + */ + public function setPlans(array $plans): static + { + $plans = array_map( + fn ($value) => $value instanceof RichBillingPortalPlans ? $value : RichBillingPortalPlans::from($value), + $plans, + ); + + $this->fields['plans'] = $plans; + + return $this; + } + + /** + * @return null|RichBillingPortalAddons[] + */ + public function getAddons(): ?array + { + return $this->fields['addons'] ?? null; + } + + /** + * @param null|array[]|RichBillingPortalAddons[] $addons + */ + public function setAddons(null|array $addons): static + { + $addons = $addons !== null ? array_map( + fn ($value) => $value instanceof RichBillingPortalAddons ? $value : RichBillingPortalAddons::from($value), + $addons, + ) : null; + + $this->fields['addons'] = $addons; + + return $this; + } + + public function getCreatedTime(): ?DateTimeImmutable + { + return $this->fields['createdTime'] ?? null; + } + + public function getUpdatedTime(): ?DateTimeImmutable + { + return $this->fields['updatedTime'] ?? null; + } + + /** + * @return null|ResourceLink[] + */ + public function getLinks(): ?array + { + return $this->fields['_links'] ?? null; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('id', $this->fields)) { + $data['id'] = $this->fields['id']; + } + if (array_key_exists('websiteId', $this->fields)) { + $data['websiteId'] = $this->fields['websiteId']; + } + if (array_key_exists('name', $this->fields)) { + $data['name'] = $this->fields['name']; + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + if (array_key_exists('plans', $this->fields)) { + $data['plans'] = $this->fields['plans']; + } + if (array_key_exists('addons', $this->fields)) { + $data['addons'] = $this->fields['addons']; + } + if (array_key_exists('createdTime', $this->fields)) { + $data['createdTime'] = $this->fields['createdTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('updatedTime', $this->fields)) { + $data['updatedTime'] = $this->fields['updatedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('_links', $this->fields)) { + $data['_links'] = $this->fields['_links']; + } + + return $data; + } + + private function setId(null|string $id): static + { + $this->fields['id'] = $id; + + return $this; + } + + private function setCreatedTime(null|DateTimeImmutable|string $createdTime): static + { + if ($createdTime !== null && !($createdTime instanceof DateTimeImmutable)) { + $createdTime = new DateTimeImmutable($createdTime); + } + + $this->fields['createdTime'] = $createdTime; + + return $this; + } + + private function setUpdatedTime(null|DateTimeImmutable|string $updatedTime): static + { + if ($updatedTime !== null && !($updatedTime instanceof DateTimeImmutable)) { + $updatedTime = new DateTimeImmutable($updatedTime); + } + + $this->fields['updatedTime'] = $updatedTime; + + return $this; + } + + /** + * @param null|array[]|ResourceLink[] $links + */ + private function setLinks(null|array $links): static + { + $links = $links !== null ? array_map( + fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), + $links, + ) : null; + + $this->fields['_links'] = $links; + + return $this; + } +} diff --git a/src/Model/RichBillingPortalAddons.php b/src/Model/RichBillingPortalAddons.php new file mode 100644 index 000000000..84aec9d87 --- /dev/null +++ b/src/Model/RichBillingPortalAddons.php @@ -0,0 +1,81 @@ +setPlan($data['plan']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getPlan(): ?RichBillingPortalPlansPlan + { + return $this->fields['plan'] ?? null; + } + + public function setPlan(null|RichBillingPortalPlansPlan|array $plan): static + { + if ($plan !== null && !($plan instanceof RichBillingPortalPlansPlan)) { + $plan = RichBillingPortalPlansPlan::from($plan); + } + + $this->fields['plan'] = $plan; + + return $this; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('plan', $this->fields)) { + $data['plan'] = $this->fields['plan']?->jsonSerialize(); + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + + return $data; + } +} diff --git a/src/Model/RichBillingPortalPlans.php b/src/Model/RichBillingPortalPlans.php new file mode 100644 index 000000000..68255e17c --- /dev/null +++ b/src/Model/RichBillingPortalPlans.php @@ -0,0 +1,81 @@ +setPlan($data['plan']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getPlan(): ?RichBillingPortalPlansPlan + { + return $this->fields['plan'] ?? null; + } + + public function setPlan(null|RichBillingPortalPlansPlan|array $plan): static + { + if ($plan !== null && !($plan instanceof RichBillingPortalPlansPlan)) { + $plan = RichBillingPortalPlansPlan::from($plan); + } + + $this->fields['plan'] = $plan; + + return $this; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('plan', $this->fields)) { + $data['plan'] = $this->fields['plan']?->jsonSerialize(); + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + + return $data; + } +} diff --git a/src/Model/RichBillingPortalPlansPlan.php b/src/Model/RichBillingPortalPlansPlan.php new file mode 100644 index 000000000..8d804fd5f --- /dev/null +++ b/src/Model/RichBillingPortalPlansPlan.php @@ -0,0 +1,466 @@ +setId($data['id']); + } + if (array_key_exists('name', $data)) { + $this->setName($data['name']); + } + if (array_key_exists('description', $data)) { + $this->setDescription($data['description']); + } + if (array_key_exists('richDescription', $data)) { + $this->setRichDescription($data['richDescription']); + } + if (array_key_exists('productId', $data)) { + $this->setProductId($data['productId']); + } + if (array_key_exists('productOptions', $data)) { + $this->setProductOptions($data['productOptions']); + } + if (array_key_exists('currency', $data)) { + $this->setCurrency($data['currency']); + } + if (array_key_exists('currencySign', $data)) { + $this->setCurrencySign($data['currencySign']); + } + if (array_key_exists('pricing', $data)) { + $this->setPricing($data['pricing']); + } + if (array_key_exists('setup', $data)) { + $this->setSetup($data['setup']); + } + if (array_key_exists('customFields', $data)) { + $this->setCustomFields($data['customFields']); + } + if (array_key_exists('isActive', $data)) { + $this->setIsActive($data['isActive']); + } + if (array_key_exists('revision', $data)) { + $this->setRevision($data['revision']); + } + if (array_key_exists('isTrialOnly', $data)) { + $this->setIsTrialOnly($data['isTrialOnly']); + } + if (array_key_exists('recurringInterval', $data)) { + $this->setRecurringInterval($data['recurringInterval']); + } + if (array_key_exists('trial', $data)) { + $this->setTrial($data['trial']); + } + if (array_key_exists('meteredBilling', $data)) { + $this->setMeteredBilling($data['meteredBilling']); + } + if (array_key_exists('invoiceTimeShift', $data)) { + $this->setInvoiceTimeShift($data['invoiceTimeShift']); + } + if (array_key_exists('createdTime', $data)) { + $this->setCreatedTime($data['createdTime']); + } + if (array_key_exists('updatedTime', $data)) { + $this->setUpdatedTime($data['updatedTime']); + } + if (array_key_exists('_links', $data)) { + $this->setLinks($data['_links']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getId(): string + { + return $this->fields['id']; + } + + public function setId(string $id): static + { + $this->fields['id'] = $id; + + return $this; + } + + public function getName(): string + { + return $this->fields['name']; + } + + public function setName(string $name): static + { + $this->fields['name'] = $name; + + return $this; + } + + public function getDescription(): ?string + { + return $this->fields['description'] ?? null; + } + + public function setDescription(null|string $description): static + { + $this->fields['description'] = $description; + + return $this; + } + + public function getRichDescription(): ?string + { + return $this->fields['richDescription'] ?? null; + } + + public function setRichDescription(null|string $richDescription): static + { + $this->fields['richDescription'] = $richDescription; + + return $this; + } + + public function getProductId(): string + { + return $this->fields['productId']; + } + + public function setProductId(string $productId): static + { + $this->fields['productId'] = $productId; + + return $this; + } + + /** + * @return null|array + */ + public function getProductOptions(): ?array + { + return $this->fields['productOptions'] ?? null; + } + + /** + * @param null|array $productOptions + */ + public function setProductOptions(null|array $productOptions): static + { + $this->fields['productOptions'] = $productOptions; + + return $this; + } + + public function getCurrency(): string + { + return $this->fields['currency']; + } + + public function setCurrency(string $currency): static + { + $this->fields['currency'] = $currency; + + return $this; + } + + public function getCurrencySign(): ?string + { + return $this->fields['currencySign'] ?? null; + } + + public function getPricing(): PlanPriceFormula + { + return $this->fields['pricing']; + } + + public function setPricing(PlanPriceFormula|array $pricing): static + { + if (!($pricing instanceof PlanPriceFormula)) { + $pricing = PlanPriceFormulaFactory::from($pricing); + } + + $this->fields['pricing'] = $pricing; + + return $this; + } + + public function getSetup(): ?OneTimeSalePlanSetup + { + return $this->fields['setup'] ?? null; + } + + public function setSetup(null|OneTimeSalePlanSetup|array $setup): static + { + if ($setup !== null && !($setup instanceof OneTimeSalePlanSetup)) { + $setup = OneTimeSalePlanSetup::from($setup); + } + + $this->fields['setup'] = $setup; + + return $this; + } + + public function getCustomFields(): ?array + { + return $this->fields['customFields'] ?? null; + } + + public function setCustomFields(null|array $customFields): static + { + $this->fields['customFields'] = $customFields; + + return $this; + } + + public function getIsActive(): ?bool + { + return $this->fields['isActive'] ?? null; + } + + public function setIsActive(null|bool $isActive): static + { + $this->fields['isActive'] = $isActive; + + return $this; + } + + public function getRevision(): ?int + { + return $this->fields['revision'] ?? null; + } + + public function getIsTrialOnly(): ?bool + { + return $this->fields['isTrialOnly'] ?? null; + } + + public function getRecurringInterval(): SubscriptionOrderPlanRecurringInterval + { + return $this->fields['recurringInterval']; + } + + public function setRecurringInterval(SubscriptionOrderPlanRecurringInterval|array $recurringInterval): static + { + if (!($recurringInterval instanceof SubscriptionOrderPlanRecurringInterval)) { + $recurringInterval = SubscriptionOrderPlanRecurringInterval::from($recurringInterval); + } + + $this->fields['recurringInterval'] = $recurringInterval; + + return $this; + } + + public function getTrial(): ?SubscriptionOrderPlanTrial + { + return $this->fields['trial'] ?? null; + } + + public function setTrial(null|SubscriptionOrderPlanTrial|array $trial): static + { + if ($trial !== null && !($trial instanceof SubscriptionOrderPlanTrial)) { + $trial = SubscriptionOrderPlanTrial::from($trial); + } + + $this->fields['trial'] = $trial; + + return $this; + } + + public function getMeteredBilling(): ?SubscriptionOrderPlanMeteredBilling + { + return $this->fields['meteredBilling'] ?? null; + } + + public function setMeteredBilling(null|SubscriptionOrderPlanMeteredBilling|array $meteredBilling): static + { + if ($meteredBilling !== null && !($meteredBilling instanceof SubscriptionOrderPlanMeteredBilling)) { + $meteredBilling = SubscriptionOrderPlanMeteredBilling::from($meteredBilling); + } + + $this->fields['meteredBilling'] = $meteredBilling; + + return $this; + } + + public function getInvoiceTimeShift(): ?InvoiceTimeShift + { + return $this->fields['invoiceTimeShift'] ?? null; + } + + public function setInvoiceTimeShift(null|InvoiceTimeShift|array $invoiceTimeShift): static + { + if ($invoiceTimeShift !== null && !($invoiceTimeShift instanceof InvoiceTimeShift)) { + $invoiceTimeShift = InvoiceTimeShift::from($invoiceTimeShift); + } + + $this->fields['invoiceTimeShift'] = $invoiceTimeShift; + + return $this; + } + + public function getCreatedTime(): ?DateTimeImmutable + { + return $this->fields['createdTime'] ?? null; + } + + public function getUpdatedTime(): ?DateTimeImmutable + { + return $this->fields['updatedTime'] ?? null; + } + + /** + * @return null|ResourceLink[] + */ + public function getLinks(): ?array + { + return $this->fields['_links'] ?? null; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('id', $this->fields)) { + $data['id'] = $this->fields['id']; + } + if (array_key_exists('name', $this->fields)) { + $data['name'] = $this->fields['name']; + } + if (array_key_exists('description', $this->fields)) { + $data['description'] = $this->fields['description']; + } + if (array_key_exists('richDescription', $this->fields)) { + $data['richDescription'] = $this->fields['richDescription']; + } + if (array_key_exists('productId', $this->fields)) { + $data['productId'] = $this->fields['productId']; + } + if (array_key_exists('productOptions', $this->fields)) { + $data['productOptions'] = $this->fields['productOptions']; + } + if (array_key_exists('currency', $this->fields)) { + $data['currency'] = $this->fields['currency']; + } + if (array_key_exists('currencySign', $this->fields)) { + $data['currencySign'] = $this->fields['currencySign']; + } + if (array_key_exists('pricing', $this->fields)) { + $data['pricing'] = $this->fields['pricing']?->jsonSerialize(); + } + if (array_key_exists('setup', $this->fields)) { + $data['setup'] = $this->fields['setup']?->jsonSerialize(); + } + if (array_key_exists('customFields', $this->fields)) { + $data['customFields'] = $this->fields['customFields']; + } + if (array_key_exists('isActive', $this->fields)) { + $data['isActive'] = $this->fields['isActive']; + } + if (array_key_exists('revision', $this->fields)) { + $data['revision'] = $this->fields['revision']; + } + if (array_key_exists('isTrialOnly', $this->fields)) { + $data['isTrialOnly'] = $this->fields['isTrialOnly']; + } + if (array_key_exists('recurringInterval', $this->fields)) { + $data['recurringInterval'] = $this->fields['recurringInterval']?->jsonSerialize(); + } + if (array_key_exists('trial', $this->fields)) { + $data['trial'] = $this->fields['trial']?->jsonSerialize(); + } + if (array_key_exists('meteredBilling', $this->fields)) { + $data['meteredBilling'] = $this->fields['meteredBilling']?->jsonSerialize(); + } + if (array_key_exists('invoiceTimeShift', $this->fields)) { + $data['invoiceTimeShift'] = $this->fields['invoiceTimeShift']?->jsonSerialize(); + } + if (array_key_exists('createdTime', $this->fields)) { + $data['createdTime'] = $this->fields['createdTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('updatedTime', $this->fields)) { + $data['updatedTime'] = $this->fields['updatedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('_links', $this->fields)) { + $data['_links'] = $this->fields['_links']; + } + + return $data; + } + + private function setCurrencySign(null|string $currencySign): static + { + $this->fields['currencySign'] = $currencySign; + + return $this; + } + + private function setRevision(null|int $revision): static + { + $this->fields['revision'] = $revision; + + return $this; + } + + private function setIsTrialOnly(null|bool $isTrialOnly): static + { + $this->fields['isTrialOnly'] = $isTrialOnly; + + return $this; + } + + private function setCreatedTime(null|DateTimeImmutable|string $createdTime): static + { + if ($createdTime !== null && !($createdTime instanceof DateTimeImmutable)) { + $createdTime = new DateTimeImmutable($createdTime); + } + + $this->fields['createdTime'] = $createdTime; + + return $this; + } + + private function setUpdatedTime(null|DateTimeImmutable|string $updatedTime): static + { + if ($updatedTime !== null && !($updatedTime instanceof DateTimeImmutable)) { + $updatedTime = new DateTimeImmutable($updatedTime); + } + + $this->fields['updatedTime'] = $updatedTime; + + return $this; + } + + /** + * @param null|array[]|ResourceLink[] $links + */ + private function setLinks(null|array $links): static + { + $links = $links !== null ? array_map( + fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), + $links, + ) : null; + + $this->fields['_links'] = $links; + + return $this; + } +} diff --git a/src/Model/RiskMetadata.php b/src/Model/RiskMetadata.php index d00449032..1395b9684 100644 --- a/src/Model/RiskMetadata.php +++ b/src/Model/RiskMetadata.php @@ -48,8 +48,8 @@ public function __construct(array $data = []) if (array_key_exists('isHosting', $data)) { $this->setIsHosting($data['isHosting']); } - if (array_key_exists('vpnServiceName', $data)) { - $this->setVpnServiceName($data['vpnServiceName']); + if (array_key_exists('hostingName', $data)) { + $this->setHostingName($data['hostingName']); } if (array_key_exists('isp', $data)) { $this->setIsp($data['isp']); @@ -215,9 +215,9 @@ public function getIsHosting(): ?bool return $this->fields['isHosting'] ?? null; } - public function getVpnServiceName(): ?string + public function getHostingName(): ?string { - return $this->fields['vpnServiceName'] ?? null; + return $this->fields['hostingName'] ?? null; } public function getIsp(): ?string @@ -365,8 +365,8 @@ public function jsonSerialize(): array if (array_key_exists('isHosting', $this->fields)) { $data['isHosting'] = $this->fields['isHosting']; } - if (array_key_exists('vpnServiceName', $this->fields)) { - $data['vpnServiceName'] = $this->fields['vpnServiceName']; + if (array_key_exists('hostingName', $this->fields)) { + $data['hostingName'] = $this->fields['hostingName']; } if (array_key_exists('isp', $this->fields)) { $data['isp'] = $this->fields['isp']; @@ -469,9 +469,9 @@ private function setIsHosting(null|bool $isHosting): static return $this; } - private function setVpnServiceName(null|string $vpnServiceName): static + private function setHostingName(null|string $hostingName): static { - $this->fields['vpnServiceName'] = $vpnServiceName; + $this->fields['hostingName'] = $hostingName; return $this; } diff --git a/src/Model/RuleAction.php b/src/Model/RuleAction.php index 82b9f468c..2ee77cede 100644 --- a/src/Model/RuleAction.php +++ b/src/Model/RuleAction.php @@ -41,6 +41,8 @@ public static function from(array $data = []): self return new RuleActionAddRiskScore($data); case 'adjust-ready-to-pay': return new RuleActionAdjustReadyToPay($data); + case 'adjust-ready-to-payout': + return new RuleActionAdjustReadyToPayout($data); case 'blocklist': return new RuleActionAddBlockList($data); case 'cancel-scheduled-payments': diff --git a/src/Model/RuleActionAdjustReadyToPayout.php b/src/Model/RuleActionAdjustReadyToPayout.php new file mode 100644 index 000000000..ced9da110 --- /dev/null +++ b/src/Model/RuleActionAdjustReadyToPayout.php @@ -0,0 +1,86 @@ + 'adjust-ready-to-payout', + ] + $data); + + if (array_key_exists('prioritizeActivePaymentInstruments', $data)) { + $this->setPrioritizeActivePaymentInstruments($data['prioritizeActivePaymentInstruments']); + } + if (array_key_exists('paymentMethods', $data)) { + $this->setPaymentMethods($data['paymentMethods']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getPrioritizeActivePaymentInstruments(): ?bool + { + return $this->fields['prioritizeActivePaymentInstruments'] ?? null; + } + + public function setPrioritizeActivePaymentInstruments(null|bool $prioritizeActivePaymentInstruments): static + { + $this->fields['prioritizeActivePaymentInstruments'] = $prioritizeActivePaymentInstruments; + + return $this; + } + + /** + * @return null|AdjustReadyToPayoutPaymentMethod[] + */ + public function getPaymentMethods(): ?array + { + return $this->fields['paymentMethods'] ?? null; + } + + /** + * @param null|AdjustReadyToPayoutPaymentMethod[]|array[] $paymentMethods + */ + public function setPaymentMethods(null|array $paymentMethods): static + { + $paymentMethods = $paymentMethods !== null ? array_map( + fn ($value) => $value instanceof AdjustReadyToPayoutPaymentMethod ? $value : AdjustReadyToPayoutPaymentMethodFactory::from($value), + $paymentMethods, + ) : null; + + $this->fields['paymentMethods'] = $paymentMethods; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('prioritizeActivePaymentInstruments', $this->fields)) { + $data['prioritizeActivePaymentInstruments'] = $this->fields['prioritizeActivePaymentInstruments']; + } + if (array_key_exists('paymentMethods', $this->fields)) { + $data['paymentMethods'] = $this->fields['paymentMethods']; + } + + return parent::jsonSerialize() + $data; + } +} diff --git a/src/Model/Search.php b/src/Model/Search.php index efd72a915..c87f5ab8a 100644 --- a/src/Model/Search.php +++ b/src/Model/Search.php @@ -60,7 +60,7 @@ public function getInvoices(): ?array } /** - * @return null|Subscription[] + * @return null|SubscriptionOrOneTimeSale[] */ public function getOrders(): ?array { @@ -136,12 +136,12 @@ private function setInvoices(null|array $invoices): static } /** - * @param null|array[]|Subscription[] $orders + * @param null|array[]|SubscriptionOrOneTimeSale[] $orders */ private function setOrders(null|array $orders): static { $orders = $orders !== null ? array_map( - fn ($value) => $value instanceof Subscription ? $value : SubscriptionFactory::from($value), + fn ($value) => $value instanceof SubscriptionOrOneTimeSale ? $value : SubscriptionOrOneTimeSaleFactory::from($value), $orders, ) : null; diff --git a/src/Model/Subscription.php b/src/Model/Subscription.php index 82f1b2b6d..f68e270a4 100644 --- a/src/Model/Subscription.php +++ b/src/Model/Subscription.php @@ -14,101 +14,1124 @@ namespace Rebilly\Sdk\Model; use DateTimeImmutable; +use DateTimeInterface; +use JsonSerializable; -interface Subscription +class Subscription implements SubscriptionOrOneTimeSale, JsonSerializable { - public function getId(): ?string; + public const STATUS_PENDING = 'pending'; - public function getOrderType(): string; + public const STATUS_ACTIVE = 'active'; - public function getCustomerId(): string; + public const STATUS_ABANDONED = 'abandoned'; - public function setCustomerId(string $customerId): static; + public const STATUS_CANCELED = 'canceled'; - public function getOrganizationId(): ?string; + public const STATUS_CHURNED = 'churned'; - public function setOrganizationId(null|string $organizationId): static; + public const STATUS_PAUSED = 'paused'; - public function getStatus(): ?string; + public const STATUS_VOIDED = 'voided'; - public function getBillingStatus(): ?string; + public const STATUS_COMPLETED = 'completed'; - public function getWebsiteId(): string; + public const STATUS_TRIAL_ENDED = 'trial-ended'; - public function setWebsiteId(string $websiteId): static; + public const BILLING_STATUS_DRAFT = 'draft'; - public function getCurrency(): ?string; + public const BILLING_STATUS_UNPAID = 'unpaid'; - public function setCurrency(null|string $currency): static; + public const BILLING_STATUS_PAST_DUE = 'past-due'; - public function getInitialInvoiceId(): ?string; + public const BILLING_STATUS_ABANDONED = 'abandoned'; - public function getRecentInvoiceId(): ?string; + public const BILLING_STATUS_PAID = 'paid'; + + public const BILLING_STATUS_VOIDED = 'voided'; + + public const BILLING_STATUS_REFUNDED = 'refunded'; + + public const BILLING_STATUS_DISPUTED = 'disputed'; + + public const BILLING_STATUS_PARTIALLY_REFUNDED = 'partially-refunded'; + + public const BILLING_STATUS_PARTIALLY_PAID = 'partially-paid'; + + public const CANCELED_BY_MERCHANT = 'merchant'; + + public const CANCELED_BY_CUSTOMER = 'customer'; + + public const CANCELED_BY_REBILLY = 'rebilly'; + + public const CANCELED_BY_NULL = 'null'; + + public const CANCEL_CATEGORY_BILLING_FAILURE = 'billing-failure'; + + public const CANCEL_CATEGORY_DID_NOT_USE = 'did-not-use'; + + public const CANCEL_CATEGORY_DID_NOT_WANT = 'did-not-want'; + + public const CANCEL_CATEGORY_MISSING_FEATURES = 'missing-features'; + + public const CANCEL_CATEGORY_BUGS_OR_PROBLEMS = 'bugs-or-problems'; + + public const CANCEL_CATEGORY_DO_NOT_REMEMBER = 'do-not-remember'; + + public const CANCEL_CATEGORY_RISK_WARNING = 'risk-warning'; + + public const CANCEL_CATEGORY_CONTRACT_EXPIRED = 'contract-expired'; + + public const CANCEL_CATEGORY_TOO_EXPENSIVE = 'too-expensive'; + + public const CANCEL_CATEGORY_NEVER_STARTED = 'never-started'; + + public const CANCEL_CATEGORY_SWITCHED_PLAN = 'switched-plan'; + + public const CANCEL_CATEGORY_OTHER = 'other'; + + public const CANCEL_CATEGORY_NULL = 'null'; + + private array $fields = []; + + public function __construct(array $data = []) + { + if (array_key_exists('id', $data)) { + $this->setId($data['id']); + } + if (array_key_exists('customerId', $data)) { + $this->setCustomerId($data['customerId']); + } + if (array_key_exists('renewalReminderTime', $data)) { + $this->setRenewalReminderTime($data['renewalReminderTime']); + } + if (array_key_exists('renewalReminderNumber', $data)) { + $this->setRenewalReminderNumber($data['renewalReminderNumber']); + } + if (array_key_exists('trialReminderTime', $data)) { + $this->setTrialReminderTime($data['trialReminderTime']); + } + if (array_key_exists('trialReminderNumber', $data)) { + $this->setTrialReminderNumber($data['trialReminderNumber']); + } + if (array_key_exists('abandonReminderTime', $data)) { + $this->setAbandonReminderTime($data['abandonReminderTime']); + } + if (array_key_exists('abandonReminderNumber', $data)) { + $this->setAbandonReminderNumber($data['abandonReminderNumber']); + } + if (array_key_exists('organizationId', $data)) { + $this->setOrganizationId($data['organizationId']); + } + if (array_key_exists('status', $data)) { + $this->setStatus($data['status']); + } + if (array_key_exists('inTrial', $data)) { + $this->setInTrial($data['inTrial']); + } + if (array_key_exists('trial', $data)) { + $this->setTrial($data['trial']); + } + if (array_key_exists('isTrialOnly', $data)) { + $this->setIsTrialOnly($data['isTrialOnly']); + } + if (array_key_exists('invoiceTimeShift', $data)) { + $this->setInvoiceTimeShift($data['invoiceTimeShift']); + } + if (array_key_exists('recurringInterval', $data)) { + $this->setRecurringInterval($data['recurringInterval']); + } + if (array_key_exists('autopay', $data)) { + $this->setAutopay($data['autopay']); + } + if (array_key_exists('startTime', $data)) { + $this->setStartTime($data['startTime']); + } + if (array_key_exists('endTime', $data)) { + $this->setEndTime($data['endTime']); + } + if (array_key_exists('renewalTime', $data)) { + $this->setRenewalTime($data['renewalTime']); + } + if (array_key_exists('rebillNumber', $data)) { + $this->setRebillNumber($data['rebillNumber']); + } + if (array_key_exists('lineItems', $data)) { + $this->setLineItems($data['lineItems']); + } + if (array_key_exists('lineItemSubtotal', $data)) { + $this->setLineItemSubtotal($data['lineItemSubtotal']); + } + if (array_key_exists('paymentInstrumentId', $data)) { + $this->setPaymentInstrumentId($data['paymentInstrumentId']); + } + if (array_key_exists('billingStatus', $data)) { + $this->setBillingStatus($data['billingStatus']); + } + if (array_key_exists('websiteId', $data)) { + $this->setWebsiteId($data['websiteId']); + } + if (array_key_exists('currency', $data)) { + $this->setCurrency($data['currency']); + } + if (array_key_exists('initialInvoiceId', $data)) { + $this->setInitialInvoiceId($data['initialInvoiceId']); + } + if (array_key_exists('recentInvoiceId', $data)) { + $this->setRecentInvoiceId($data['recentInvoiceId']); + } + if (array_key_exists('items', $data)) { + $this->setItems($data['items']); + } + if (array_key_exists('deliveryAddress', $data)) { + $this->setDeliveryAddress($data['deliveryAddress']); + } + if (array_key_exists('billingAddress', $data)) { + $this->setBillingAddress($data['billingAddress']); + } + if (array_key_exists('activationTime', $data)) { + $this->setActivationTime($data['activationTime']); + } + if (array_key_exists('voidTime', $data)) { + $this->setVoidTime($data['voidTime']); + } + if (array_key_exists('abandonTime', $data)) { + $this->setAbandonTime($data['abandonTime']); + } + if (array_key_exists('delinquencyPeriod', $data)) { + $this->setDelinquencyPeriod($data['delinquencyPeriod']); + } + if (array_key_exists('couponIds', $data)) { + $this->setCouponIds($data['couponIds']); + } + if (array_key_exists('poNumber', $data)) { + $this->setPoNumber($data['poNumber']); + } + if (array_key_exists('shipping', $data)) { + $this->setShipping($data['shipping']); + } + if (array_key_exists('notes', $data)) { + $this->setNotes($data['notes']); + } + if (array_key_exists('canceledBy', $data)) { + $this->setCanceledBy($data['canceledBy']); + } + if (array_key_exists('cancelCategory', $data)) { + $this->setCancelCategory($data['cancelCategory']); + } + if (array_key_exists('cancelDescription', $data)) { + $this->setCancelDescription($data['cancelDescription']); + } + if (array_key_exists('revision', $data)) { + $this->setRevision($data['revision']); + } + if (array_key_exists('riskMetadata', $data)) { + $this->setRiskMetadata($data['riskMetadata']); + } + if (array_key_exists('richBillingPortalId', $data)) { + $this->setRichBillingPortalId($data['richBillingPortalId']); + } + if (array_key_exists('customFields', $data)) { + $this->setCustomFields($data['customFields']); + } + if (array_key_exists('createdTime', $data)) { + $this->setCreatedTime($data['createdTime']); + } + if (array_key_exists('updatedTime', $data)) { + $this->setUpdatedTime($data['updatedTime']); + } + if (array_key_exists('_links', $data)) { + $this->setLinks($data['_links']); + } + if (array_key_exists('_embedded', $data)) { + $this->setEmbedded($data['_embedded']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getOrderType(): string + { + return 'subscription-order'; + } + + public function getId(): ?string + { + return $this->fields['id'] ?? null; + } + + public function getCustomerId(): string + { + return $this->fields['customerId']; + } + + public function setCustomerId(string $customerId): static + { + $this->fields['customerId'] = $customerId; + + return $this; + } + + public function getRenewalReminderTime(): ?DateTimeImmutable + { + return $this->fields['renewalReminderTime'] ?? null; + } + + public function getRenewalReminderNumber(): ?int + { + return $this->fields['renewalReminderNumber'] ?? null; + } + + public function getTrialReminderTime(): ?DateTimeImmutable + { + return $this->fields['trialReminderTime'] ?? null; + } + + public function getTrialReminderNumber(): ?int + { + return $this->fields['trialReminderNumber'] ?? null; + } + + public function getAbandonReminderTime(): ?DateTimeImmutable + { + return $this->fields['abandonReminderTime'] ?? null; + } + + public function getAbandonReminderNumber(): ?int + { + return $this->fields['abandonReminderNumber'] ?? null; + } + + public function getOrganizationId(): ?string + { + return $this->fields['organizationId'] ?? null; + } + + public function setOrganizationId(null|string $organizationId): static + { + $this->fields['organizationId'] = $organizationId; + + return $this; + } + + public function getStatus(): ?string + { + return $this->fields['status'] ?? null; + } + + public function getInTrial(): ?bool + { + return $this->fields['inTrial'] ?? null; + } + + public function getTrial(): ?SubscriptionTrial + { + return $this->fields['trial'] ?? null; + } + + public function setTrial(null|SubscriptionTrial|array $trial): static + { + if ($trial !== null && !($trial instanceof SubscriptionTrial)) { + $trial = SubscriptionTrial::from($trial); + } + + $this->fields['trial'] = $trial; + + return $this; + } + + public function getIsTrialOnly(): ?bool + { + return $this->fields['isTrialOnly'] ?? null; + } + + public function setIsTrialOnly(null|bool $isTrialOnly): static + { + $this->fields['isTrialOnly'] = $isTrialOnly; + + return $this; + } + + public function getInvoiceTimeShift(): ?InvoiceTimeShift + { + return $this->fields['invoiceTimeShift'] ?? null; + } + + public function setInvoiceTimeShift(null|InvoiceTimeShift|array $invoiceTimeShift): static + { + if ($invoiceTimeShift !== null && !($invoiceTimeShift instanceof InvoiceTimeShift)) { + $invoiceTimeShift = InvoiceTimeShift::from($invoiceTimeShift); + } + + $this->fields['invoiceTimeShift'] = $invoiceTimeShift; + + return $this; + } + + public function getRecurringInterval(): ?SubscriptionRecurringInterval + { + return $this->fields['recurringInterval'] ?? null; + } + + public function setRecurringInterval(null|SubscriptionRecurringInterval|array $recurringInterval): static + { + if ($recurringInterval !== null && !($recurringInterval instanceof SubscriptionRecurringInterval)) { + $recurringInterval = SubscriptionRecurringInterval::from($recurringInterval); + } + + $this->fields['recurringInterval'] = $recurringInterval; + + return $this; + } + + public function getAutopay(): ?bool + { + return $this->fields['autopay'] ?? null; + } + + public function setAutopay(null|bool $autopay): static + { + $this->fields['autopay'] = $autopay; + + return $this; + } + + public function getStartTime(): ?DateTimeImmutable + { + return $this->fields['startTime'] ?? null; + } + + public function setStartTime(null|DateTimeImmutable|string $startTime): static + { + if ($startTime !== null && !($startTime instanceof DateTimeImmutable)) { + $startTime = new DateTimeImmutable($startTime); + } + + $this->fields['startTime'] = $startTime; + + return $this; + } + + public function getEndTime(): ?DateTimeImmutable + { + return $this->fields['endTime'] ?? null; + } + + public function getRenewalTime(): ?DateTimeImmutable + { + return $this->fields['renewalTime'] ?? null; + } + + public function setRenewalTime(null|DateTimeImmutable|string $renewalTime): static + { + if ($renewalTime !== null && !($renewalTime instanceof DateTimeImmutable)) { + $renewalTime = new DateTimeImmutable($renewalTime); + } + + $this->fields['renewalTime'] = $renewalTime; + + return $this; + } + + public function getRebillNumber(): ?int + { + return $this->fields['rebillNumber'] ?? null; + } + + /** + * @return null|SubscriptionLineItems[] + */ + public function getLineItems(): ?array + { + return $this->fields['lineItems'] ?? null; + } + + public function getLineItemSubtotal(): ?SubscriptionLineItemSubtotal + { + return $this->fields['lineItemSubtotal'] ?? null; + } + + public function setLineItemSubtotal(null|SubscriptionLineItemSubtotal|array $lineItemSubtotal): static + { + if ($lineItemSubtotal !== null && !($lineItemSubtotal instanceof SubscriptionLineItemSubtotal)) { + $lineItemSubtotal = SubscriptionLineItemSubtotal::from($lineItemSubtotal); + } + + $this->fields['lineItemSubtotal'] = $lineItemSubtotal; + + return $this; + } + + public function getPaymentInstrumentId(): ?string + { + return $this->fields['paymentInstrumentId'] ?? null; + } + + public function setPaymentInstrumentId(null|string $paymentInstrumentId): static + { + $this->fields['paymentInstrumentId'] = $paymentInstrumentId; + + return $this; + } + + public function getBillingStatus(): ?string + { + return $this->fields['billingStatus'] ?? null; + } + + public function getWebsiteId(): string + { + return $this->fields['websiteId']; + } + + public function setWebsiteId(string $websiteId): static + { + $this->fields['websiteId'] = $websiteId; + + return $this; + } + + public function getCurrency(): ?string + { + return $this->fields['currency'] ?? null; + } + + public function setCurrency(null|string $currency): static + { + $this->fields['currency'] = $currency; + + return $this; + } + + public function getInitialInvoiceId(): ?string + { + return $this->fields['initialInvoiceId'] ?? null; + } + + public function getRecentInvoiceId(): ?string + { + return $this->fields['recentInvoiceId'] ?? null; + } /** * @return OrderItem[] */ - public function getItems(): array; + public function getItems(): array + { + return $this->fields['items']; + } /** * @param array[]|OrderItem[] $items */ - public function setItems(array $items): static; + public function setItems(array $items): static + { + $items = array_map( + fn ($value) => $value instanceof OrderItem ? $value : OrderItem::from($value), + $items, + ); + + $this->fields['items'] = $items; + + return $this; + } + + public function getDeliveryAddress(): ?ContactObject + { + return $this->fields['deliveryAddress'] ?? null; + } - public function getDeliveryAddress(): ?ContactObject; + public function setDeliveryAddress(null|ContactObject|array $deliveryAddress): static + { + if ($deliveryAddress !== null && !($deliveryAddress instanceof ContactObject)) { + $deliveryAddress = ContactObject::from($deliveryAddress); + } - public function setDeliveryAddress(null|ContactObject|array $deliveryAddress): static; + $this->fields['deliveryAddress'] = $deliveryAddress; - public function getBillingAddress(): ?ContactObject; + return $this; + } - public function setBillingAddress(null|ContactObject|array $billingAddress): static; + public function getBillingAddress(): ?ContactObject + { + return $this->fields['billingAddress'] ?? null; + } - public function getActivationTime(): ?DateTimeImmutable; + public function setBillingAddress(null|ContactObject|array $billingAddress): static + { + if ($billingAddress !== null && !($billingAddress instanceof ContactObject)) { + $billingAddress = ContactObject::from($billingAddress); + } - public function getVoidTime(): ?DateTimeImmutable; + $this->fields['billingAddress'] = $billingAddress; - public function getAbandonTime(): ?DateTimeImmutable; + return $this; + } - public function setAbandonTime(null|DateTimeImmutable|string $abandonTime): static; + public function getActivationTime(): ?DateTimeImmutable + { + return $this->fields['activationTime'] ?? null; + } + + public function getVoidTime(): ?DateTimeImmutable + { + return $this->fields['voidTime'] ?? null; + } + + public function getAbandonTime(): ?DateTimeImmutable + { + return $this->fields['abandonTime'] ?? null; + } + + public function setAbandonTime(null|DateTimeImmutable|string $abandonTime): static + { + if ($abandonTime !== null && !($abandonTime instanceof DateTimeImmutable)) { + $abandonTime = new DateTimeImmutable($abandonTime); + } + + $this->fields['abandonTime'] = $abandonTime; + + return $this; + } + + public function getDelinquencyPeriod(): ?string + { + return $this->fields['delinquencyPeriod'] ?? null; + } + + public function setDelinquencyPeriod(null|string $delinquencyPeriod): static + { + $this->fields['delinquencyPeriod'] = $delinquencyPeriod; + + return $this; + } /** * @return null|string[] */ - public function getCouponIds(): ?array; + public function getCouponIds(): ?array + { + return $this->fields['couponIds'] ?? null; + } /** * @param null|string[] $couponIds */ - public function setCouponIds(null|array $couponIds): static; + public function setCouponIds(null|array $couponIds): static + { + $this->fields['couponIds'] = $couponIds; + + return $this; + } + + public function getPoNumber(): ?string + { + return $this->fields['poNumber'] ?? null; + } + + public function setPoNumber(null|string $poNumber): static + { + $this->fields['poNumber'] = $poNumber; + + return $this; + } - public function getPoNumber(): ?string; + public function getShipping(): ?Shipping + { + return $this->fields['shipping'] ?? null; + } - public function setPoNumber(null|string $poNumber): static; + public function setShipping(null|Shipping|array $shipping): static + { + if ($shipping !== null && !($shipping instanceof Shipping)) { + $shipping = ShippingFactory::from($shipping); + } - public function getShipping(): ?Shipping; + $this->fields['shipping'] = $shipping; - public function setShipping(null|Shipping|array $shipping): static; + return $this; + } - public function getNotes(): ?string; + public function getNotes(): ?string + { + return $this->fields['notes'] ?? null; + } - public function setNotes(null|string $notes): static; + public function setNotes(null|string $notes): static + { + $this->fields['notes'] = $notes; - public function getRevision(): ?int; + return $this; + } - public function getRiskMetadata(): ?RiskMetadata; + public function getCanceledBy(): ?string + { + return $this->fields['canceledBy'] ?? null; + } - public function setRiskMetadata(null|RiskMetadata|array $riskMetadata): static; + public function getCancelCategory(): ?string + { + return $this->fields['cancelCategory'] ?? null; + } - public function getCustomFields(): ?array; + public function getCancelDescription(): ?string + { + return $this->fields['cancelDescription'] ?? null; + } - public function setCustomFields(null|array $customFields): static; + public function getRevision(): ?int + { + return $this->fields['revision'] ?? null; + } - public function getCreatedTime(): ?DateTimeImmutable; + public function getRiskMetadata(): ?RiskMetadata + { + return $this->fields['riskMetadata'] ?? null; + } - public function getUpdatedTime(): ?DateTimeImmutable; + public function setRiskMetadata(null|RiskMetadata|array $riskMetadata): static + { + if ($riskMetadata !== null && !($riskMetadata instanceof RiskMetadata)) { + $riskMetadata = RiskMetadata::from($riskMetadata); + } + + $this->fields['riskMetadata'] = $riskMetadata; + + return $this; + } + + public function getRichBillingPortalId(): ?string + { + return $this->fields['richBillingPortalId'] ?? null; + } + + public function setRichBillingPortalId(null|string $richBillingPortalId): static + { + $this->fields['richBillingPortalId'] = $richBillingPortalId; + + return $this; + } + + public function getCustomFields(): ?array + { + return $this->fields['customFields'] ?? null; + } + + public function setCustomFields(null|array $customFields): static + { + $this->fields['customFields'] = $customFields; + + return $this; + } + + public function getCreatedTime(): ?DateTimeImmutable + { + return $this->fields['createdTime'] ?? null; + } + + public function getUpdatedTime(): ?DateTimeImmutable + { + return $this->fields['updatedTime'] ?? null; + } /** * @return null|ResourceLink[] */ - public function getLinks(): ?array; + public function getLinks(): ?array + { + return $this->fields['_links'] ?? null; + } + + public function getEmbedded(): ?SubscriptionEmbedded + { + return $this->fields['_embedded'] ?? null; + } + + public function setEmbedded(null|SubscriptionEmbedded|array $embedded): static + { + if ($embedded !== null && !($embedded instanceof SubscriptionEmbedded)) { + $embedded = SubscriptionEmbedded::from($embedded); + } + + $this->fields['_embedded'] = $embedded; + + return $this; + } + + public function jsonSerialize(): array + { + $data = [ + 'orderType' => 'subscription-order', + ]; + if (array_key_exists('id', $this->fields)) { + $data['id'] = $this->fields['id']; + } + if (array_key_exists('customerId', $this->fields)) { + $data['customerId'] = $this->fields['customerId']; + } + if (array_key_exists('renewalReminderTime', $this->fields)) { + $data['renewalReminderTime'] = $this->fields['renewalReminderTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('renewalReminderNumber', $this->fields)) { + $data['renewalReminderNumber'] = $this->fields['renewalReminderNumber']; + } + if (array_key_exists('trialReminderTime', $this->fields)) { + $data['trialReminderTime'] = $this->fields['trialReminderTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('trialReminderNumber', $this->fields)) { + $data['trialReminderNumber'] = $this->fields['trialReminderNumber']; + } + if (array_key_exists('abandonReminderTime', $this->fields)) { + $data['abandonReminderTime'] = $this->fields['abandonReminderTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('abandonReminderNumber', $this->fields)) { + $data['abandonReminderNumber'] = $this->fields['abandonReminderNumber']; + } + if (array_key_exists('organizationId', $this->fields)) { + $data['organizationId'] = $this->fields['organizationId']; + } + if (array_key_exists('status', $this->fields)) { + $data['status'] = $this->fields['status']; + } + if (array_key_exists('inTrial', $this->fields)) { + $data['inTrial'] = $this->fields['inTrial']; + } + if (array_key_exists('trial', $this->fields)) { + $data['trial'] = $this->fields['trial']?->jsonSerialize(); + } + if (array_key_exists('isTrialOnly', $this->fields)) { + $data['isTrialOnly'] = $this->fields['isTrialOnly']; + } + if (array_key_exists('invoiceTimeShift', $this->fields)) { + $data['invoiceTimeShift'] = $this->fields['invoiceTimeShift']?->jsonSerialize(); + } + if (array_key_exists('recurringInterval', $this->fields)) { + $data['recurringInterval'] = $this->fields['recurringInterval']?->jsonSerialize(); + } + if (array_key_exists('autopay', $this->fields)) { + $data['autopay'] = $this->fields['autopay']; + } + if (array_key_exists('startTime', $this->fields)) { + $data['startTime'] = $this->fields['startTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('endTime', $this->fields)) { + $data['endTime'] = $this->fields['endTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('renewalTime', $this->fields)) { + $data['renewalTime'] = $this->fields['renewalTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('rebillNumber', $this->fields)) { + $data['rebillNumber'] = $this->fields['rebillNumber']; + } + if (array_key_exists('lineItems', $this->fields)) { + $data['lineItems'] = $this->fields['lineItems']; + } + if (array_key_exists('lineItemSubtotal', $this->fields)) { + $data['lineItemSubtotal'] = $this->fields['lineItemSubtotal']?->jsonSerialize(); + } + if (array_key_exists('paymentInstrumentId', $this->fields)) { + $data['paymentInstrumentId'] = $this->fields['paymentInstrumentId']; + } + if (array_key_exists('billingStatus', $this->fields)) { + $data['billingStatus'] = $this->fields['billingStatus']; + } + if (array_key_exists('websiteId', $this->fields)) { + $data['websiteId'] = $this->fields['websiteId']; + } + if (array_key_exists('currency', $this->fields)) { + $data['currency'] = $this->fields['currency']; + } + if (array_key_exists('initialInvoiceId', $this->fields)) { + $data['initialInvoiceId'] = $this->fields['initialInvoiceId']; + } + if (array_key_exists('recentInvoiceId', $this->fields)) { + $data['recentInvoiceId'] = $this->fields['recentInvoiceId']; + } + if (array_key_exists('items', $this->fields)) { + $data['items'] = $this->fields['items']; + } + if (array_key_exists('deliveryAddress', $this->fields)) { + $data['deliveryAddress'] = $this->fields['deliveryAddress']?->jsonSerialize(); + } + if (array_key_exists('billingAddress', $this->fields)) { + $data['billingAddress'] = $this->fields['billingAddress']?->jsonSerialize(); + } + if (array_key_exists('activationTime', $this->fields)) { + $data['activationTime'] = $this->fields['activationTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('voidTime', $this->fields)) { + $data['voidTime'] = $this->fields['voidTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('abandonTime', $this->fields)) { + $data['abandonTime'] = $this->fields['abandonTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('delinquencyPeriod', $this->fields)) { + $data['delinquencyPeriod'] = $this->fields['delinquencyPeriod']; + } + if (array_key_exists('couponIds', $this->fields)) { + $data['couponIds'] = $this->fields['couponIds']; + } + if (array_key_exists('poNumber', $this->fields)) { + $data['poNumber'] = $this->fields['poNumber']; + } + if (array_key_exists('shipping', $this->fields)) { + $data['shipping'] = $this->fields['shipping']?->jsonSerialize(); + } + if (array_key_exists('notes', $this->fields)) { + $data['notes'] = $this->fields['notes']; + } + if (array_key_exists('canceledBy', $this->fields)) { + $data['canceledBy'] = $this->fields['canceledBy']; + } + if (array_key_exists('cancelCategory', $this->fields)) { + $data['cancelCategory'] = $this->fields['cancelCategory']; + } + if (array_key_exists('cancelDescription', $this->fields)) { + $data['cancelDescription'] = $this->fields['cancelDescription']; + } + if (array_key_exists('revision', $this->fields)) { + $data['revision'] = $this->fields['revision']; + } + if (array_key_exists('riskMetadata', $this->fields)) { + $data['riskMetadata'] = $this->fields['riskMetadata']?->jsonSerialize(); + } + if (array_key_exists('richBillingPortalId', $this->fields)) { + $data['richBillingPortalId'] = $this->fields['richBillingPortalId']; + } + if (array_key_exists('customFields', $this->fields)) { + $data['customFields'] = $this->fields['customFields']; + } + if (array_key_exists('createdTime', $this->fields)) { + $data['createdTime'] = $this->fields['createdTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('updatedTime', $this->fields)) { + $data['updatedTime'] = $this->fields['updatedTime']?->format(DateTimeInterface::RFC3339); + } + if (array_key_exists('_links', $this->fields)) { + $data['_links'] = $this->fields['_links']; + } + if (array_key_exists('_embedded', $this->fields)) { + $data['_embedded'] = $this->fields['_embedded']?->jsonSerialize(); + } + + return $data; + } + + private function setId(null|string $id): static + { + $this->fields['id'] = $id; + + return $this; + } + + private function setRenewalReminderTime(null|DateTimeImmutable|string $renewalReminderTime): static + { + if ($renewalReminderTime !== null && !($renewalReminderTime instanceof DateTimeImmutable)) { + $renewalReminderTime = new DateTimeImmutable($renewalReminderTime); + } + + $this->fields['renewalReminderTime'] = $renewalReminderTime; + + return $this; + } + + private function setRenewalReminderNumber(null|int $renewalReminderNumber): static + { + $this->fields['renewalReminderNumber'] = $renewalReminderNumber; + + return $this; + } + + private function setTrialReminderTime(null|DateTimeImmutable|string $trialReminderTime): static + { + if ($trialReminderTime !== null && !($trialReminderTime instanceof DateTimeImmutable)) { + $trialReminderTime = new DateTimeImmutable($trialReminderTime); + } + + $this->fields['trialReminderTime'] = $trialReminderTime; + + return $this; + } + + private function setTrialReminderNumber(null|int $trialReminderNumber): static + { + $this->fields['trialReminderNumber'] = $trialReminderNumber; + + return $this; + } + + private function setAbandonReminderTime(null|DateTimeImmutable|string $abandonReminderTime): static + { + if ($abandonReminderTime !== null && !($abandonReminderTime instanceof DateTimeImmutable)) { + $abandonReminderTime = new DateTimeImmutable($abandonReminderTime); + } + + $this->fields['abandonReminderTime'] = $abandonReminderTime; + + return $this; + } + + private function setAbandonReminderNumber(null|int $abandonReminderNumber): static + { + $this->fields['abandonReminderNumber'] = $abandonReminderNumber; + + return $this; + } + + private function setStatus(null|string $status): static + { + $this->fields['status'] = $status; + + return $this; + } + + private function setInTrial(null|bool $inTrial): static + { + $this->fields['inTrial'] = $inTrial; + + return $this; + } + + private function setEndTime(null|DateTimeImmutable|string $endTime): static + { + if ($endTime !== null && !($endTime instanceof DateTimeImmutable)) { + $endTime = new DateTimeImmutable($endTime); + } + + $this->fields['endTime'] = $endTime; + + return $this; + } + + private function setRebillNumber(null|int $rebillNumber): static + { + $this->fields['rebillNumber'] = $rebillNumber; + + return $this; + } + + /** + * @param null|array[]|SubscriptionLineItems[] $lineItems + */ + private function setLineItems(null|array $lineItems): static + { + $lineItems = $lineItems !== null ? array_map( + fn ($value) => $value instanceof SubscriptionLineItems ? $value : SubscriptionLineItems::from($value), + $lineItems, + ) : null; + + $this->fields['lineItems'] = $lineItems; + + return $this; + } + + private function setBillingStatus(null|string $billingStatus): static + { + $this->fields['billingStatus'] = $billingStatus; + + return $this; + } + + private function setInitialInvoiceId(null|string $initialInvoiceId): static + { + $this->fields['initialInvoiceId'] = $initialInvoiceId; + + return $this; + } + + private function setRecentInvoiceId(null|string $recentInvoiceId): static + { + $this->fields['recentInvoiceId'] = $recentInvoiceId; + + return $this; + } + + private function setActivationTime(null|DateTimeImmutable|string $activationTime): static + { + if ($activationTime !== null && !($activationTime instanceof DateTimeImmutable)) { + $activationTime = new DateTimeImmutable($activationTime); + } + + $this->fields['activationTime'] = $activationTime; + + return $this; + } + + private function setVoidTime(null|DateTimeImmutable|string $voidTime): static + { + if ($voidTime !== null && !($voidTime instanceof DateTimeImmutable)) { + $voidTime = new DateTimeImmutable($voidTime); + } + + $this->fields['voidTime'] = $voidTime; + + return $this; + } + + private function setCanceledBy(null|string $canceledBy): static + { + $this->fields['canceledBy'] = $canceledBy; + + return $this; + } + + private function setCancelCategory(null|string $cancelCategory): static + { + $this->fields['cancelCategory'] = $cancelCategory; + + return $this; + } + + private function setCancelDescription(null|string $cancelDescription): static + { + $this->fields['cancelDescription'] = $cancelDescription; + + return $this; + } + + private function setRevision(null|int $revision): static + { + $this->fields['revision'] = $revision; + + return $this; + } + + private function setCreatedTime(null|DateTimeImmutable|string $createdTime): static + { + if ($createdTime !== null && !($createdTime instanceof DateTimeImmutable)) { + $createdTime = new DateTimeImmutable($createdTime); + } + + $this->fields['createdTime'] = $createdTime; + + return $this; + } + + private function setUpdatedTime(null|DateTimeImmutable|string $updatedTime): static + { + if ($updatedTime !== null && !($updatedTime instanceof DateTimeImmutable)) { + $updatedTime = new DateTimeImmutable($updatedTime); + } + + $this->fields['updatedTime'] = $updatedTime; + + return $this; + } + + /** + * @param null|array[]|ResourceLink[] $links + */ + private function setLinks(null|array $links): static + { + $links = $links !== null ? array_map( + fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), + $links, + ) : null; + + $this->fields['_links'] = $links; + + return $this; + } } diff --git a/src/Model/SubscriptionOrderEmbedded.php b/src/Model/SubscriptionEmbedded.php similarity index 98% rename from src/Model/SubscriptionOrderEmbedded.php rename to src/Model/SubscriptionEmbedded.php index 05bc3105c..4af56b621 100644 --- a/src/Model/SubscriptionOrderEmbedded.php +++ b/src/Model/SubscriptionEmbedded.php @@ -15,7 +15,7 @@ use JsonSerializable; -class SubscriptionOrderEmbedded implements JsonSerializable +class SubscriptionEmbedded implements JsonSerializable { private array $fields = []; diff --git a/src/Model/SubscriptionItemUpdate.php b/src/Model/SubscriptionItemUpdate.php new file mode 100644 index 000000000..e8a20e12a --- /dev/null +++ b/src/Model/SubscriptionItemUpdate.php @@ -0,0 +1,55 @@ +setQuantityFilled($data['quantityFilled']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getQuantityFilled(): int + { + return $this->fields['quantityFilled']; + } + + public function setQuantityFilled(int $quantityFilled): static + { + $this->fields['quantityFilled'] = $quantityFilled; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('quantityFilled', $this->fields)) { + $data['quantityFilled'] = $this->fields['quantityFilled']; + } + + return $data; + } +} diff --git a/src/Model/SubscriptionOrderLineItemSubtotal.php b/src/Model/SubscriptionLineItemSubtotal.php similarity index 95% rename from src/Model/SubscriptionOrderLineItemSubtotal.php rename to src/Model/SubscriptionLineItemSubtotal.php index 27b9bddf5..92f26bf47 100644 --- a/src/Model/SubscriptionOrderLineItemSubtotal.php +++ b/src/Model/SubscriptionLineItemSubtotal.php @@ -15,7 +15,7 @@ use JsonSerializable; -class SubscriptionOrderLineItemSubtotal implements JsonSerializable +class SubscriptionLineItemSubtotal implements JsonSerializable { private array $fields = []; diff --git a/src/Model/SubscriptionOrderLineItems.php b/src/Model/SubscriptionLineItems.php similarity index 99% rename from src/Model/SubscriptionOrderLineItems.php rename to src/Model/SubscriptionLineItems.php index 62c80e69f..caa832396 100644 --- a/src/Model/SubscriptionOrderLineItems.php +++ b/src/Model/SubscriptionLineItems.php @@ -17,7 +17,7 @@ use DateTimeInterface; use JsonSerializable; -class SubscriptionOrderLineItems implements JsonSerializable +class SubscriptionLineItems implements JsonSerializable { public const TYPE_DEBIT = 'debit'; diff --git a/src/Model/SubscriptionOrOneTimeSale.php b/src/Model/SubscriptionOrOneTimeSale.php new file mode 100644 index 000000000..adfd40a8f --- /dev/null +++ b/src/Model/SubscriptionOrOneTimeSale.php @@ -0,0 +1,114 @@ + OneTimeOrder::from($data), - 'subscription-order' => SubscriptionOrder::from($data), + 'one-time-order' => OneTimeSale::from($data), + 'subscription-order' => Subscription::from($data), default => throw new UnknownDiscriminatorValueException(), }; } diff --git a/src/Model/SubscriptionOrder.php b/src/Model/SubscriptionOrder.php deleted file mode 100644 index 7651d73b8..000000000 --- a/src/Model/SubscriptionOrder.php +++ /dev/null @@ -1,1101 +0,0 @@ -setId($data['id']); - } - if (array_key_exists('customerId', $data)) { - $this->setCustomerId($data['customerId']); - } - if (array_key_exists('renewalReminderTime', $data)) { - $this->setRenewalReminderTime($data['renewalReminderTime']); - } - if (array_key_exists('renewalReminderNumber', $data)) { - $this->setRenewalReminderNumber($data['renewalReminderNumber']); - } - if (array_key_exists('trialReminderTime', $data)) { - $this->setTrialReminderTime($data['trialReminderTime']); - } - if (array_key_exists('trialReminderNumber', $data)) { - $this->setTrialReminderNumber($data['trialReminderNumber']); - } - if (array_key_exists('abandonReminderTime', $data)) { - $this->setAbandonReminderTime($data['abandonReminderTime']); - } - if (array_key_exists('abandonReminderNumber', $data)) { - $this->setAbandonReminderNumber($data['abandonReminderNumber']); - } - if (array_key_exists('organizationId', $data)) { - $this->setOrganizationId($data['organizationId']); - } - if (array_key_exists('status', $data)) { - $this->setStatus($data['status']); - } - if (array_key_exists('inTrial', $data)) { - $this->setInTrial($data['inTrial']); - } - if (array_key_exists('trial', $data)) { - $this->setTrial($data['trial']); - } - if (array_key_exists('isTrialOnly', $data)) { - $this->setIsTrialOnly($data['isTrialOnly']); - } - if (array_key_exists('invoiceTimeShift', $data)) { - $this->setInvoiceTimeShift($data['invoiceTimeShift']); - } - if (array_key_exists('recurringInterval', $data)) { - $this->setRecurringInterval($data['recurringInterval']); - } - if (array_key_exists('autopay', $data)) { - $this->setAutopay($data['autopay']); - } - if (array_key_exists('startTime', $data)) { - $this->setStartTime($data['startTime']); - } - if (array_key_exists('endTime', $data)) { - $this->setEndTime($data['endTime']); - } - if (array_key_exists('renewalTime', $data)) { - $this->setRenewalTime($data['renewalTime']); - } - if (array_key_exists('rebillNumber', $data)) { - $this->setRebillNumber($data['rebillNumber']); - } - if (array_key_exists('lineItems', $data)) { - $this->setLineItems($data['lineItems']); - } - if (array_key_exists('lineItemSubtotal', $data)) { - $this->setLineItemSubtotal($data['lineItemSubtotal']); - } - if (array_key_exists('paymentInstrumentId', $data)) { - $this->setPaymentInstrumentId($data['paymentInstrumentId']); - } - if (array_key_exists('billingStatus', $data)) { - $this->setBillingStatus($data['billingStatus']); - } - if (array_key_exists('websiteId', $data)) { - $this->setWebsiteId($data['websiteId']); - } - if (array_key_exists('currency', $data)) { - $this->setCurrency($data['currency']); - } - if (array_key_exists('initialInvoiceId', $data)) { - $this->setInitialInvoiceId($data['initialInvoiceId']); - } - if (array_key_exists('recentInvoiceId', $data)) { - $this->setRecentInvoiceId($data['recentInvoiceId']); - } - if (array_key_exists('items', $data)) { - $this->setItems($data['items']); - } - if (array_key_exists('deliveryAddress', $data)) { - $this->setDeliveryAddress($data['deliveryAddress']); - } - if (array_key_exists('billingAddress', $data)) { - $this->setBillingAddress($data['billingAddress']); - } - if (array_key_exists('activationTime', $data)) { - $this->setActivationTime($data['activationTime']); - } - if (array_key_exists('voidTime', $data)) { - $this->setVoidTime($data['voidTime']); - } - if (array_key_exists('abandonTime', $data)) { - $this->setAbandonTime($data['abandonTime']); - } - if (array_key_exists('couponIds', $data)) { - $this->setCouponIds($data['couponIds']); - } - if (array_key_exists('poNumber', $data)) { - $this->setPoNumber($data['poNumber']); - } - if (array_key_exists('shipping', $data)) { - $this->setShipping($data['shipping']); - } - if (array_key_exists('notes', $data)) { - $this->setNotes($data['notes']); - } - if (array_key_exists('canceledBy', $data)) { - $this->setCanceledBy($data['canceledBy']); - } - if (array_key_exists('cancelCategory', $data)) { - $this->setCancelCategory($data['cancelCategory']); - } - if (array_key_exists('cancelDescription', $data)) { - $this->setCancelDescription($data['cancelDescription']); - } - if (array_key_exists('revision', $data)) { - $this->setRevision($data['revision']); - } - if (array_key_exists('riskMetadata', $data)) { - $this->setRiskMetadata($data['riskMetadata']); - } - if (array_key_exists('customFields', $data)) { - $this->setCustomFields($data['customFields']); - } - if (array_key_exists('createdTime', $data)) { - $this->setCreatedTime($data['createdTime']); - } - if (array_key_exists('updatedTime', $data)) { - $this->setUpdatedTime($data['updatedTime']); - } - if (array_key_exists('_links', $data)) { - $this->setLinks($data['_links']); - } - if (array_key_exists('_embedded', $data)) { - $this->setEmbedded($data['_embedded']); - } - } - - public static function from(array $data = []): self - { - return new self($data); - } - - public function getOrderType(): string - { - return 'subscription-order'; - } - - public function getId(): ?string - { - return $this->fields['id'] ?? null; - } - - public function getCustomerId(): string - { - return $this->fields['customerId']; - } - - public function setCustomerId(string $customerId): static - { - $this->fields['customerId'] = $customerId; - - return $this; - } - - public function getRenewalReminderTime(): ?DateTimeImmutable - { - return $this->fields['renewalReminderTime'] ?? null; - } - - public function getRenewalReminderNumber(): ?int - { - return $this->fields['renewalReminderNumber'] ?? null; - } - - public function getTrialReminderTime(): ?DateTimeImmutable - { - return $this->fields['trialReminderTime'] ?? null; - } - - public function getTrialReminderNumber(): ?int - { - return $this->fields['trialReminderNumber'] ?? null; - } - - public function getAbandonReminderTime(): ?DateTimeImmutable - { - return $this->fields['abandonReminderTime'] ?? null; - } - - public function getAbandonReminderNumber(): ?int - { - return $this->fields['abandonReminderNumber'] ?? null; - } - - public function getOrganizationId(): ?string - { - return $this->fields['organizationId'] ?? null; - } - - public function setOrganizationId(null|string $organizationId): static - { - $this->fields['organizationId'] = $organizationId; - - return $this; - } - - public function getStatus(): ?string - { - return $this->fields['status'] ?? null; - } - - public function getInTrial(): ?bool - { - return $this->fields['inTrial'] ?? null; - } - - public function getTrial(): ?SubscriptionOrderTrial - { - return $this->fields['trial'] ?? null; - } - - public function setTrial(null|SubscriptionOrderTrial|array $trial): static - { - if ($trial !== null && !($trial instanceof SubscriptionOrderTrial)) { - $trial = SubscriptionOrderTrial::from($trial); - } - - $this->fields['trial'] = $trial; - - return $this; - } - - public function getIsTrialOnly(): ?bool - { - return $this->fields['isTrialOnly'] ?? null; - } - - public function setIsTrialOnly(null|bool $isTrialOnly): static - { - $this->fields['isTrialOnly'] = $isTrialOnly; - - return $this; - } - - public function getInvoiceTimeShift(): ?InvoiceTimeShift - { - return $this->fields['invoiceTimeShift'] ?? null; - } - - public function setInvoiceTimeShift(null|InvoiceTimeShift|array $invoiceTimeShift): static - { - if ($invoiceTimeShift !== null && !($invoiceTimeShift instanceof InvoiceTimeShift)) { - $invoiceTimeShift = InvoiceTimeShift::from($invoiceTimeShift); - } - - $this->fields['invoiceTimeShift'] = $invoiceTimeShift; - - return $this; - } - - public function getRecurringInterval(): ?SubscriptionOrderRecurringInterval - { - return $this->fields['recurringInterval'] ?? null; - } - - public function setRecurringInterval(null|SubscriptionOrderRecurringInterval|array $recurringInterval): static - { - if ($recurringInterval !== null && !($recurringInterval instanceof SubscriptionOrderRecurringInterval)) { - $recurringInterval = SubscriptionOrderRecurringInterval::from($recurringInterval); - } - - $this->fields['recurringInterval'] = $recurringInterval; - - return $this; - } - - public function getAutopay(): ?bool - { - return $this->fields['autopay'] ?? null; - } - - public function setAutopay(null|bool $autopay): static - { - $this->fields['autopay'] = $autopay; - - return $this; - } - - public function getStartTime(): ?DateTimeImmutable - { - return $this->fields['startTime'] ?? null; - } - - public function setStartTime(null|DateTimeImmutable|string $startTime): static - { - if ($startTime !== null && !($startTime instanceof DateTimeImmutable)) { - $startTime = new DateTimeImmutable($startTime); - } - - $this->fields['startTime'] = $startTime; - - return $this; - } - - public function getEndTime(): ?DateTimeImmutable - { - return $this->fields['endTime'] ?? null; - } - - public function getRenewalTime(): ?DateTimeImmutable - { - return $this->fields['renewalTime'] ?? null; - } - - public function setRenewalTime(null|DateTimeImmutable|string $renewalTime): static - { - if ($renewalTime !== null && !($renewalTime instanceof DateTimeImmutable)) { - $renewalTime = new DateTimeImmutable($renewalTime); - } - - $this->fields['renewalTime'] = $renewalTime; - - return $this; - } - - public function getRebillNumber(): ?int - { - return $this->fields['rebillNumber'] ?? null; - } - - /** - * @return null|SubscriptionOrderLineItems[] - */ - public function getLineItems(): ?array - { - return $this->fields['lineItems'] ?? null; - } - - public function getLineItemSubtotal(): ?SubscriptionOrderLineItemSubtotal - { - return $this->fields['lineItemSubtotal'] ?? null; - } - - public function setLineItemSubtotal(null|SubscriptionOrderLineItemSubtotal|array $lineItemSubtotal): static - { - if ($lineItemSubtotal !== null && !($lineItemSubtotal instanceof SubscriptionOrderLineItemSubtotal)) { - $lineItemSubtotal = SubscriptionOrderLineItemSubtotal::from($lineItemSubtotal); - } - - $this->fields['lineItemSubtotal'] = $lineItemSubtotal; - - return $this; - } - - public function getPaymentInstrumentId(): ?string - { - return $this->fields['paymentInstrumentId'] ?? null; - } - - public function setPaymentInstrumentId(null|string $paymentInstrumentId): static - { - $this->fields['paymentInstrumentId'] = $paymentInstrumentId; - - return $this; - } - - public function getBillingStatus(): ?string - { - return $this->fields['billingStatus'] ?? null; - } - - public function getWebsiteId(): string - { - return $this->fields['websiteId']; - } - - public function setWebsiteId(string $websiteId): static - { - $this->fields['websiteId'] = $websiteId; - - return $this; - } - - public function getCurrency(): ?string - { - return $this->fields['currency'] ?? null; - } - - public function setCurrency(null|string $currency): static - { - $this->fields['currency'] = $currency; - - return $this; - } - - public function getInitialInvoiceId(): ?string - { - return $this->fields['initialInvoiceId'] ?? null; - } - - public function getRecentInvoiceId(): ?string - { - return $this->fields['recentInvoiceId'] ?? null; - } - - /** - * @return OrderItem[] - */ - public function getItems(): array - { - return $this->fields['items']; - } - - /** - * @param array[]|OrderItem[] $items - */ - public function setItems(array $items): static - { - $items = array_map( - fn ($value) => $value instanceof OrderItem ? $value : OrderItem::from($value), - $items, - ); - - $this->fields['items'] = $items; - - return $this; - } - - public function getDeliveryAddress(): ?ContactObject - { - return $this->fields['deliveryAddress'] ?? null; - } - - public function setDeliveryAddress(null|ContactObject|array $deliveryAddress): static - { - if ($deliveryAddress !== null && !($deliveryAddress instanceof ContactObject)) { - $deliveryAddress = ContactObject::from($deliveryAddress); - } - - $this->fields['deliveryAddress'] = $deliveryAddress; - - return $this; - } - - public function getBillingAddress(): ?ContactObject - { - return $this->fields['billingAddress'] ?? null; - } - - public function setBillingAddress(null|ContactObject|array $billingAddress): static - { - if ($billingAddress !== null && !($billingAddress instanceof ContactObject)) { - $billingAddress = ContactObject::from($billingAddress); - } - - $this->fields['billingAddress'] = $billingAddress; - - return $this; - } - - public function getActivationTime(): ?DateTimeImmutable - { - return $this->fields['activationTime'] ?? null; - } - - public function getVoidTime(): ?DateTimeImmutable - { - return $this->fields['voidTime'] ?? null; - } - - public function getAbandonTime(): ?DateTimeImmutable - { - return $this->fields['abandonTime'] ?? null; - } - - public function setAbandonTime(null|DateTimeImmutable|string $abandonTime): static - { - if ($abandonTime !== null && !($abandonTime instanceof DateTimeImmutable)) { - $abandonTime = new DateTimeImmutable($abandonTime); - } - - $this->fields['abandonTime'] = $abandonTime; - - return $this; - } - - /** - * @return null|string[] - */ - public function getCouponIds(): ?array - { - return $this->fields['couponIds'] ?? null; - } - - /** - * @param null|string[] $couponIds - */ - public function setCouponIds(null|array $couponIds): static - { - $this->fields['couponIds'] = $couponIds; - - return $this; - } - - public function getPoNumber(): ?string - { - return $this->fields['poNumber'] ?? null; - } - - public function setPoNumber(null|string $poNumber): static - { - $this->fields['poNumber'] = $poNumber; - - return $this; - } - - public function getShipping(): ?Shipping - { - return $this->fields['shipping'] ?? null; - } - - public function setShipping(null|Shipping|array $shipping): static - { - if ($shipping !== null && !($shipping instanceof Shipping)) { - $shipping = ShippingFactory::from($shipping); - } - - $this->fields['shipping'] = $shipping; - - return $this; - } - - public function getNotes(): ?string - { - return $this->fields['notes'] ?? null; - } - - public function setNotes(null|string $notes): static - { - $this->fields['notes'] = $notes; - - return $this; - } - - public function getCanceledBy(): ?string - { - return $this->fields['canceledBy'] ?? null; - } - - public function getCancelCategory(): ?string - { - return $this->fields['cancelCategory'] ?? null; - } - - public function getCancelDescription(): ?string - { - return $this->fields['cancelDescription'] ?? null; - } - - public function getRevision(): ?int - { - return $this->fields['revision'] ?? null; - } - - public function getRiskMetadata(): ?RiskMetadata - { - return $this->fields['riskMetadata'] ?? null; - } - - public function setRiskMetadata(null|RiskMetadata|array $riskMetadata): static - { - if ($riskMetadata !== null && !($riskMetadata instanceof RiskMetadata)) { - $riskMetadata = RiskMetadata::from($riskMetadata); - } - - $this->fields['riskMetadata'] = $riskMetadata; - - return $this; - } - - public function getCustomFields(): ?array - { - return $this->fields['customFields'] ?? null; - } - - public function setCustomFields(null|array $customFields): static - { - $this->fields['customFields'] = $customFields; - - return $this; - } - - public function getCreatedTime(): ?DateTimeImmutable - { - return $this->fields['createdTime'] ?? null; - } - - public function getUpdatedTime(): ?DateTimeImmutable - { - return $this->fields['updatedTime'] ?? null; - } - - /** - * @return null|ResourceLink[] - */ - public function getLinks(): ?array - { - return $this->fields['_links'] ?? null; - } - - public function getEmbedded(): ?SubscriptionOrderEmbedded - { - return $this->fields['_embedded'] ?? null; - } - - public function setEmbedded(null|SubscriptionOrderEmbedded|array $embedded): static - { - if ($embedded !== null && !($embedded instanceof SubscriptionOrderEmbedded)) { - $embedded = SubscriptionOrderEmbedded::from($embedded); - } - - $this->fields['_embedded'] = $embedded; - - return $this; - } - - public function jsonSerialize(): array - { - $data = [ - 'orderType' => 'subscription-order', - ]; - if (array_key_exists('id', $this->fields)) { - $data['id'] = $this->fields['id']; - } - if (array_key_exists('customerId', $this->fields)) { - $data['customerId'] = $this->fields['customerId']; - } - if (array_key_exists('renewalReminderTime', $this->fields)) { - $data['renewalReminderTime'] = $this->fields['renewalReminderTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('renewalReminderNumber', $this->fields)) { - $data['renewalReminderNumber'] = $this->fields['renewalReminderNumber']; - } - if (array_key_exists('trialReminderTime', $this->fields)) { - $data['trialReminderTime'] = $this->fields['trialReminderTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('trialReminderNumber', $this->fields)) { - $data['trialReminderNumber'] = $this->fields['trialReminderNumber']; - } - if (array_key_exists('abandonReminderTime', $this->fields)) { - $data['abandonReminderTime'] = $this->fields['abandonReminderTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('abandonReminderNumber', $this->fields)) { - $data['abandonReminderNumber'] = $this->fields['abandonReminderNumber']; - } - if (array_key_exists('organizationId', $this->fields)) { - $data['organizationId'] = $this->fields['organizationId']; - } - if (array_key_exists('status', $this->fields)) { - $data['status'] = $this->fields['status']; - } - if (array_key_exists('inTrial', $this->fields)) { - $data['inTrial'] = $this->fields['inTrial']; - } - if (array_key_exists('trial', $this->fields)) { - $data['trial'] = $this->fields['trial']?->jsonSerialize(); - } - if (array_key_exists('isTrialOnly', $this->fields)) { - $data['isTrialOnly'] = $this->fields['isTrialOnly']; - } - if (array_key_exists('invoiceTimeShift', $this->fields)) { - $data['invoiceTimeShift'] = $this->fields['invoiceTimeShift']?->jsonSerialize(); - } - if (array_key_exists('recurringInterval', $this->fields)) { - $data['recurringInterval'] = $this->fields['recurringInterval']?->jsonSerialize(); - } - if (array_key_exists('autopay', $this->fields)) { - $data['autopay'] = $this->fields['autopay']; - } - if (array_key_exists('startTime', $this->fields)) { - $data['startTime'] = $this->fields['startTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('endTime', $this->fields)) { - $data['endTime'] = $this->fields['endTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('renewalTime', $this->fields)) { - $data['renewalTime'] = $this->fields['renewalTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('rebillNumber', $this->fields)) { - $data['rebillNumber'] = $this->fields['rebillNumber']; - } - if (array_key_exists('lineItems', $this->fields)) { - $data['lineItems'] = $this->fields['lineItems']; - } - if (array_key_exists('lineItemSubtotal', $this->fields)) { - $data['lineItemSubtotal'] = $this->fields['lineItemSubtotal']?->jsonSerialize(); - } - if (array_key_exists('paymentInstrumentId', $this->fields)) { - $data['paymentInstrumentId'] = $this->fields['paymentInstrumentId']; - } - if (array_key_exists('billingStatus', $this->fields)) { - $data['billingStatus'] = $this->fields['billingStatus']; - } - if (array_key_exists('websiteId', $this->fields)) { - $data['websiteId'] = $this->fields['websiteId']; - } - if (array_key_exists('currency', $this->fields)) { - $data['currency'] = $this->fields['currency']; - } - if (array_key_exists('initialInvoiceId', $this->fields)) { - $data['initialInvoiceId'] = $this->fields['initialInvoiceId']; - } - if (array_key_exists('recentInvoiceId', $this->fields)) { - $data['recentInvoiceId'] = $this->fields['recentInvoiceId']; - } - if (array_key_exists('items', $this->fields)) { - $data['items'] = $this->fields['items']; - } - if (array_key_exists('deliveryAddress', $this->fields)) { - $data['deliveryAddress'] = $this->fields['deliveryAddress']?->jsonSerialize(); - } - if (array_key_exists('billingAddress', $this->fields)) { - $data['billingAddress'] = $this->fields['billingAddress']?->jsonSerialize(); - } - if (array_key_exists('activationTime', $this->fields)) { - $data['activationTime'] = $this->fields['activationTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('voidTime', $this->fields)) { - $data['voidTime'] = $this->fields['voidTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('abandonTime', $this->fields)) { - $data['abandonTime'] = $this->fields['abandonTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('couponIds', $this->fields)) { - $data['couponIds'] = $this->fields['couponIds']; - } - if (array_key_exists('poNumber', $this->fields)) { - $data['poNumber'] = $this->fields['poNumber']; - } - if (array_key_exists('shipping', $this->fields)) { - $data['shipping'] = $this->fields['shipping']?->jsonSerialize(); - } - if (array_key_exists('notes', $this->fields)) { - $data['notes'] = $this->fields['notes']; - } - if (array_key_exists('canceledBy', $this->fields)) { - $data['canceledBy'] = $this->fields['canceledBy']; - } - if (array_key_exists('cancelCategory', $this->fields)) { - $data['cancelCategory'] = $this->fields['cancelCategory']; - } - if (array_key_exists('cancelDescription', $this->fields)) { - $data['cancelDescription'] = $this->fields['cancelDescription']; - } - if (array_key_exists('revision', $this->fields)) { - $data['revision'] = $this->fields['revision']; - } - if (array_key_exists('riskMetadata', $this->fields)) { - $data['riskMetadata'] = $this->fields['riskMetadata']?->jsonSerialize(); - } - if (array_key_exists('customFields', $this->fields)) { - $data['customFields'] = $this->fields['customFields']; - } - if (array_key_exists('createdTime', $this->fields)) { - $data['createdTime'] = $this->fields['createdTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('updatedTime', $this->fields)) { - $data['updatedTime'] = $this->fields['updatedTime']?->format(DateTimeInterface::RFC3339); - } - if (array_key_exists('_links', $this->fields)) { - $data['_links'] = $this->fields['_links']; - } - if (array_key_exists('_embedded', $this->fields)) { - $data['_embedded'] = $this->fields['_embedded']?->jsonSerialize(); - } - - return $data; - } - - private function setId(null|string $id): static - { - $this->fields['id'] = $id; - - return $this; - } - - private function setRenewalReminderTime(null|DateTimeImmutable|string $renewalReminderTime): static - { - if ($renewalReminderTime !== null && !($renewalReminderTime instanceof DateTimeImmutable)) { - $renewalReminderTime = new DateTimeImmutable($renewalReminderTime); - } - - $this->fields['renewalReminderTime'] = $renewalReminderTime; - - return $this; - } - - private function setRenewalReminderNumber(null|int $renewalReminderNumber): static - { - $this->fields['renewalReminderNumber'] = $renewalReminderNumber; - - return $this; - } - - private function setTrialReminderTime(null|DateTimeImmutable|string $trialReminderTime): static - { - if ($trialReminderTime !== null && !($trialReminderTime instanceof DateTimeImmutable)) { - $trialReminderTime = new DateTimeImmutable($trialReminderTime); - } - - $this->fields['trialReminderTime'] = $trialReminderTime; - - return $this; - } - - private function setTrialReminderNumber(null|int $trialReminderNumber): static - { - $this->fields['trialReminderNumber'] = $trialReminderNumber; - - return $this; - } - - private function setAbandonReminderTime(null|DateTimeImmutable|string $abandonReminderTime): static - { - if ($abandonReminderTime !== null && !($abandonReminderTime instanceof DateTimeImmutable)) { - $abandonReminderTime = new DateTimeImmutable($abandonReminderTime); - } - - $this->fields['abandonReminderTime'] = $abandonReminderTime; - - return $this; - } - - private function setAbandonReminderNumber(null|int $abandonReminderNumber): static - { - $this->fields['abandonReminderNumber'] = $abandonReminderNumber; - - return $this; - } - - private function setStatus(null|string $status): static - { - $this->fields['status'] = $status; - - return $this; - } - - private function setInTrial(null|bool $inTrial): static - { - $this->fields['inTrial'] = $inTrial; - - return $this; - } - - private function setEndTime(null|DateTimeImmutable|string $endTime): static - { - if ($endTime !== null && !($endTime instanceof DateTimeImmutable)) { - $endTime = new DateTimeImmutable($endTime); - } - - $this->fields['endTime'] = $endTime; - - return $this; - } - - private function setRebillNumber(null|int $rebillNumber): static - { - $this->fields['rebillNumber'] = $rebillNumber; - - return $this; - } - - /** - * @param null|array[]|SubscriptionOrderLineItems[] $lineItems - */ - private function setLineItems(null|array $lineItems): static - { - $lineItems = $lineItems !== null ? array_map( - fn ($value) => $value instanceof SubscriptionOrderLineItems ? $value : SubscriptionOrderLineItems::from($value), - $lineItems, - ) : null; - - $this->fields['lineItems'] = $lineItems; - - return $this; - } - - private function setBillingStatus(null|string $billingStatus): static - { - $this->fields['billingStatus'] = $billingStatus; - - return $this; - } - - private function setInitialInvoiceId(null|string $initialInvoiceId): static - { - $this->fields['initialInvoiceId'] = $initialInvoiceId; - - return $this; - } - - private function setRecentInvoiceId(null|string $recentInvoiceId): static - { - $this->fields['recentInvoiceId'] = $recentInvoiceId; - - return $this; - } - - private function setActivationTime(null|DateTimeImmutable|string $activationTime): static - { - if ($activationTime !== null && !($activationTime instanceof DateTimeImmutable)) { - $activationTime = new DateTimeImmutable($activationTime); - } - - $this->fields['activationTime'] = $activationTime; - - return $this; - } - - private function setVoidTime(null|DateTimeImmutable|string $voidTime): static - { - if ($voidTime !== null && !($voidTime instanceof DateTimeImmutable)) { - $voidTime = new DateTimeImmutable($voidTime); - } - - $this->fields['voidTime'] = $voidTime; - - return $this; - } - - private function setCanceledBy(null|string $canceledBy): static - { - $this->fields['canceledBy'] = $canceledBy; - - return $this; - } - - private function setCancelCategory(null|string $cancelCategory): static - { - $this->fields['cancelCategory'] = $cancelCategory; - - return $this; - } - - private function setCancelDescription(null|string $cancelDescription): static - { - $this->fields['cancelDescription'] = $cancelDescription; - - return $this; - } - - private function setRevision(null|int $revision): static - { - $this->fields['revision'] = $revision; - - return $this; - } - - private function setCreatedTime(null|DateTimeImmutable|string $createdTime): static - { - if ($createdTime !== null && !($createdTime instanceof DateTimeImmutable)) { - $createdTime = new DateTimeImmutable($createdTime); - } - - $this->fields['createdTime'] = $createdTime; - - return $this; - } - - private function setUpdatedTime(null|DateTimeImmutable|string $updatedTime): static - { - if ($updatedTime !== null && !($updatedTime instanceof DateTimeImmutable)) { - $updatedTime = new DateTimeImmutable($updatedTime); - } - - $this->fields['updatedTime'] = $updatedTime; - - return $this; - } - - /** - * @param null|array[]|ResourceLink[] $links - */ - private function setLinks(null|array $links): static - { - $links = $links !== null ? array_map( - fn ($value) => $value instanceof ResourceLink ? $value : ResourceLink::from($value), - $links, - ) : null; - - $this->fields['_links'] = $links; - - return $this; - } -} diff --git a/src/Model/SubscriptionOrderPlanRecurringInterval.php b/src/Model/SubscriptionOrderPlanRecurringInterval.php index 1ec219f27..97f2ddb8a 100644 --- a/src/Model/SubscriptionOrderPlanRecurringInterval.php +++ b/src/Model/SubscriptionOrderPlanRecurringInterval.php @@ -55,13 +55,17 @@ public static function from(array $data = []): self return new self($data); } - public function getPeriodAnchorInstruction(): ?string + public function getPeriodAnchorInstruction(): ?ServicePeriodAnchorInstruction { return $this->fields['periodAnchorInstruction'] ?? null; } - public function setPeriodAnchorInstruction(null|string $periodAnchorInstruction): static + public function setPeriodAnchorInstruction(null|ServicePeriodAnchorInstruction|array $periodAnchorInstruction): static { + if ($periodAnchorInstruction !== null && !($periodAnchorInstruction instanceof ServicePeriodAnchorInstruction)) { + $periodAnchorInstruction = ServicePeriodAnchorInstructionFactory::from($periodAnchorInstruction); + } + $this->fields['periodAnchorInstruction'] = $periodAnchorInstruction; return $this; @@ -119,7 +123,7 @@ public function jsonSerialize(): array { $data = []; if (array_key_exists('periodAnchorInstruction', $this->fields)) { - $data['periodAnchorInstruction'] = $this->fields['periodAnchorInstruction']; + $data['periodAnchorInstruction'] = $this->fields['periodAnchorInstruction']?->jsonSerialize(); } if (array_key_exists('unit', $this->fields)) { $data['unit'] = $this->fields['unit']; diff --git a/src/Model/SubscriptionOrderPlanTrial.php b/src/Model/SubscriptionOrderPlanTrial.php new file mode 100644 index 000000000..2929c3e35 --- /dev/null +++ b/src/Model/SubscriptionOrderPlanTrial.php @@ -0,0 +1,81 @@ +setPrice($data['price']); + } + if (array_key_exists('period', $data)) { + $this->setPeriod($data['period']); + } + } + + public static function from(array $data = []): self + { + return new self($data); + } + + public function getPrice(): float + { + return $this->fields['price']; + } + + public function setPrice(float|string $price): static + { + if (is_string($price)) { + $price = (float) $price; + } + + $this->fields['price'] = $price; + + return $this; + } + + public function getPeriod(): SubscriptionOrderPlanTrialPeriod + { + return $this->fields['period']; + } + + public function setPeriod(SubscriptionOrderPlanTrialPeriod|array $period): static + { + if (!($period instanceof SubscriptionOrderPlanTrialPeriod)) { + $period = SubscriptionOrderPlanTrialPeriod::from($period); + } + + $this->fields['period'] = $period; + + return $this; + } + + public function jsonSerialize(): array + { + $data = []; + if (array_key_exists('price', $this->fields)) { + $data['price'] = $this->fields['price']; + } + if (array_key_exists('period', $this->fields)) { + $data['period'] = $this->fields['period']?->jsonSerialize(); + } + + return $data; + } +} diff --git a/src/Model/SubscriptionOrderRecurringInterval.php b/src/Model/SubscriptionRecurringInterval.php similarity index 95% rename from src/Model/SubscriptionOrderRecurringInterval.php rename to src/Model/SubscriptionRecurringInterval.php index e290600b5..580d5b660 100644 --- a/src/Model/SubscriptionOrderRecurringInterval.php +++ b/src/Model/SubscriptionRecurringInterval.php @@ -15,7 +15,7 @@ use JsonSerializable; -class SubscriptionOrderRecurringInterval implements JsonSerializable +class SubscriptionRecurringInterval implements JsonSerializable { private array $fields = []; diff --git a/src/Model/SubscriptionOrderTrial.php b/src/Model/SubscriptionTrial.php similarity index 96% rename from src/Model/SubscriptionOrderTrial.php rename to src/Model/SubscriptionTrial.php index 005ed567b..099d3fb08 100644 --- a/src/Model/SubscriptionOrderTrial.php +++ b/src/Model/SubscriptionTrial.php @@ -17,7 +17,7 @@ use DateTimeInterface; use JsonSerializable; -class SubscriptionOrderTrial implements JsonSerializable +class SubscriptionTrial implements JsonSerializable { private array $fields = []; diff --git a/src/Model/TagUntagRule.php b/src/Model/TagUntagRule.php index aa791abbb..363adebad 100644 --- a/src/Model/TagUntagRule.php +++ b/src/Model/TagUntagRule.php @@ -109,6 +109,8 @@ class TagUntagRule implements JsonSerializable public const EVENT_TYPE_SUBSCRIPTION_DOWNGRADED = 'subscription-downgraded'; + public const EVENT_TYPE_SUBSCRIPTION_ITEMS_CHANGED = 'subscription-items-changed'; + public const EVENT_TYPE_SUBSCRIPTION_PAUSED = 'subscription-paused'; public const EVENT_TYPE_SUBSCRIPTION_REACTIVATED = 'subscription-reactivated'; @@ -125,6 +127,8 @@ class TagUntagRule implements JsonSerializable public const EVENT_TYPE_TRANSACTION_DISCREPANCY_FOUND = 'transaction-discrepancy-found'; + public const EVENT_TYPE_ORDER_DELINQUENCY_REACHED = 'order-delinquency-reached'; + public const STATUS_ACTIVE = 'active'; public const STATUS_INACTIVE = 'inactive'; diff --git a/src/Model/Transaction.php b/src/Model/Transaction.php index 1cb63edf5..3bd328f08 100644 --- a/src/Model/Transaction.php +++ b/src/Model/Transaction.php @@ -291,6 +291,12 @@ public function __construct(array $data = []) if (array_key_exists('organizationId', $data)) { $this->setOrganizationId($data['organizationId']); } + if (array_key_exists('depositRequestId', $data)) { + $this->setDepositRequestId($data['depositRequestId']); + } + if (array_key_exists('payoutRequestId', $data)) { + $this->setPayoutRequestId($data['payoutRequestId']); + } if (array_key_exists('_links', $data)) { $this->setLinks($data['_links']); } @@ -884,6 +890,16 @@ public function setOrganizationId(null|string $organizationId): static return $this; } + public function getDepositRequestId(): ?string + { + return $this->fields['depositRequestId'] ?? null; + } + + public function getPayoutRequestId(): ?string + { + return $this->fields['payoutRequestId'] ?? null; + } + /** * @return null|ResourceLink[] */ @@ -1109,6 +1125,12 @@ public function jsonSerialize(): array if (array_key_exists('organizationId', $this->fields)) { $data['organizationId'] = $this->fields['organizationId']; } + if (array_key_exists('depositRequestId', $this->fields)) { + $data['depositRequestId'] = $this->fields['depositRequestId']; + } + if (array_key_exists('payoutRequestId', $this->fields)) { + $data['payoutRequestId'] = $this->fields['payoutRequestId']; + } if (array_key_exists('_links', $this->fields)) { $data['_links'] = $this->fields['_links']; } @@ -1433,6 +1455,20 @@ private function setDiscrepancyTime(null|DateTimeImmutable|string $discrepancyTi return $this; } + private function setDepositRequestId(null|string $depositRequestId): static + { + $this->fields['depositRequestId'] = $depositRequestId; + + return $this; + } + + private function setPayoutRequestId(null|string $payoutRequestId): static + { + $this->fields['payoutRequestId'] = $payoutRequestId; + + return $this; + } + /** * @param null|array[]|ResourceLink[] $links */ diff --git a/src/Model/TruevoCredentials.php b/src/Model/TruevoCredentials.php index 847b9e391..efaa3de3b 100644 --- a/src/Model/TruevoCredentials.php +++ b/src/Model/TruevoCredentials.php @@ -39,6 +39,9 @@ public function __construct(array $data = []) if (array_key_exists('sftpPrivateKey', $data)) { $this->setSftpPrivateKey($data['sftpPrivateKey']); } + if (array_key_exists('sftpKeyPassphrase', $data)) { + $this->setSftpKeyPassphrase($data['sftpKeyPassphrase']); + } } public static function from(array $data = []): self @@ -118,6 +121,18 @@ public function setSftpPrivateKey(null|string $sftpPrivateKey): static return $this; } + public function getSftpKeyPassphrase(): ?string + { + return $this->fields['sftpKeyPassphrase'] ?? null; + } + + public function setSftpKeyPassphrase(null|string $sftpKeyPassphrase): static + { + $this->fields['sftpKeyPassphrase'] = $sftpKeyPassphrase; + + return $this; + } + public function jsonSerialize(): array { $data = []; @@ -139,6 +154,9 @@ public function jsonSerialize(): array if (array_key_exists('sftpPrivateKey', $this->fields)) { $data['sftpPrivateKey'] = $this->fields['sftpPrivateKey']; } + if (array_key_exists('sftpKeyPassphrase', $this->fields)) { + $data['sftpKeyPassphrase'] = $this->fields['sftpKeyPassphrase']; + } return $data; } diff --git a/src/Model/WorldpaySettings.php b/src/Model/WorldpaySettings.php index 584ec0718..14a5ab578 100644 --- a/src/Model/WorldpaySettings.php +++ b/src/Model/WorldpaySettings.php @@ -17,6 +17,12 @@ class WorldpaySettings implements JsonSerializable { + public const ENFORCE_STORED_CREDENTIALS_DISABLED = 'disabled'; + + public const ENFORCE_STORED_CREDENTIALS_MIT_ENABLED = 'mit-enabled'; + + public const ENFORCE_STORED_CREDENTIALS_ALWAYS_ENABLED = 'always-enabled'; + public const MERCHANT_INITIATED_REASON_UNSCHEDULED = 'UNSCHEDULED'; public const MERCHANT_INITIATED_REASON_RECURRING = 'RECURRING'; @@ -40,8 +46,8 @@ public function __construct(array $data = []) if (array_key_exists('delay', $data)) { $this->setDelay($data['delay']); } - if (array_key_exists('enableStoredCredentials', $data)) { - $this->setEnableStoredCredentials($data['enableStoredCredentials']); + if (array_key_exists('enforceStoredCredentials', $data)) { + $this->setEnforceStoredCredentials($data['enforceStoredCredentials']); } if (array_key_exists('merchantInitiatedReason', $data)) { $this->setMerchantInitiatedReason($data['merchantInitiatedReason']); @@ -65,14 +71,14 @@ public function setDelay(null|int $delay): static return $this; } - public function getEnableStoredCredentials(): ?bool + public function getEnforceStoredCredentials(): ?string { - return $this->fields['enableStoredCredentials'] ?? null; + return $this->fields['enforceStoredCredentials'] ?? null; } - public function setEnableStoredCredentials(null|bool $enableStoredCredentials): static + public function setEnforceStoredCredentials(null|string $enforceStoredCredentials): static { - $this->fields['enableStoredCredentials'] = $enableStoredCredentials; + $this->fields['enforceStoredCredentials'] = $enforceStoredCredentials; return $this; } @@ -95,8 +101,8 @@ public function jsonSerialize(): array if (array_key_exists('delay', $this->fields)) { $data['delay'] = $this->fields['delay']; } - if (array_key_exists('enableStoredCredentials', $this->fields)) { - $data['enableStoredCredentials'] = $this->fields['enableStoredCredentials']; + if (array_key_exists('enforceStoredCredentials', $this->fields)) { + $data['enforceStoredCredentials'] = $this->fields['enforceStoredCredentials']; } if (array_key_exists('merchantInitiatedReason', $this->fields)) { $data['merchantInitiatedReason'] = $this->fields['merchantInitiatedReason']; diff --git a/src/UsersService.php b/src/UsersService.php index 2ba3d01c1..6940dd85c 100644 --- a/src/UsersService.php +++ b/src/UsersService.php @@ -73,6 +73,8 @@ class UsersService private Api\ProfileApi $profile; + private Api\RichBillingPortalsApi $richBillingPortals; + private Api\RolesApi $roles; private Api\SegmentsApi $segments; @@ -121,6 +123,7 @@ public function __construct(Client $client = null, array $config = []) $this->paymentMethods = new Api\PaymentMethodsApi($this->client); $this->previews = new Api\PreviewsApi($this->client); $this->profile = new Api\ProfileApi($this->client); + $this->richBillingPortals = new Api\RichBillingPortalsApi($this->client); $this->roles = new Api\RolesApi($this->client); $this->segments = new Api\SegmentsApi($this->client); $this->sendThroughAttribution = new Api\SendThroughAttributionApi($this->client); @@ -272,6 +275,11 @@ public function profile(): Api\ProfileApi return $this->profile; } + public function richBillingPortals(): Api\RichBillingPortalsApi + { + return $this->richBillingPortals; + } + public function roles(): Api\RolesApi { return $this->roles;