From 8a45687a90804953e372540fe209c87ad74f5c99 Mon Sep 17 00:00:00 2001 From: p-zielinski <82354717+p-zielinski@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:05:37 +0100 Subject: [PATCH] dockerfile --- Dockerfile | 22 + README.md | 16 +- __tests__/index.php | 324 +++++++++ docs/Model/BusValRuleAssignment.md | 4 +- ...alificationsCheckEligibilityRequestBody.md | 2 +- .../CustomerActivityDataOrderItemsItem.md | 2 +- ...merActivityDataRedemptionOrderItemsItem.md | 2 +- docs/Model/OrderCalculated.md | 2 +- docs/Model/OrderCalculatedBase.md | 2 +- docs/Model/OrderCalculatedNoCustomerData.md | 2 +- docs/Model/OrderItemCalculated.md | 1 + docs/Model/OrdersCreateResponseBody.md | 2 +- docs/Model/OrdersGetResponseBody.md | 2 +- docs/Model/OrdersUpdateResponseBody.md | 2 +- ...alificationsCheckEligibilityRequestBody.md | 2 +- docs/Model/QualificationsOption.md | 13 + docs/Model/QualificationsOptionFilters.md | 15 + src/Model/BusValRuleAssignment.php | 14 +- ...lificationsCheckEligibilityRequestBody.php | 6 +- .../CustomerActivityDataOrderItemsItem.php | 80 +-- ...erActivityDataRedemptionOrderItemsItem.php | 80 +-- src/Model/OrderCalculated.php | 7 +- src/Model/OrderCalculatedBase.php | 7 +- src/Model/OrderCalculatedNoCustomerData.php | 7 +- src/Model/OrderItemCalculated.php | 34 + src/Model/OrdersCreateResponseBody.php | 7 +- src/Model/OrdersGetResponseBody.php | 7 +- src/Model/OrdersUpdateResponseBody.php | 7 +- ...lificationsCheckEligibilityRequestBody.php | 6 +- src/Model/QualificationsOption.php | 625 +++++++++++++++++ src/Model/QualificationsOptionFilters.php | 649 ++++++++++++++++++ 31 files changed, 1804 insertions(+), 147 deletions(-) create mode 100644 Dockerfile create mode 100644 __tests__/index.php create mode 100644 docs/Model/QualificationsOption.md create mode 100644 docs/Model/QualificationsOptionFilters.md create mode 100644 src/Model/QualificationsOption.php create mode 100644 src/Model/QualificationsOptionFilters.php diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..383e05d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Stage 1: Build stage +FROM composer:2.6.6 AS composer + +WORKDIR /app + +VOLUME /app/data + +COPY . . + +RUN composer install + + +# Stage 2: Final image +FROM php:8.3 + +WORKDIR /app + +COPY --from=composer /app /app + +VOLUME /app/data + +CMD ["php", "-S", "0.0.0.0:5050", "./__tests__/index.php"] diff --git a/README.md b/README.md index 785ee1c..0e8ed72 100644 --- a/README.md +++ b/README.md @@ -272,8 +272,6 @@ Class | Method | HTTP request | Description - [ClientEventsCreateRequestBodyReferral](docs/Model/ClientEventsCreateRequestBodyReferral.md) - [ClientEventsCreateResponseBody](docs/Model/ClientEventsCreateResponseBody.md) - [ClientQualificationsCheckEligibilityRequestBody](docs/Model/ClientQualificationsCheckEligibilityRequestBody.md) -- [ClientQualificationsCheckEligibilityRequestBodyOptions](docs/Model/ClientQualificationsCheckEligibilityRequestBodyOptions.md) -- [ClientQualificationsCheckEligibilityRequestBodyOptionsFilters](docs/Model/ClientQualificationsCheckEligibilityRequestBodyOptionsFilters.md) - [ClientQualificationsCheckEligibilityResponseBody](docs/Model/ClientQualificationsCheckEligibilityResponseBody.md) - [ClientRedemptionsRedeemRequestBody](docs/Model/ClientRedemptionsRedeemRequestBody.md) - [ClientRedemptionsRedeemRequestBodyAllOfOptions](docs/Model/ClientRedemptionsRedeemRequestBodyAllOfOptions.md) @@ -607,6 +605,8 @@ Class | Method | HTTP request | Description - [QualificationsCheckEligibilityResponseBody](docs/Model/QualificationsCheckEligibilityResponseBody.md) - [QualificationsFieldConditions](docs/Model/QualificationsFieldConditions.md) - [QualificationsFiltersCondition](docs/Model/QualificationsFiltersCondition.md) +- [QualificationsOption](docs/Model/QualificationsOption.md) +- [QualificationsOptionFilters](docs/Model/QualificationsOptionFilters.md) - [QualificationsRedeemable](docs/Model/QualificationsRedeemable.md) - [QualificationsRedeemableBase](docs/Model/QualificationsRedeemableBase.md) - [QualificationsRedeemables](docs/Model/QualificationsRedeemables.md) @@ -885,14 +885,12 @@ Class | Method | HTTP request | Description - **Location**: URL query string -## Tests +## Run local tests with docker -To run the tests, use: - -```bash -composer install -vendor/bin/phpunit -``` +1. Copy `.env.example` to `.env` and fill in the values. +2. Run `docker build -t php .` to build the image. +3. Run `docker run --rm php` to run the tests and delete container immediately after. +4. Make changes Your desire and run again command from step 3. It uses volumes so no need to rebuild the image. ## Author diff --git a/__tests__/index.php b/__tests__/index.php new file mode 100644 index 0000000..26c7006 --- /dev/null +++ b/__tests__/index.php @@ -0,0 +1,324 @@ +setApiKey('X-App-Id', $env["X_APP_ID"]); +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Token', $env["X_APP_TOKEN"]); +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setHost($env["VOUCHERIFY_HOST"]); + +//create productsApi +$productsApiInstance = new OpenAPI\Client\Api\ProductsApi( + new GuzzleHttp\Client(), + $config +); + +//create variables to store products data +$created_product; +$created_product2; +//create Products +$products_create_request_body = new \OpenAPI\Client\Model\ProductsCreateRequestBody(); +$products_create_request_body->setSourceId(generateRandomString()); +$products_create_request_body->setName(generateRandomString()); +$products_create_request_body->setPrice(20000); +$products_create_request_body->setAttributes(["color", "memory", "processor"]); +try { + $created_product = $productsApiInstance->createProduct($products_create_request_body); + echo '
createProduct
' . json_encode($created_product, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->createProduct: ', $e->getMessage(), PHP_EOL; +} +$products_create_request_body->setSourceId(generateRandomString()); +$products_create_request_body->setName(generateRandomString()); +$products_create_request_body->setPrice(66000); +try { + $created_product2 = $productsApiInstance->createProduct($products_create_request_body); + echo '
createProduct
' . json_encode($created_product, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->createProduct: ', $e->getMessage(), PHP_EOL; +} + +//create campaignsApi +$campaignsApiInstance = new OpenAPI\Client\Api\CampaignsApi( + new GuzzleHttp\Client(), + $config +); + +//create validationRulesApi +$validationRulesApiInstance = new OpenAPI\Client\Api\ValidationRulesApi( + new GuzzleHttp\Client(), + $config +); + +//create variable to store campaign data +$created_validation_rule; +//create validation rule +$validation_rules_create_request_body = new \OpenAPI\Client\Model\ValidationRulesCreateRequestBody(); +$applicable_to_created_product2 = new \OpenAPI\Client\Model\ApplicableTo(); +$applicable_to_created_product2->setProductId($created_product2->getId()); +$applicable_to_created_product2->setObject("product"); +$validation_rules_create_request_body->setApplicableTo(new \OpenAPI\Client\Model\ValidationRuleBaseApplicableTo()); +$validation_rules_create_request_body->getApplicableTo()->setIncluded([$applicable_to_created_product2]); +$validation_rules_create_request_body->setType("basic"); +$validation_rules_create_request_body->setName(generateRandomString()); +try { + echo '
createValidationRules
' . json_encode($validation_rules_create_request_body, JSON_PRETTY_PRINT) . '
'; + $created_validation_rule = $validationRulesApiInstance->createValidationRules($validation_rules_create_request_body); + echo '
createValidationRules
' . json_encode($created_validation_rule, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->createValidationRules: ', $e->getMessage(), PHP_EOL; +} + +//create variable to store campaign data +$created_discount_campaign; +//createCampaign - DISCOUNT_COUPONS +$campaigns_create_request_body_discount = new \OpenAPI\Client\Model\CampaignsCreateRequestBody(); +$campaigns_create_request_body_discount->setName(generateRandomString(12)); +$campaigns_create_request_body_discount->setCampaignType("DISCOUNT_COUPONS"); +$campaigns_create_request_body_discount->setType("AUTO_UPDATE"); +$campaigns_create_request_body_discount->setVoucher(new \OpenAPI\Client\Model\CampaignsCreateRequestBodyVoucher()); +$campaigns_create_request_body_discount->getVoucher()->setType("DISCOUNT_VOUCHER"); +$campaigns_create_request_body_discount->getVoucher()->setDiscount(new \OpenAPI\Client\Model\Discount()); +$campaigns_create_request_body_discount->getVoucher()->getDiscount()->setType("AMOUNT"); +$campaigns_create_request_body_discount->getVoucher()->getDiscount()->setAmountOff(1000); +try { + $created_discount_campaign = $campaignsApiInstance->createCampaign($campaigns_create_request_body_discount); + echo '
createCampaign - DISCOUNT_COUPONS
' . json_encode($created_discount_campaign, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->createCampaign: ', $e->getMessage(), PHP_EOL; +} + +//addVouchersToCampaign +$campaign_voucher; +try { + $campaign_voucher = $campaignsApiInstance->addVouchersToCampaign($created_discount_campaign->getId(), 1); + echo '
addVouchersToCampaign
' . json_encode($campaign_voucher, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->getCampaign: ', $e->getMessage(), PHP_EOL; +} + +//create variable to store campaign data +$created_promotion_campaign; +//promotionTierCreateParams +$promotionTierCreateParams = new \OpenAPI\Client\Model\PromotionTierCreateParams(); +$promotionTierCreateParams->setName(generateRandomString()); +$promotionTierCreateParams->setBanner('testBanner'); +$promotionTierCreateParams->setAction(new \OpenAPI\Client\Model\PromotionTierAction()); +$promotionTierCreateParams->getAction()->setDiscount(new \OpenAPI\Client\Model\Discount()); +$promotionTierCreateParams->getAction()->getDiscount()->setType("AMOUNT"); +$promotionTierCreateParams->getAction()->getDiscount()->setAmountOff(1000); +//createCampaign - PROMOTION +$campaigns_create_request_body_promotion = new \OpenAPI\Client\Model\CampaignsCreateRequestBody(); +$campaigns_create_request_body_promotion->setName(generateRandomString(12)); +$campaigns_create_request_body_promotion->setCampaignType("PROMOTION"); +$campaigns_create_request_body_promotion->setPromotion(new \OpenAPI\Client\Model\CampaignsCreateRequestBodyPromotion()); +$campaigns_create_request_body_promotion->getPromotion()->setTiers([$promotionTierCreateParams]); +try { + $created_promotion_campaign = $campaignsApiInstance->createCampaign($campaigns_create_request_body_promotion); + echo '
createCampaign - PROMOTION
' . json_encode($created_promotion_campaign, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->createCampaign: ', $e->getMessage(), PHP_EOL; +} + + +//listCampaigns +$limit = 2; // int | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. +$page = 1; // int | Which page of results to return. +$campaign_type = \OpenAPI\Client\Model\ParameterCampaignType::DISCOUNT_COUPONS->value; // ParameterCampaignType +$expand = \OpenAPI\Client\Model\ParameterExpandListCampaigns::CATEGORY->value; // ParameterExpandListCampaigns +$order = \OpenAPI\Client\Model\ParameterOrderListCampaigns::CREATED_AT2->value; // ParameterOrderListCampaigns +try { + $result = $campaignsApiInstance->listCampaigns($limit, $page, $campaign_type, $expand, $order); + echo '
listCampaigns
' . json_encode($result, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->listCampaigns: ', $e->getMessage(), PHP_EOL; +} + +//getCampaign +try { + $result = $campaignsApiInstance->getCampaign($created_discount_campaign->getId()); + echo '
getCampaign
' . json_encode($result, JSON_PRETTY_PRINT) . '
'; + echo '
getValidationRulesAssignments
' . json_encode($result->getValidationRulesAssignments(), JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->getCampaign: ', $e->getMessage(), PHP_EOL; +} + +//create customersApi +$customersApiInstance = new OpenAPI\Client\Api\CustomersApi( + new GuzzleHttp\Client(), + $config +); + +//create variable to store customer data +$created_customer; + +//createCustomer +$customersCreateRequestBody = new \OpenAPI\Client\Model\CustomersCreateRequestBody(); +$customersCreateRequestBody->setSourceId('test123'); +$customersCreateRequestBody->setName('test123'); +$customersCreateRequestBody->setAddress(new \OpenAPI\Client\Model\CustomerBaseAddress()); +$customersCreateRequestBody->getAddress()->setCountry('US'); +$customersCreateRequestBody->getAddress()->setCity('Vice City'); +$customersCreateRequestBody->getAddress()->setLine1('123'); +$customersCreateRequestBody->getAddress()->setPostalCode('60089'); +try { + $created_customer = $customersApiInstance->createCustomer($customersCreateRequestBody); + echo '
createCustomer
' . json_encode($created_customer, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->createCustomer: ', $e->getMessage(), PHP_EOL; +} + +//create qualificationsApi +$qualificationsApiInstance = new OpenAPI\Client\Api\QualificationsApi( + new GuzzleHttp\Client(), + $config +); + +//create variable to store checkEligibility result data +$check_eligibility_result; + + +//create orderItem +$order_item = new \OpenAPI\Client\Model\OrderItem(); +$order_item->setPrice($created_product->getPrice()); +$order_item->setQuantity(3); +$order_item->setProductId($created_product->getId()); + +//qualifications_check_eligibility_request_body +$qualifications_check_eligibility_request_body = new \OpenAPI\Client\Model\QualificationsCheckEligibilityRequestBody(); +$qualifications_check_eligibility_request_body->setCustomer(new \OpenAPI\Client\Model\Customer()); +$qualifications_check_eligibility_request_body->getCustomer()->setId($created_customer->getId()); +$qualifications_check_eligibility_request_body->setOrder(new \OpenAPI\Client\Model\Order()); +$qualifications_check_eligibility_request_body->getOrder()->setStatus("CREATED"); +$qualifications_check_eligibility_request_body->getOrder()->setItems([$order_item]); +$qualifications_check_eligibility_request_body->setMode("BASIC"); +$qualifications_check_eligibility_request_body->setScenario("ALL"); +try { + $check_eligibility_result = $qualificationsApiInstance->checkEligibility($qualifications_check_eligibility_request_body); + echo '
checkEligibility
' . json_encode($check_eligibility_result, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->createCustomer: ', $e->getMessage(), PHP_EOL; +} +$applicable_promotion_tiers = array_slice(array_filter($check_eligibility_result->getRedeemables()->getData(), function ($redeemable) { + return $redeemable->getObject() === 'promotion_tier'; +}), 0, 3); +$applicable_promotion_tiers_ids = array_map(function ($promotion_tier) { + return $promotion_tier->getId(); +}, $applicable_promotion_tiers); + +//create stackableDiscountsApi +$stackedDiscountsApiInstance = new OpenAPI\Client\Api\StackableDiscountsApi( + new GuzzleHttp\Client(), + $config +); + +//validateStackedDiscounts +$validations_validate_request_body = new \OpenAPI\Client\Model\ValidationsValidateRequestBody(); +$validations_validate_request_body->setOrder(new \OpenAPI\Client\Model\Order()); +$validations_validate_request_body->getOrder()->setStatus("CREATED"); +$validations_validate_request_body->getOrder()->setItems([$order_item]); +$validations_validate_request_body->setCustomer(new \OpenAPI\Client\Model\Customer()); +$validations_validate_request_body->getCustomer()->setSourceId($created_customer->getSourceId()); +$validations_validate_request_body_redeemables = []; +foreach ($applicable_promotion_tiers_ids as $promotion_tier_id) { + $redeemable = new \OpenAPI\Client\Model\StackableValidateRedeemBaseRedeemablesItem(); + $redeemable->setId($promotion_tier_id); + $redeemable->setObject("promotion_tier"); + array_push($validations_validate_request_body_redeemables, $redeemable); +} +$voucher_redeemable = new \OpenAPI\Client\Model\StackableValidateRedeemBaseRedeemablesItem(); +$voucher_redeemable->setId($campaign_voucher->getCode()); +$voucher_redeemable->setObject("voucher"); +array_push($validations_validate_request_body_redeemables, $voucher_redeemable); +$validations_validate_request_body->setRedeemables($validations_validate_request_body_redeemables); +try { + $result = $stackedDiscountsApiInstance->validateStackedDiscounts($validations_validate_request_body); + echo '
validateStackedDiscounts
' . json_encode($result, JSON_PRETTY_PRINT) . '
'; + $result->getOrder(); + echo '
order.amount = ' . $result->getOrder()->getAmount() . '
order.total_discount_amount = ' . $result->getOrder()->getTotalDiscountAmount() + . '
order.total_amount = ' . $result->getOrder()->getTotalAmount() . '
'; +} catch (Exception $e) { + echo 'Exception when calling StackableDiscountsApi->redeemStackedDiscounts: ', $e->getMessage(), PHP_EOL; +} + +//validateStackedDiscounts +$redemptions_redeem_request_body = new \OpenAPI\Client\Model\RedemptionsRedeemRequestBody(); +$redemptions_redeem_request_body->setOrder(new \OpenAPI\Client\Model\Order()); +$redemptions_redeem_request_body->getOrder()->setStatus("CREATED"); +$redemptions_redeem_request_body->getOrder()->setItems([$order_item]); +$redemptions_redeem_request_body->setCustomer(new \OpenAPI\Client\Model\Customer()); +$redemptions_redeem_request_body->getCustomer()->setSourceId($created_customer->getSourceId()); +$redemptions_redeem_request_body->setRedeemables($validations_validate_request_body_redeemables); +try { + $result = $stackedDiscountsApiInstance->redeemStackedDiscounts($redemptions_redeem_request_body); + echo '
redeemStackedDiscounts
' . json_encode($result, JSON_PRETTY_PRINT) . '
'; + $result->getOrder(); + echo '
order.amount = ' . $result->getOrder()->getAmount() . '
order.total_discount_amount = ' . $result->getOrder()->getTotalDiscountAmount() + . '
order.total_amount = ' . $result->getOrder()->getTotalAmount() . '
'; +} catch (Exception $e) { + echo 'Exception when calling StackableDiscountsApi->redeemStackedDiscounts: ', $e->getMessage(), PHP_EOL; +} + +//create redemptionsApi +$redemptionsApiInstance = new OpenAPI\Client\Api\RedemptionsApi( + new GuzzleHttp\Client(), + $config +); + +//listRedemptions +try { + $result = $redemptionsApiInstance->listRedemptions(1, 1); + echo '
listRedemptions
' . json_encode($result, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling RedemptionsApi->listRedemptions: ', $e->getMessage(), PHP_EOL; +} + + +//deleteCampaign - DISCOUNT_COUPONS +try { + $result = $campaignsApiInstance->deleteCampaign($created_discount_campaign->getId(), true); + echo '
deleteCampaign - DISCOUNT_COUPONS
' . json_encode($result, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->listCampaigns: ', $e->getMessage(), PHP_EOL; +} + +//deleteCampaign - PROMOTION +try { + $result = $campaignsApiInstance->deleteCampaign($created_promotion_campaign->getId(), true); + echo '
deleteCampaign - PROMOTION
' . json_encode($result, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->listCampaigns: ', $e->getMessage(), PHP_EOL; +} + +//deleteCustomer +try { + $result = $customersApiInstance->deleteCustomer($created_customer->getId()); + echo '
deleteCustomer
' . json_encode($result, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->createCustomer: ', $e->getMessage(), PHP_EOL; +} + +//deleteProduct +try { + $productsApiInstance->deleteProduct($created_product->getId(), true); + echo '
deleteProduct
' . json_encode($result, JSON_PRETTY_PRINT) . '
'; +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->deleteProduct: ', $e->getMessage(), PHP_EOL; +} diff --git a/docs/Model/BusValRuleAssignment.md b/docs/Model/BusValRuleAssignment.md index 3179bb4..2b9508f 100644 --- a/docs/Model/BusValRuleAssignment.md +++ b/docs/Model/BusValRuleAssignment.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **created_at** | **\DateTime** | Timestamp representing the date and time when the object was created in ISO 8601 format. | [optional] **updated_at** | **\DateTime** | Timestamp representing the date and time when the object was last updated in ISO 8601 format. | [optional] **object** | **string** | The type of object represented by JSON. | [default to 'validation_rules_assignment'] -**validation_status** | **string** | The validation status of the assignment | -**validation_omitted_rules** | **string[]** | The list of omitted rules | +**validation_status** | **string** | The validation status of the assignment | [optional] +**validation_omitted_rules** | **string[]** | The list of omitted rules | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientQualificationsCheckEligibilityRequestBody.md b/docs/Model/ClientQualificationsCheckEligibilityRequestBody.md index 27169da..d2cb847 100644 --- a/docs/Model/ClientQualificationsCheckEligibilityRequestBody.md +++ b/docs/Model/ClientQualificationsCheckEligibilityRequestBody.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **mode** | **string** | Defines which resources Voucherify will use. The `ADVANCED` mode is available after purchase only. | [optional] **tracking_id** | **string** | Is correspondent to Customer's source_id | [optional] **scenario** | **string** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] -**options** | [**\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBodyOptions**](ClientQualificationsCheckEligibilityRequestBodyOptions.md) | | [optional] +**options** | [**\OpenAPI\Client\Model\QualificationsOption**](QualificationsOption.md) | | [optional] **metadata** | **object** | A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerActivityDataOrderItemsItem.md b/docs/Model/CustomerActivityDataOrderItemsItem.md index 85a6727..6afd2da 100644 --- a/docs/Model/CustomerActivityDataOrderItemsItem.md +++ b/docs/Model/CustomerActivityDataOrderItemsItem.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **initial_quantity** | **int** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] **amount** | **int** | The total amount of the order item (price * quantity). | [optional] **discount_amount** | **int** | Sum of all order-item-level discounts applied to the order. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] **initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] **total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] **price** | **int** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] @@ -21,6 +22,5 @@ Name | Type | Description | Notes **sku** | [**\OpenAPI\Client\Model\CustomerActivityDataOrderItemsItemSku**](CustomerActivityDataOrderItemsItemSku.md) | | [optional] **object** | **string** | | [optional] [default to 'order_item'] **metadata** | **object** | | [optional] -**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerActivityDataRedemptionOrderItemsItem.md b/docs/Model/CustomerActivityDataRedemptionOrderItemsItem.md index 73c8b31..15062d2 100644 --- a/docs/Model/CustomerActivityDataRedemptionOrderItemsItem.md +++ b/docs/Model/CustomerActivityDataRedemptionOrderItemsItem.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **initial_quantity** | **int** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] **amount** | **int** | The total amount of the order item (price * quantity). | [optional] **discount_amount** | **int** | Sum of all order-item-level discounts applied to the order. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] **initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] **total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] **price** | **int** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] @@ -21,6 +22,5 @@ Name | Type | Description | Notes **sku** | [**\OpenAPI\Client\Model\CustomerActivityDataRedemptionOrderItemsItemSku**](CustomerActivityDataRedemptionOrderItemsItemSku.md) | | [optional] **object** | **string** | | [optional] [default to 'order_item'] **metadata** | **object** | | [optional] -**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderCalculated.md b/docs/Model/OrderCalculated.md index 76580c7..58e0d66 100644 --- a/docs/Model/OrderCalculated.md +++ b/docs/Model/OrderCalculated.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] **source_id** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | **created_at** | **\DateTime** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] **updated_at** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] diff --git a/docs/Model/OrderCalculatedBase.md b/docs/Model/OrderCalculatedBase.md index 4be494b..7194464 100644 --- a/docs/Model/OrderCalculatedBase.md +++ b/docs/Model/OrderCalculatedBase.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] **source_id** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | **created_at** | **\DateTime** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] **updated_at** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] diff --git a/docs/Model/OrderCalculatedNoCustomerData.md b/docs/Model/OrderCalculatedNoCustomerData.md index 1304e69..c905b9f 100644 --- a/docs/Model/OrderCalculatedNoCustomerData.md +++ b/docs/Model/OrderCalculatedNoCustomerData.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] **source_id** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | **created_at** | **\DateTime** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] **updated_at** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] diff --git a/docs/Model/OrderItemCalculated.md b/docs/Model/OrderItemCalculated.md index 5ac4e41..ceeb24f 100644 --- a/docs/Model/OrderItemCalculated.md +++ b/docs/Model/OrderItemCalculated.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **initial_quantity** | **int** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] **amount** | **int** | The total amount of the order item (price * quantity). | [optional] **discount_amount** | **int** | Sum of all order-item-level discounts applied to the order. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] **initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] **total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] **price** | **int** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] diff --git a/docs/Model/OrdersCreateResponseBody.md b/docs/Model/OrdersCreateResponseBody.md index 9e7af81..11a667d 100644 --- a/docs/Model/OrdersCreateResponseBody.md +++ b/docs/Model/OrdersCreateResponseBody.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] **source_id** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | **created_at** | **\DateTime** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] **updated_at** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] diff --git a/docs/Model/OrdersGetResponseBody.md b/docs/Model/OrdersGetResponseBody.md index 7cca4dd..a0aff43 100644 --- a/docs/Model/OrdersGetResponseBody.md +++ b/docs/Model/OrdersGetResponseBody.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] **source_id** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | **created_at** | **\DateTime** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] **updated_at** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] diff --git a/docs/Model/OrdersUpdateResponseBody.md b/docs/Model/OrdersUpdateResponseBody.md index b4bdde7..44b19ee 100644 --- a/docs/Model/OrdersUpdateResponseBody.md +++ b/docs/Model/OrdersUpdateResponseBody.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] **source_id** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | **created_at** | **\DateTime** | Timestamp representing the date and time when the order was created in ISO 8601 format. | [optional] **updated_at** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] diff --git a/docs/Model/QualificationsCheckEligibilityRequestBody.md b/docs/Model/QualificationsCheckEligibilityRequestBody.md index e937c4d..cf58bfa 100644 --- a/docs/Model/QualificationsCheckEligibilityRequestBody.md +++ b/docs/Model/QualificationsCheckEligibilityRequestBody.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **mode** | **string** | Defines which resources Voucherify will use. The `ADVANCED` mode is available after purchase only. | [optional] **tracking_id** | **string** | Is correspondent to Customer's source_id | [optional] **scenario** | **string** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] -**options** | [**\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBodyOptions**](ClientQualificationsCheckEligibilityRequestBodyOptions.md) | | [optional] +**options** | [**\OpenAPI\Client\Model\QualificationsOption**](QualificationsOption.md) | | [optional] **metadata** | **object** | A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/QualificationsOption.md b/docs/Model/QualificationsOption.md new file mode 100644 index 0000000..1a8d63f --- /dev/null +++ b/docs/Model/QualificationsOption.md @@ -0,0 +1,13 @@ +# # QualificationsOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**limit** | **int** | The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5 | [optional] +**starting_after** | **\DateTime** | Cursor used for paging. | [optional] +**filters** | [**\OpenAPI\Client\Model\QualificationsOptionFilters**](QualificationsOptionFilters.md) | | [optional] +**expand** | **string[]** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"redeemable\"] | - Returns the redeemables' metadata. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [\"validation_rules\"] | - Returns an expanded `validation_rules` object, showing details about the validation rules. | | [optional] +**sorting_rule** | **string** | Is used to determine the order in which data is displayed in the result array. - `DEFAULT` - Sorting descending by `created_at` - `BEST_DEAL` - Sorting descending by `total_applied_discount_amount` - `LEAST_DEAL` - Sorting ascending by `total_applied_discount_amount` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/QualificationsOptionFilters.md b/docs/Model/QualificationsOptionFilters.md new file mode 100644 index 0000000..ac0abd3 --- /dev/null +++ b/docs/Model/QualificationsOptionFilters.md @@ -0,0 +1,15 @@ +# # QualificationsOptionFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**category_id** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**campaign_id** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**resource_id** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**resource_type** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**voucher_type** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**code** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Model/BusValRuleAssignment.php b/src/Model/BusValRuleAssignment.php index 50c4296..5562ce9 100644 --- a/src/Model/BusValRuleAssignment.php +++ b/src/Model/BusValRuleAssignment.php @@ -386,9 +386,6 @@ public function listInvalidProperties() ); } - if ($this->container['validation_status'] === null) { - $invalidProperties[] = "'validation_status' can't be null"; - } $allowedValues = $this->getValidationStatusAllowableValues(); if (!is_null($this->container['validation_status']) && !in_array($this->container['validation_status'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -398,9 +395,6 @@ public function listInvalidProperties() ); } - if ($this->container['validation_omitted_rules'] === null) { - $invalidProperties[] = "'validation_omitted_rules' can't be null"; - } return $invalidProperties; } @@ -618,7 +612,7 @@ public function setObject($object) /** * Gets validation_status * - * @return string + * @return string|null */ public function getValidationStatus() { @@ -628,7 +622,7 @@ public function getValidationStatus() /** * Sets validation_status * - * @param string $validation_status The validation status of the assignment + * @param string|null $validation_status The validation status of the assignment * * @return self */ @@ -655,7 +649,7 @@ public function setValidationStatus($validation_status) /** * Gets validation_omitted_rules * - * @return string[] + * @return string[]|null */ public function getValidationOmittedRules() { @@ -665,7 +659,7 @@ public function getValidationOmittedRules() /** * Sets validation_omitted_rules * - * @param string[] $validation_omitted_rules The list of omitted rules + * @param string[]|null $validation_omitted_rules The list of omitted rules * * @return self */ diff --git a/src/Model/ClientQualificationsCheckEligibilityRequestBody.php b/src/Model/ClientQualificationsCheckEligibilityRequestBody.php index e4bca32..08d3213 100644 --- a/src/Model/ClientQualificationsCheckEligibilityRequestBody.php +++ b/src/Model/ClientQualificationsCheckEligibilityRequestBody.php @@ -64,7 +64,7 @@ class ClientQualificationsCheckEligibilityRequestBody implements ModelInterface, 'mode' => 'string', 'tracking_id' => 'string', 'scenario' => 'string', - 'options' => '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBodyOptions', + 'options' => '\OpenAPI\Client\Model\QualificationsOption', 'metadata' => 'object' ]; @@ -551,7 +551,7 @@ public function setScenario($scenario) /** * Gets options * - * @return \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBodyOptions|null + * @return \OpenAPI\Client\Model\QualificationsOption|null */ public function getOptions() { @@ -561,7 +561,7 @@ public function getOptions() /** * Sets options * - * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBodyOptions|null $options options + * @param \OpenAPI\Client\Model\QualificationsOption|null $options options * * @return self */ diff --git a/src/Model/CustomerActivityDataOrderItemsItem.php b/src/Model/CustomerActivityDataOrderItemsItem.php index c53f0d6..4d39d60 100644 --- a/src/Model/CustomerActivityDataOrderItemsItem.php +++ b/src/Model/CustomerActivityDataOrderItemsItem.php @@ -67,6 +67,7 @@ class CustomerActivityDataOrderItemsItem implements ModelInterface, ArrayAccess, 'initial_quantity' => 'int', 'amount' => 'int', 'discount_amount' => 'int', + 'applied_discount_amount' => 'int', 'initial_amount' => 'int', 'total_applied_discount_amount' => 'int', 'price' => 'int', @@ -74,8 +75,7 @@ class CustomerActivityDataOrderItemsItem implements ModelInterface, ArrayAccess, 'product' => '\OpenAPI\Client\Model\CustomerActivityDataOrderItemsItemProduct', 'sku' => '\OpenAPI\Client\Model\CustomerActivityDataOrderItemsItemSku', 'object' => 'string', - 'metadata' => 'object', - 'applied_discount_amount' => 'int' + 'metadata' => 'object' ]; /** @@ -95,6 +95,7 @@ class CustomerActivityDataOrderItemsItem implements ModelInterface, ArrayAccess, 'initial_quantity' => null, 'amount' => null, 'discount_amount' => null, + 'applied_discount_amount' => null, 'initial_amount' => null, 'total_applied_discount_amount' => null, 'price' => null, @@ -102,8 +103,7 @@ class CustomerActivityDataOrderItemsItem implements ModelInterface, ArrayAccess, 'product' => null, 'sku' => null, 'object' => null, - 'metadata' => null, - 'applied_discount_amount' => null + 'metadata' => null ]; /** @@ -121,6 +121,7 @@ class CustomerActivityDataOrderItemsItem implements ModelInterface, ArrayAccess, 'initial_quantity' => false, 'amount' => false, 'discount_amount' => false, + 'applied_discount_amount' => false, 'initial_amount' => false, 'total_applied_discount_amount' => false, 'price' => false, @@ -128,8 +129,7 @@ class CustomerActivityDataOrderItemsItem implements ModelInterface, ArrayAccess, 'product' => false, 'sku' => false, 'object' => false, - 'metadata' => false, - 'applied_discount_amount' => false + 'metadata' => false ]; /** @@ -227,6 +227,7 @@ public function isNullableSetToNull(string $property): bool 'initial_quantity' => 'initial_quantity', 'amount' => 'amount', 'discount_amount' => 'discount_amount', + 'applied_discount_amount' => 'applied_discount_amount', 'initial_amount' => 'initial_amount', 'total_applied_discount_amount' => 'total_applied_discount_amount', 'price' => 'price', @@ -234,8 +235,7 @@ public function isNullableSetToNull(string $property): bool 'product' => 'product', 'sku' => 'sku', 'object' => 'object', - 'metadata' => 'metadata', - 'applied_discount_amount' => 'applied_discount_amount' + 'metadata' => 'metadata' ]; /** @@ -253,6 +253,7 @@ public function isNullableSetToNull(string $property): bool 'initial_quantity' => 'setInitialQuantity', 'amount' => 'setAmount', 'discount_amount' => 'setDiscountAmount', + 'applied_discount_amount' => 'setAppliedDiscountAmount', 'initial_amount' => 'setInitialAmount', 'total_applied_discount_amount' => 'setTotalAppliedDiscountAmount', 'price' => 'setPrice', @@ -260,8 +261,7 @@ public function isNullableSetToNull(string $property): bool 'product' => 'setProduct', 'sku' => 'setSku', 'object' => 'setObject', - 'metadata' => 'setMetadata', - 'applied_discount_amount' => 'setAppliedDiscountAmount' + 'metadata' => 'setMetadata' ]; /** @@ -279,6 +279,7 @@ public function isNullableSetToNull(string $property): bool 'initial_quantity' => 'getInitialQuantity', 'amount' => 'getAmount', 'discount_amount' => 'getDiscountAmount', + 'applied_discount_amount' => 'getAppliedDiscountAmount', 'initial_amount' => 'getInitialAmount', 'total_applied_discount_amount' => 'getTotalAppliedDiscountAmount', 'price' => 'getPrice', @@ -286,8 +287,7 @@ public function isNullableSetToNull(string $property): bool 'product' => 'getProduct', 'sku' => 'getSku', 'object' => 'getObject', - 'metadata' => 'getMetadata', - 'applied_discount_amount' => 'getAppliedDiscountAmount' + 'metadata' => 'getMetadata' ]; /** @@ -384,6 +384,7 @@ public function __construct(array $data = null) $this->setIfExists('initial_quantity', $data ?? [], null); $this->setIfExists('amount', $data ?? [], null); $this->setIfExists('discount_amount', $data ?? [], null); + $this->setIfExists('applied_discount_amount', $data ?? [], null); $this->setIfExists('initial_amount', $data ?? [], null); $this->setIfExists('total_applied_discount_amount', $data ?? [], null); $this->setIfExists('price', $data ?? [], null); @@ -392,7 +393,6 @@ public function __construct(array $data = null) $this->setIfExists('sku', $data ?? [], null); $this->setIfExists('object', $data ?? [], 'order_item'); $this->setIfExists('metadata', $data ?? [], null); - $this->setIfExists('applied_discount_amount', $data ?? [], null); } /** @@ -708,6 +708,33 @@ public function setDiscountAmount($discount_amount) return $this; } + /** + * Gets applied_discount_amount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['applied_discount_amount']; + } + + /** + * Sets applied_discount_amount + * + * @param int|null $applied_discount_amount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($applied_discount_amount) + { + if (is_null($applied_discount_amount)) { + throw new \InvalidArgumentException('non-nullable applied_discount_amount cannot be null'); + } + $this->container['applied_discount_amount'] = $applied_discount_amount; + + return $this; + } + /** * Gets initial_amount * @@ -933,33 +960,6 @@ public function setMetadata($metadata) return $this; } - - /** - * Gets applied_discount_amount - * - * @return int|null - */ - public function getAppliedDiscountAmount() - { - return $this->container['applied_discount_amount']; - } - - /** - * Sets applied_discount_amount - * - * @param int|null $applied_discount_amount This field shows the order-level discount applied. - * - * @return self - */ - public function setAppliedDiscountAmount($applied_discount_amount) - { - if (is_null($applied_discount_amount)) { - throw new \InvalidArgumentException('non-nullable applied_discount_amount cannot be null'); - } - $this->container['applied_discount_amount'] = $applied_discount_amount; - - return $this; - } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Model/CustomerActivityDataRedemptionOrderItemsItem.php b/src/Model/CustomerActivityDataRedemptionOrderItemsItem.php index cf5cbfd..0b5450e 100644 --- a/src/Model/CustomerActivityDataRedemptionOrderItemsItem.php +++ b/src/Model/CustomerActivityDataRedemptionOrderItemsItem.php @@ -67,6 +67,7 @@ class CustomerActivityDataRedemptionOrderItemsItem implements ModelInterface, Ar 'initial_quantity' => 'int', 'amount' => 'int', 'discount_amount' => 'int', + 'applied_discount_amount' => 'int', 'initial_amount' => 'int', 'total_applied_discount_amount' => 'int', 'price' => 'int', @@ -74,8 +75,7 @@ class CustomerActivityDataRedemptionOrderItemsItem implements ModelInterface, Ar 'product' => '\OpenAPI\Client\Model\CustomerActivityDataRedemptionOrderItemsItemProduct', 'sku' => '\OpenAPI\Client\Model\CustomerActivityDataRedemptionOrderItemsItemSku', 'object' => 'string', - 'metadata' => 'object', - 'applied_discount_amount' => 'int' + 'metadata' => 'object' ]; /** @@ -95,6 +95,7 @@ class CustomerActivityDataRedemptionOrderItemsItem implements ModelInterface, Ar 'initial_quantity' => null, 'amount' => null, 'discount_amount' => null, + 'applied_discount_amount' => null, 'initial_amount' => null, 'total_applied_discount_amount' => null, 'price' => null, @@ -102,8 +103,7 @@ class CustomerActivityDataRedemptionOrderItemsItem implements ModelInterface, Ar 'product' => null, 'sku' => null, 'object' => null, - 'metadata' => null, - 'applied_discount_amount' => null + 'metadata' => null ]; /** @@ -121,6 +121,7 @@ class CustomerActivityDataRedemptionOrderItemsItem implements ModelInterface, Ar 'initial_quantity' => false, 'amount' => false, 'discount_amount' => false, + 'applied_discount_amount' => false, 'initial_amount' => false, 'total_applied_discount_amount' => false, 'price' => false, @@ -128,8 +129,7 @@ class CustomerActivityDataRedemptionOrderItemsItem implements ModelInterface, Ar 'product' => false, 'sku' => false, 'object' => false, - 'metadata' => false, - 'applied_discount_amount' => false + 'metadata' => false ]; /** @@ -227,6 +227,7 @@ public function isNullableSetToNull(string $property): bool 'initial_quantity' => 'initial_quantity', 'amount' => 'amount', 'discount_amount' => 'discount_amount', + 'applied_discount_amount' => 'applied_discount_amount', 'initial_amount' => 'initial_amount', 'total_applied_discount_amount' => 'total_applied_discount_amount', 'price' => 'price', @@ -234,8 +235,7 @@ public function isNullableSetToNull(string $property): bool 'product' => 'product', 'sku' => 'sku', 'object' => 'object', - 'metadata' => 'metadata', - 'applied_discount_amount' => 'applied_discount_amount' + 'metadata' => 'metadata' ]; /** @@ -253,6 +253,7 @@ public function isNullableSetToNull(string $property): bool 'initial_quantity' => 'setInitialQuantity', 'amount' => 'setAmount', 'discount_amount' => 'setDiscountAmount', + 'applied_discount_amount' => 'setAppliedDiscountAmount', 'initial_amount' => 'setInitialAmount', 'total_applied_discount_amount' => 'setTotalAppliedDiscountAmount', 'price' => 'setPrice', @@ -260,8 +261,7 @@ public function isNullableSetToNull(string $property): bool 'product' => 'setProduct', 'sku' => 'setSku', 'object' => 'setObject', - 'metadata' => 'setMetadata', - 'applied_discount_amount' => 'setAppliedDiscountAmount' + 'metadata' => 'setMetadata' ]; /** @@ -279,6 +279,7 @@ public function isNullableSetToNull(string $property): bool 'initial_quantity' => 'getInitialQuantity', 'amount' => 'getAmount', 'discount_amount' => 'getDiscountAmount', + 'applied_discount_amount' => 'getAppliedDiscountAmount', 'initial_amount' => 'getInitialAmount', 'total_applied_discount_amount' => 'getTotalAppliedDiscountAmount', 'price' => 'getPrice', @@ -286,8 +287,7 @@ public function isNullableSetToNull(string $property): bool 'product' => 'getProduct', 'sku' => 'getSku', 'object' => 'getObject', - 'metadata' => 'getMetadata', - 'applied_discount_amount' => 'getAppliedDiscountAmount' + 'metadata' => 'getMetadata' ]; /** @@ -384,6 +384,7 @@ public function __construct(array $data = null) $this->setIfExists('initial_quantity', $data ?? [], null); $this->setIfExists('amount', $data ?? [], null); $this->setIfExists('discount_amount', $data ?? [], null); + $this->setIfExists('applied_discount_amount', $data ?? [], null); $this->setIfExists('initial_amount', $data ?? [], null); $this->setIfExists('total_applied_discount_amount', $data ?? [], null); $this->setIfExists('price', $data ?? [], null); @@ -392,7 +393,6 @@ public function __construct(array $data = null) $this->setIfExists('sku', $data ?? [], null); $this->setIfExists('object', $data ?? [], 'order_item'); $this->setIfExists('metadata', $data ?? [], null); - $this->setIfExists('applied_discount_amount', $data ?? [], null); } /** @@ -708,6 +708,33 @@ public function setDiscountAmount($discount_amount) return $this; } + /** + * Gets applied_discount_amount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['applied_discount_amount']; + } + + /** + * Sets applied_discount_amount + * + * @param int|null $applied_discount_amount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($applied_discount_amount) + { + if (is_null($applied_discount_amount)) { + throw new \InvalidArgumentException('non-nullable applied_discount_amount cannot be null'); + } + $this->container['applied_discount_amount'] = $applied_discount_amount; + + return $this; + } + /** * Gets initial_amount * @@ -933,33 +960,6 @@ public function setMetadata($metadata) return $this; } - - /** - * Gets applied_discount_amount - * - * @return int|null - */ - public function getAppliedDiscountAmount() - { - return $this->container['applied_discount_amount']; - } - - /** - * Sets applied_discount_amount - * - * @param int|null $applied_discount_amount This field shows the order-level discount applied. - * - * @return self - */ - public function setAppliedDiscountAmount($applied_discount_amount) - { - if (is_null($applied_discount_amount)) { - throw new \InvalidArgumentException('non-nullable applied_discount_amount cannot be null'); - } - $this->container['applied_discount_amount'] = $applied_discount_amount; - - return $this; - } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Model/OrderCalculated.php b/src/Model/OrderCalculated.php index b6ef93c..00a4f3b 100644 --- a/src/Model/OrderCalculated.php +++ b/src/Model/OrderCalculated.php @@ -454,9 +454,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } if ($this->container['source_id'] === null) { $invalidProperties[] = "'source_id' can't be null"; } @@ -505,7 +502,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -515,7 +512,7 @@ public function getId() /** * Sets id * - * @param string $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. * * @return self */ diff --git a/src/Model/OrderCalculatedBase.php b/src/Model/OrderCalculatedBase.php index deb77ff..3e65003 100644 --- a/src/Model/OrderCalculatedBase.php +++ b/src/Model/OrderCalculatedBase.php @@ -441,9 +441,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } if ($this->container['source_id'] === null) { $invalidProperties[] = "'source_id' can't be null"; } @@ -492,7 +489,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -502,7 +499,7 @@ public function getId() /** * Sets id * - * @param string $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. * * @return self */ diff --git a/src/Model/OrderCalculatedNoCustomerData.php b/src/Model/OrderCalculatedNoCustomerData.php index 03f1bb7..8a6b28b 100644 --- a/src/Model/OrderCalculatedNoCustomerData.php +++ b/src/Model/OrderCalculatedNoCustomerData.php @@ -454,9 +454,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } if ($this->container['source_id'] === null) { $invalidProperties[] = "'source_id' can't be null"; } @@ -505,7 +502,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -515,7 +512,7 @@ public function getId() /** * Sets id * - * @param string $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. * * @return self */ diff --git a/src/Model/OrderItemCalculated.php b/src/Model/OrderItemCalculated.php index c577390..67c7592 100644 --- a/src/Model/OrderItemCalculated.php +++ b/src/Model/OrderItemCalculated.php @@ -67,6 +67,7 @@ class OrderItemCalculated implements ModelInterface, ArrayAccess, \JsonSerializa 'initial_quantity' => 'int', 'amount' => 'int', 'discount_amount' => 'int', + 'applied_discount_amount' => 'int', 'initial_amount' => 'int', 'total_applied_discount_amount' => 'int', 'price' => 'int', @@ -94,6 +95,7 @@ class OrderItemCalculated implements ModelInterface, ArrayAccess, \JsonSerializa 'initial_quantity' => null, 'amount' => null, 'discount_amount' => null, + 'applied_discount_amount' => null, 'initial_amount' => null, 'total_applied_discount_amount' => null, 'price' => null, @@ -119,6 +121,7 @@ class OrderItemCalculated implements ModelInterface, ArrayAccess, \JsonSerializa 'initial_quantity' => false, 'amount' => false, 'discount_amount' => false, + 'applied_discount_amount' => false, 'initial_amount' => false, 'total_applied_discount_amount' => false, 'price' => false, @@ -224,6 +227,7 @@ public function isNullableSetToNull(string $property): bool 'initial_quantity' => 'initial_quantity', 'amount' => 'amount', 'discount_amount' => 'discount_amount', + 'applied_discount_amount' => 'applied_discount_amount', 'initial_amount' => 'initial_amount', 'total_applied_discount_amount' => 'total_applied_discount_amount', 'price' => 'price', @@ -249,6 +253,7 @@ public function isNullableSetToNull(string $property): bool 'initial_quantity' => 'setInitialQuantity', 'amount' => 'setAmount', 'discount_amount' => 'setDiscountAmount', + 'applied_discount_amount' => 'setAppliedDiscountAmount', 'initial_amount' => 'setInitialAmount', 'total_applied_discount_amount' => 'setTotalAppliedDiscountAmount', 'price' => 'setPrice', @@ -274,6 +279,7 @@ public function isNullableSetToNull(string $property): bool 'initial_quantity' => 'getInitialQuantity', 'amount' => 'getAmount', 'discount_amount' => 'getDiscountAmount', + 'applied_discount_amount' => 'getAppliedDiscountAmount', 'initial_amount' => 'getInitialAmount', 'total_applied_discount_amount' => 'getTotalAppliedDiscountAmount', 'price' => 'getPrice', @@ -378,6 +384,7 @@ public function __construct(array $data = null) $this->setIfExists('initial_quantity', $data ?? [], null); $this->setIfExists('amount', $data ?? [], null); $this->setIfExists('discount_amount', $data ?? [], null); + $this->setIfExists('applied_discount_amount', $data ?? [], null); $this->setIfExists('initial_amount', $data ?? [], null); $this->setIfExists('total_applied_discount_amount', $data ?? [], null); $this->setIfExists('price', $data ?? [], null); @@ -704,6 +711,33 @@ public function setDiscountAmount($discount_amount) return $this; } + /** + * Gets applied_discount_amount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['applied_discount_amount']; + } + + /** + * Sets applied_discount_amount + * + * @param int|null $applied_discount_amount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($applied_discount_amount) + { + if (is_null($applied_discount_amount)) { + throw new \InvalidArgumentException('non-nullable applied_discount_amount cannot be null'); + } + $this->container['applied_discount_amount'] = $applied_discount_amount; + + return $this; + } + /** * Gets initial_amount * diff --git a/src/Model/OrdersCreateResponseBody.php b/src/Model/OrdersCreateResponseBody.php index f3ae3dc..a088b6f 100644 --- a/src/Model/OrdersCreateResponseBody.php +++ b/src/Model/OrdersCreateResponseBody.php @@ -455,9 +455,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } if ($this->container['source_id'] === null) { $invalidProperties[] = "'source_id' can't be null"; } @@ -506,7 +503,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -516,7 +513,7 @@ public function getId() /** * Sets id * - * @param string $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. * * @return self */ diff --git a/src/Model/OrdersGetResponseBody.php b/src/Model/OrdersGetResponseBody.php index 2411f90..bf815dc 100644 --- a/src/Model/OrdersGetResponseBody.php +++ b/src/Model/OrdersGetResponseBody.php @@ -455,9 +455,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } if ($this->container['source_id'] === null) { $invalidProperties[] = "'source_id' can't be null"; } @@ -506,7 +503,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -516,7 +513,7 @@ public function getId() /** * Sets id * - * @param string $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. * * @return self */ diff --git a/src/Model/OrdersUpdateResponseBody.php b/src/Model/OrdersUpdateResponseBody.php index 7ee14e3..a0a01db 100644 --- a/src/Model/OrdersUpdateResponseBody.php +++ b/src/Model/OrdersUpdateResponseBody.php @@ -455,9 +455,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } if ($this->container['source_id'] === null) { $invalidProperties[] = "'source_id' can't be null"; } @@ -506,7 +503,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -516,7 +513,7 @@ public function getId() /** * Sets id * - * @param string $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. * * @return self */ diff --git a/src/Model/QualificationsCheckEligibilityRequestBody.php b/src/Model/QualificationsCheckEligibilityRequestBody.php index 49a441e..d2d9bfe 100644 --- a/src/Model/QualificationsCheckEligibilityRequestBody.php +++ b/src/Model/QualificationsCheckEligibilityRequestBody.php @@ -64,7 +64,7 @@ class QualificationsCheckEligibilityRequestBody implements ModelInterface, Array 'mode' => 'string', 'tracking_id' => 'string', 'scenario' => 'string', - 'options' => '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBodyOptions', + 'options' => '\OpenAPI\Client\Model\QualificationsOption', 'metadata' => 'object' ]; @@ -551,7 +551,7 @@ public function setScenario($scenario) /** * Gets options * - * @return \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBodyOptions|null + * @return \OpenAPI\Client\Model\QualificationsOption|null */ public function getOptions() { @@ -561,7 +561,7 @@ public function getOptions() /** * Sets options * - * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBodyOptions|null $options options + * @param \OpenAPI\Client\Model\QualificationsOption|null $options options * * @return self */ diff --git a/src/Model/QualificationsOption.php b/src/Model/QualificationsOption.php new file mode 100644 index 0000000..f858b62 --- /dev/null +++ b/src/Model/QualificationsOption.php @@ -0,0 +1,625 @@ + + */ +class QualificationsOption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'limit' => 'int', + 'starting_after' => '\DateTime', + 'filters' => '\OpenAPI\Client\Model\QualificationsOptionFilters', + 'expand' => 'string[]', + 'sorting_rule' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'limit' => null, + 'starting_after' => 'date-time', + 'filters' => null, + 'expand' => null, + 'sorting_rule' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'limit' => false, + 'starting_after' => true, + 'filters' => false, + 'expand' => false, + 'sorting_rule' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'limit' => 'limit', + 'starting_after' => 'starting_after', + 'filters' => 'filters', + 'expand' => 'expand', + 'sorting_rule' => 'sorting_rule' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'limit' => 'setLimit', + 'starting_after' => 'setStartingAfter', + 'filters' => 'setFilters', + 'expand' => 'setExpand', + 'sorting_rule' => 'setSortingRule' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'limit' => 'getLimit', + 'starting_after' => 'getStartingAfter', + 'filters' => 'getFilters', + 'expand' => 'getExpand', + 'sorting_rule' => 'getSortingRule' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const EXPAND_REDEEMABLE = 'redeemable'; + public const EXPAND_CATEGORY = 'category'; + public const EXPAND_VALIDATION_RULES = 'validation_rules'; + public const SORTING_RULE_BEST_DEAL = 'BEST_DEAL'; + public const SORTING_RULE_LEAST_DEAL = 'LEAST_DEAL'; + public const SORTING_RULE__DEFAULT = 'DEFAULT'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExpandAllowableValues() + { + return [ + self::EXPAND_REDEEMABLE, + self::EXPAND_CATEGORY, + self::EXPAND_VALIDATION_RULES, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSortingRuleAllowableValues() + { + return [ + self::SORTING_RULE_BEST_DEAL, + self::SORTING_RULE_LEAST_DEAL, + self::SORTING_RULE__DEFAULT, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('starting_after', $data ?? [], null); + $this->setIfExists('filters', $data ?? [], null); + $this->setIfExists('expand', $data ?? [], null); + $this->setIfExists('sorting_rule', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['limit']) && ($this->container['limit'] > 100)) { + $invalidProperties[] = "invalid value for 'limit', must be smaller than or equal to 100."; + } + + $allowedValues = $this->getSortingRuleAllowableValues(); + if (!is_null($this->container['sorting_rule']) && !in_array($this->container['sorting_rule'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'sorting_rule', must be one of '%s'", + $this->container['sorting_rule'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets limit + * + * @return int|null + */ + public function getLimit() + { + return $this->container['limit']; + } + + /** + * Sets limit + * + * @param int|null $limit The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5 + * + * @return self + */ + public function setLimit($limit) + { + if (is_null($limit)) { + throw new \InvalidArgumentException('non-nullable limit cannot be null'); + } + + if (($limit > 100)) { + throw new \InvalidArgumentException('invalid value for $limit when calling QualificationsOption., must be smaller than or equal to 100.'); + } + + $this->container['limit'] = $limit; + + return $this; + } + + /** + * Gets starting_after + * + * @return \DateTime|null + */ + public function getStartingAfter() + { + return $this->container['starting_after']; + } + + /** + * Sets starting_after + * + * @param \DateTime|null $starting_after Cursor used for paging. + * + * @return self + */ + public function setStartingAfter($starting_after) + { + if (is_null($starting_after)) { + array_push($this->openAPINullablesSetToNull, 'starting_after'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('starting_after', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['starting_after'] = $starting_after; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\QualificationsOptionFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\QualificationsOptionFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets expand + * + * @return string[]|null + */ + public function getExpand() + { + return $this->container['expand']; + } + + /** + * Sets expand + * + * @param string[]|null $expand The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"redeemable\"] | - Returns the redeemables' metadata. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [\"validation_rules\"] | - Returns an expanded `validation_rules` object, showing details about the validation rules. | + * + * @return self + */ + public function setExpand($expand) + { + if (is_null($expand)) { + throw new \InvalidArgumentException('non-nullable expand cannot be null'); + } + $allowedValues = $this->getExpandAllowableValues(); + if (array_diff($expand, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'expand', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['expand'] = $expand; + + return $this; + } + + /** + * Gets sorting_rule + * + * @return string|null + */ + public function getSortingRule() + { + return $this->container['sorting_rule']; + } + + /** + * Sets sorting_rule + * + * @param string|null $sorting_rule Is used to determine the order in which data is displayed in the result array. - `DEFAULT` - Sorting descending by `created_at` - `BEST_DEAL` - Sorting descending by `total_applied_discount_amount` - `LEAST_DEAL` - Sorting ascending by `total_applied_discount_amount` + * + * @return self + */ + public function setSortingRule($sorting_rule) + { + if (is_null($sorting_rule)) { + throw new \InvalidArgumentException('non-nullable sorting_rule cannot be null'); + } + $allowedValues = $this->getSortingRuleAllowableValues(); + if (!in_array($sorting_rule, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'sorting_rule', must be one of '%s'", + $sorting_rule, + implode("', '", $allowedValues) + ) + ); + } + $this->container['sorting_rule'] = $sorting_rule; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/QualificationsOptionFilters.php b/src/Model/QualificationsOptionFilters.php new file mode 100644 index 0000000..d7f0d2f --- /dev/null +++ b/src/Model/QualificationsOptionFilters.php @@ -0,0 +1,649 @@ + + */ +class QualificationsOptionFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOption_filters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'category_id' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'campaign_id' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'resource_id' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'resource_type' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'voucher_type' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'code' => '\OpenAPI\Client\Model\QualificationsFieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'category_id' => null, + 'campaign_id' => null, + 'resource_id' => null, + 'resource_type' => null, + 'voucher_type' => null, + 'code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => false, + 'category_id' => false, + 'campaign_id' => false, + 'resource_id' => false, + 'resource_type' => false, + 'voucher_type' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'junction' => 'junction', + 'category_id' => 'category_id', + 'campaign_id' => 'campaign_id', + 'resource_id' => 'resource_id', + 'resource_type' => 'resource_type', + 'voucher_type' => 'voucher_type', + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'category_id' => 'setCategoryId', + 'campaign_id' => 'setCampaignId', + 'resource_id' => 'setResourceId', + 'resource_type' => 'setResourceType', + 'voucher_type' => 'setVoucherType', + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'category_id' => 'getCategoryId', + 'campaign_id' => 'getCampaignId', + 'resource_id' => 'getResourceId', + 'resource_type' => 'getResourceType', + 'voucher_type' => 'getVoucherType', + 'code' => 'getCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('junction', $data ?? [], null); + $this->setIfExists('category_id', $data ?? [], null); + $this->setIfExists('campaign_id', $data ?? [], null); + $this->setIfExists('resource_id', $data ?? [], null); + $this->setIfExists('resource_type', $data ?? [], null); + $this->setIfExists('voucher_type', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + throw new \InvalidArgumentException('non-nullable junction cannot be null'); + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets category_id + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getCategoryId() + { + return $this->container['category_id']; + } + + /** + * Sets category_id + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $category_id category_id + * + * @return self + */ + public function setCategoryId($category_id) + { + if (is_null($category_id)) { + throw new \InvalidArgumentException('non-nullable category_id cannot be null'); + } + $this->container['category_id'] = $category_id; + + return $this; + } + + /** + * Gets campaign_id + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getCampaignId() + { + return $this->container['campaign_id']; + } + + /** + * Sets campaign_id + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $campaign_id campaign_id + * + * @return self + */ + public function setCampaignId($campaign_id) + { + if (is_null($campaign_id)) { + throw new \InvalidArgumentException('non-nullable campaign_id cannot be null'); + } + $this->container['campaign_id'] = $campaign_id; + + return $this; + } + + /** + * Gets resource_id + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getResourceId() + { + return $this->container['resource_id']; + } + + /** + * Sets resource_id + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $resource_id resource_id + * + * @return self + */ + public function setResourceId($resource_id) + { + if (is_null($resource_id)) { + throw new \InvalidArgumentException('non-nullable resource_id cannot be null'); + } + $this->container['resource_id'] = $resource_id; + + return $this; + } + + /** + * Gets resource_type + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getResourceType() + { + return $this->container['resource_type']; + } + + /** + * Sets resource_type + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $resource_type resource_type + * + * @return self + */ + public function setResourceType($resource_type) + { + if (is_null($resource_type)) { + throw new \InvalidArgumentException('non-nullable resource_type cannot be null'); + } + $this->container['resource_type'] = $resource_type; + + return $this; + } + + /** + * Gets voucher_type + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getVoucherType() + { + return $this->container['voucher_type']; + } + + /** + * Sets voucher_type + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $voucher_type voucher_type + * + * @return self + */ + public function setVoucherType($voucher_type) + { + if (is_null($voucher_type)) { + throw new \InvalidArgumentException('non-nullable voucher_type cannot be null'); + } + $this->container['voucher_type'] = $voucher_type; + + return $this; + } + + /** + * Gets code + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $code code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + +