diff --git a/README.md b/README.md index d3dd8d5..1de8fa8 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add this dependency to your project's POM: com.postfinancecheckout postfinancecheckout-java-sdk - 3.0.1 + 3.0.2 compile ``` @@ -33,7 +33,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "com.postfinancecheckout:postfinancecheckout-java-sdk:3.0.1" +compile "com.postfinancecheckout:postfinancecheckout-java-sdk:3.0.2" ``` ### Others @@ -46,7 +46,7 @@ mvn clean package Then manually install the following JARs: -* `target/postfinancecheckout-java-sdk-3.0.1.jar` +* `target/postfinancecheckout-java-sdk-3.0.2.jar` * `target/lib/*.jar` ## Usage diff --git a/build.gradle b/build.gradle index bf96d7c..d8f7b29 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'idea' apply plugin: 'eclipse' group = 'com.postfinancecheckout' -version = '3.0.1' +version = '3.0.2' buildscript { repositories { diff --git a/build.sbt b/build.sbt index c0fc5a9..50200fa 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.postfinancecheckout", name := "postfinancecheckout-java-sdk", - version := "3.0.1", + version := "3.0.2", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), diff --git a/pom.xml b/pom.xml index 33f1c15..9042b66 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ postfinancecheckout-java-sdk jar postfinancecheckout-java-sdk - 3.0.1 + 3.0.2 https://www.postfinance.ch/checkout The SDK for simplifying the integration with PostFinance Checkout API. diff --git a/src/main/java/com/postfinancecheckout/sdk/ApiClient.java b/src/main/java/com/postfinancecheckout/sdk/ApiClient.java index 4521b2f..267e5f9 100644 --- a/src/main/java/com/postfinancecheckout/sdk/ApiClient.java +++ b/src/main/java/com/postfinancecheckout/sdk/ApiClient.java @@ -397,6 +397,22 @@ public PaymentProcessorService getPaymentProcessorService() { return this.paymentProcessorService; } + private PaymentTerminalService paymentTerminalService; + public PaymentTerminalService getPaymentTerminalService() { + if (this.paymentTerminalService == null) { + this.paymentTerminalService = new PaymentTerminalService(this); + } + return this.paymentTerminalService; + } + + private PaymentTerminalTillService paymentTerminalTillService; + public PaymentTerminalTillService getPaymentTerminalTillService() { + if (this.paymentTerminalTillService == null) { + this.paymentTerminalTillService = new PaymentTerminalTillService(this); + } + return this.paymentTerminalTillService; + } + private PermissionService permissionService; public PermissionService getPermissionService() { if (this.permissionService == null) { @@ -437,6 +453,54 @@ public RefundService getRefundService() { return this.refundService; } + private ShopifyRecurringOrderService shopifyRecurringOrderService; + public ShopifyRecurringOrderService getShopifyRecurringOrderService() { + if (this.shopifyRecurringOrderService == null) { + this.shopifyRecurringOrderService = new ShopifyRecurringOrderService(this); + } + return this.shopifyRecurringOrderService; + } + + private ShopifySubscriberService shopifySubscriberService; + public ShopifySubscriberService getShopifySubscriberService() { + if (this.shopifySubscriberService == null) { + this.shopifySubscriberService = new ShopifySubscriberService(this); + } + return this.shopifySubscriberService; + } + + private ShopifySubscriptionProductService shopifySubscriptionProductService; + public ShopifySubscriptionProductService getShopifySubscriptionProductService() { + if (this.shopifySubscriptionProductService == null) { + this.shopifySubscriptionProductService = new ShopifySubscriptionProductService(this); + } + return this.shopifySubscriptionProductService; + } + + private ShopifySubscriptionService shopifySubscriptionService; + public ShopifySubscriptionService getShopifySubscriptionService() { + if (this.shopifySubscriptionService == null) { + this.shopifySubscriptionService = new ShopifySubscriptionService(this); + } + return this.shopifySubscriptionService; + } + + private ShopifySubscriptionSuspensionService shopifySubscriptionSuspensionService; + public ShopifySubscriptionSuspensionService getShopifySubscriptionSuspensionService() { + if (this.shopifySubscriptionSuspensionService == null) { + this.shopifySubscriptionSuspensionService = new ShopifySubscriptionSuspensionService(this); + } + return this.shopifySubscriptionSuspensionService; + } + + private ShopifySubscriptionVersionService shopifySubscriptionVersionService; + public ShopifySubscriptionVersionService getShopifySubscriptionVersionService() { + if (this.shopifySubscriptionVersionService == null) { + this.shopifySubscriptionVersionService = new ShopifySubscriptionVersionService(this); + } + return this.shopifySubscriptionVersionService; + } + private ShopifyTransactionService shopifyTransactionService; public ShopifyTransactionService getShopifyTransactionService() { if (this.shopifyTransactionService == null) { @@ -549,6 +613,14 @@ public TransactionService getTransactionService() { return this.transactionService; } + private TransactionTerminalService transactionTerminalService; + public TransactionTerminalService getTransactionTerminalService() { + if (this.transactionTerminalService == null) { + this.transactionTerminalService = new TransactionTerminalService(this); + } + return this.transactionTerminalService; + } + private TransactionVoidService transactionVoidService; public TransactionVoidService getTransactionVoidService() { if (this.transactionVoidService == null) { diff --git a/src/main/java/com/postfinancecheckout/sdk/model/AbstractShopifySubscriptionProductUpdate.java b/src/main/java/com/postfinancecheckout/sdk/model/AbstractShopifySubscriptionProductUpdate.java new file mode 100644 index 0000000..97f80ff --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/AbstractShopifySubscriptionProductUpdate.java @@ -0,0 +1,432 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionBillingIntervalUnit; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionProductPricingOption; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionWeekday; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * AbstractShopifySubscriptionProductUpdate + */ + +public class AbstractShopifySubscriptionProductUpdate { + + @JsonProperty("absolutePriceAdjustment") + protected BigDecimal absolutePriceAdjustment = null; + + + @JsonProperty("billingDayOfMonth") + protected Integer billingDayOfMonth = null; + + + @JsonProperty("billingIntervalAmount") + protected Integer billingIntervalAmount = null; + + + @JsonProperty("billingIntervalUnit") + protected ShopifySubscriptionBillingIntervalUnit billingIntervalUnit = null; + + + @JsonProperty("billingWeekday") + protected ShopifySubscriptionWeekday billingWeekday = null; + + + @JsonProperty("fixedPrice") + protected BigDecimal fixedPrice = null; + + + @JsonProperty("maximalBillingCycles") + protected Integer maximalBillingCycles = null; + + + @JsonProperty("maximalSuspendableCycles") + protected Integer maximalSuspendableCycles = null; + + + @JsonProperty("minimalBillingCycles") + protected Integer minimalBillingCycles = null; + + + @JsonProperty("pricingOption") + protected ShopifySubscriptionProductPricingOption pricingOption = null; + + + @JsonProperty("relativePriceAdjustment") + protected BigDecimal relativePriceAdjustment = null; + + + @JsonProperty("storeOrderConfirmationEmailEnabled") + protected Boolean storeOrderConfirmationEmailEnabled = null; + + + @JsonProperty("subscriberSuspensionAllowed") + protected Boolean subscriberSuspensionAllowed = null; + + + @JsonProperty("terminationBillingCycles") + protected Integer terminationBillingCycles = null; + + + + public AbstractShopifySubscriptionProductUpdate absolutePriceAdjustment(BigDecimal absolutePriceAdjustment) { + this.absolutePriceAdjustment = absolutePriceAdjustment; + return this; + } + + /** + * + * @return absolutePriceAdjustment + **/ + @ApiModelProperty(value = "") + public BigDecimal getAbsolutePriceAdjustment() { + return absolutePriceAdjustment; + } + + public void setAbsolutePriceAdjustment(BigDecimal absolutePriceAdjustment) { + this.absolutePriceAdjustment = absolutePriceAdjustment; + } + + + public AbstractShopifySubscriptionProductUpdate billingDayOfMonth(Integer billingDayOfMonth) { + this.billingDayOfMonth = billingDayOfMonth; + return this; + } + + /** + * Define the day of the month on which the recurring orders should be created. + * @return billingDayOfMonth + **/ + @ApiModelProperty(value = "Define the day of the month on which the recurring orders should be created.") + public Integer getBillingDayOfMonth() { + return billingDayOfMonth; + } + + public void setBillingDayOfMonth(Integer billingDayOfMonth) { + this.billingDayOfMonth = billingDayOfMonth; + } + + + public AbstractShopifySubscriptionProductUpdate billingIntervalAmount(Integer billingIntervalAmount) { + this.billingIntervalAmount = billingIntervalAmount; + return this; + } + + /** + * + * @return billingIntervalAmount + **/ + @ApiModelProperty(value = "") + public Integer getBillingIntervalAmount() { + return billingIntervalAmount; + } + + public void setBillingIntervalAmount(Integer billingIntervalAmount) { + this.billingIntervalAmount = billingIntervalAmount; + } + + + public AbstractShopifySubscriptionProductUpdate billingIntervalUnit(ShopifySubscriptionBillingIntervalUnit billingIntervalUnit) { + this.billingIntervalUnit = billingIntervalUnit; + return this; + } + + /** + * Define how frequently recurring orders should be created. + * @return billingIntervalUnit + **/ + @ApiModelProperty(value = "Define how frequently recurring orders should be created.") + public ShopifySubscriptionBillingIntervalUnit getBillingIntervalUnit() { + return billingIntervalUnit; + } + + public void setBillingIntervalUnit(ShopifySubscriptionBillingIntervalUnit billingIntervalUnit) { + this.billingIntervalUnit = billingIntervalUnit; + } + + + public AbstractShopifySubscriptionProductUpdate billingWeekday(ShopifySubscriptionWeekday billingWeekday) { + this.billingWeekday = billingWeekday; + return this; + } + + /** + * Define the weekday on which the recurring orders should be created. + * @return billingWeekday + **/ + @ApiModelProperty(value = "Define the weekday on which the recurring orders should be created.") + public ShopifySubscriptionWeekday getBillingWeekday() { + return billingWeekday; + } + + public void setBillingWeekday(ShopifySubscriptionWeekday billingWeekday) { + this.billingWeekday = billingWeekday; + } + + + public AbstractShopifySubscriptionProductUpdate fixedPrice(BigDecimal fixedPrice) { + this.fixedPrice = fixedPrice; + return this; + } + + /** + * + * @return fixedPrice + **/ + @ApiModelProperty(value = "") + public BigDecimal getFixedPrice() { + return fixedPrice; + } + + public void setFixedPrice(BigDecimal fixedPrice) { + this.fixedPrice = fixedPrice; + } + + + public AbstractShopifySubscriptionProductUpdate maximalBillingCycles(Integer maximalBillingCycles) { + this.maximalBillingCycles = maximalBillingCycles; + return this; + } + + /** + * Define the maximum number of orders the subscription will run for. + * @return maximalBillingCycles + **/ + @ApiModelProperty(value = "Define the maximum number of orders the subscription will run for.") + public Integer getMaximalBillingCycles() { + return maximalBillingCycles; + } + + public void setMaximalBillingCycles(Integer maximalBillingCycles) { + this.maximalBillingCycles = maximalBillingCycles; + } + + + public AbstractShopifySubscriptionProductUpdate maximalSuspendableCycles(Integer maximalSuspendableCycles) { + this.maximalSuspendableCycles = maximalSuspendableCycles; + return this; + } + + /** + * Define the maximum number of orders the subscription can be suspended for at a time. + * @return maximalSuspendableCycles + **/ + @ApiModelProperty(value = "Define the maximum number of orders the subscription can be suspended for at a time.") + public Integer getMaximalSuspendableCycles() { + return maximalSuspendableCycles; + } + + public void setMaximalSuspendableCycles(Integer maximalSuspendableCycles) { + this.maximalSuspendableCycles = maximalSuspendableCycles; + } + + + public AbstractShopifySubscriptionProductUpdate minimalBillingCycles(Integer minimalBillingCycles) { + this.minimalBillingCycles = minimalBillingCycles; + return this; + } + + /** + * Define the minimal number of orders the subscription will run for. + * @return minimalBillingCycles + **/ + @ApiModelProperty(value = "Define the minimal number of orders the subscription will run for.") + public Integer getMinimalBillingCycles() { + return minimalBillingCycles; + } + + public void setMinimalBillingCycles(Integer minimalBillingCycles) { + this.minimalBillingCycles = minimalBillingCycles; + } + + + public AbstractShopifySubscriptionProductUpdate pricingOption(ShopifySubscriptionProductPricingOption pricingOption) { + this.pricingOption = pricingOption; + return this; + } + + /** + * + * @return pricingOption + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionProductPricingOption getPricingOption() { + return pricingOption; + } + + public void setPricingOption(ShopifySubscriptionProductPricingOption pricingOption) { + this.pricingOption = pricingOption; + } + + + public AbstractShopifySubscriptionProductUpdate relativePriceAdjustment(BigDecimal relativePriceAdjustment) { + this.relativePriceAdjustment = relativePriceAdjustment; + return this; + } + + /** + * + * @return relativePriceAdjustment + **/ + @ApiModelProperty(value = "") + public BigDecimal getRelativePriceAdjustment() { + return relativePriceAdjustment; + } + + public void setRelativePriceAdjustment(BigDecimal relativePriceAdjustment) { + this.relativePriceAdjustment = relativePriceAdjustment; + } + + + public AbstractShopifySubscriptionProductUpdate storeOrderConfirmationEmailEnabled(Boolean storeOrderConfirmationEmailEnabled) { + this.storeOrderConfirmationEmailEnabled = storeOrderConfirmationEmailEnabled; + return this; + } + + /** + * Define whether the order confirmation email of the Shopify shop is sent to the customer for recurring orders. + * @return storeOrderConfirmationEmailEnabled + **/ + @ApiModelProperty(value = "Define whether the order confirmation email of the Shopify shop is sent to the customer for recurring orders.") + public Boolean isStoreOrderConfirmationEmailEnabled() { + return storeOrderConfirmationEmailEnabled; + } + + public void setStoreOrderConfirmationEmailEnabled(Boolean storeOrderConfirmationEmailEnabled) { + this.storeOrderConfirmationEmailEnabled = storeOrderConfirmationEmailEnabled; + } + + + public AbstractShopifySubscriptionProductUpdate subscriberSuspensionAllowed(Boolean subscriberSuspensionAllowed) { + this.subscriberSuspensionAllowed = subscriberSuspensionAllowed; + return this; + } + + /** + * Define whether the customer is allowed to suspend subscriptions. + * @return subscriberSuspensionAllowed + **/ + @ApiModelProperty(value = "Define whether the customer is allowed to suspend subscriptions.") + public Boolean isSubscriberSuspensionAllowed() { + return subscriberSuspensionAllowed; + } + + public void setSubscriberSuspensionAllowed(Boolean subscriberSuspensionAllowed) { + this.subscriberSuspensionAllowed = subscriberSuspensionAllowed; + } + + + public AbstractShopifySubscriptionProductUpdate terminationBillingCycles(Integer terminationBillingCycles) { + this.terminationBillingCycles = terminationBillingCycles; + return this; + } + + /** + * Define the number of orders the subscription will keep running for after its termination has been requested. + * @return terminationBillingCycles + **/ + @ApiModelProperty(value = "Define the number of orders the subscription will keep running for after its termination has been requested.") + public Integer getTerminationBillingCycles() { + return terminationBillingCycles; + } + + public void setTerminationBillingCycles(Integer terminationBillingCycles) { + this.terminationBillingCycles = terminationBillingCycles; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractShopifySubscriptionProductUpdate abstractShopifySubscriptionProductUpdate = (AbstractShopifySubscriptionProductUpdate) o; + return Objects.equals(this.absolutePriceAdjustment, abstractShopifySubscriptionProductUpdate.absolutePriceAdjustment) && + Objects.equals(this.billingDayOfMonth, abstractShopifySubscriptionProductUpdate.billingDayOfMonth) && + Objects.equals(this.billingIntervalAmount, abstractShopifySubscriptionProductUpdate.billingIntervalAmount) && + Objects.equals(this.billingIntervalUnit, abstractShopifySubscriptionProductUpdate.billingIntervalUnit) && + Objects.equals(this.billingWeekday, abstractShopifySubscriptionProductUpdate.billingWeekday) && + Objects.equals(this.fixedPrice, abstractShopifySubscriptionProductUpdate.fixedPrice) && + Objects.equals(this.maximalBillingCycles, abstractShopifySubscriptionProductUpdate.maximalBillingCycles) && + Objects.equals(this.maximalSuspendableCycles, abstractShopifySubscriptionProductUpdate.maximalSuspendableCycles) && + Objects.equals(this.minimalBillingCycles, abstractShopifySubscriptionProductUpdate.minimalBillingCycles) && + Objects.equals(this.pricingOption, abstractShopifySubscriptionProductUpdate.pricingOption) && + Objects.equals(this.relativePriceAdjustment, abstractShopifySubscriptionProductUpdate.relativePriceAdjustment) && + Objects.equals(this.storeOrderConfirmationEmailEnabled, abstractShopifySubscriptionProductUpdate.storeOrderConfirmationEmailEnabled) && + Objects.equals(this.subscriberSuspensionAllowed, abstractShopifySubscriptionProductUpdate.subscriberSuspensionAllowed) && + Objects.equals(this.terminationBillingCycles, abstractShopifySubscriptionProductUpdate.terminationBillingCycles); + } + + @Override + public int hashCode() { + return Objects.hash(absolutePriceAdjustment, billingDayOfMonth, billingIntervalAmount, billingIntervalUnit, billingWeekday, fixedPrice, maximalBillingCycles, maximalSuspendableCycles, minimalBillingCycles, pricingOption, relativePriceAdjustment, storeOrderConfirmationEmailEnabled, subscriberSuspensionAllowed, terminationBillingCycles); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractShopifySubscriptionProductUpdate {\n"); + + sb.append(" absolutePriceAdjustment: ").append(toIndentedString(absolutePriceAdjustment)).append("\n"); + sb.append(" billingDayOfMonth: ").append(toIndentedString(billingDayOfMonth)).append("\n"); + sb.append(" billingIntervalAmount: ").append(toIndentedString(billingIntervalAmount)).append("\n"); + sb.append(" billingIntervalUnit: ").append(toIndentedString(billingIntervalUnit)).append("\n"); + sb.append(" billingWeekday: ").append(toIndentedString(billingWeekday)).append("\n"); + sb.append(" fixedPrice: ").append(toIndentedString(fixedPrice)).append("\n"); + sb.append(" maximalBillingCycles: ").append(toIndentedString(maximalBillingCycles)).append("\n"); + sb.append(" maximalSuspendableCycles: ").append(toIndentedString(maximalSuspendableCycles)).append("\n"); + sb.append(" minimalBillingCycles: ").append(toIndentedString(minimalBillingCycles)).append("\n"); + sb.append(" pricingOption: ").append(toIndentedString(pricingOption)).append("\n"); + sb.append(" relativePriceAdjustment: ").append(toIndentedString(relativePriceAdjustment)).append("\n"); + sb.append(" storeOrderConfirmationEmailEnabled: ").append(toIndentedString(storeOrderConfirmationEmailEnabled)).append("\n"); + sb.append(" subscriberSuspensionAllowed: ").append(toIndentedString(subscriberSuspensionAllowed)).append("\n"); + sb.append(" terminationBillingCycles: ").append(toIndentedString(terminationBillingCycles)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/PaymentTerminalReceiptType.java b/src/main/java/com/postfinancecheckout/sdk/model/PaymentTerminalReceiptType.java new file mode 100644 index 0000000..1d199b3 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/PaymentTerminalReceiptType.java @@ -0,0 +1,130 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class PaymentTerminalReceiptType { + + @JsonProperty("description") + protected Map description = null; + + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("name") + protected Map name = null; + + + + /** + * + * @return description + **/ + @ApiModelProperty(value = "") + public Map getDescription() { + return description; + } + + + /** + * The ID is the primary key of the entity. The ID identifies the entity uniquely. + * @return id + **/ + @ApiModelProperty(value = "The ID is the primary key of the entity. The ID identifies the entity uniquely.") + public Long getId() { + return id; + } + + + /** + * + * @return name + **/ + @ApiModelProperty(value = "") + public Map getName() { + return name; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentTerminalReceiptType paymentTerminalReceiptType = (PaymentTerminalReceiptType) o; + return Objects.equals(this.description, paymentTerminalReceiptType.description) && + Objects.equals(this.id, paymentTerminalReceiptType.id) && + Objects.equals(this.name, paymentTerminalReceiptType.name); + } + + @Override + public int hashCode() { + return Objects.hash(description, id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentTerminalReceiptType {\n"); + + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/RenderedTerminalReceipt.java b/src/main/java/com/postfinancecheckout/sdk/model/RenderedTerminalReceipt.java new file mode 100644 index 0000000..c0f8660 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/RenderedTerminalReceipt.java @@ -0,0 +1,153 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.PaymentTerminalReceiptType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class RenderedTerminalReceipt { + + @JsonProperty("data") + protected byte[] data = null; + + + @JsonProperty("mimeType") + protected String mimeType = null; + + + @JsonProperty("printed") + protected Boolean printed = null; + + + @JsonProperty("receiptType") + protected PaymentTerminalReceiptType receiptType = null; + + + + public RenderedTerminalReceipt data(byte[] data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @ApiModelProperty(value = "") + public byte[] getData() { + return data; + } + + public void setData(byte[] data) { + this.data = data; + } + + + /** + * The mime type indicates the format of the receipt document. The mime type depends on the requested receipt format. + * @return mimeType + **/ + @ApiModelProperty(value = "The mime type indicates the format of the receipt document. The mime type depends on the requested receipt format.") + public String getMimeType() { + return mimeType; + } + + + /** + * The terminal might or might not print the receipt. This property is set to true when the configuration of the terminal forces the printing and the device supports the receipt printing. + * @return printed + **/ + @ApiModelProperty(value = "The terminal might or might not print the receipt. This property is set to true when the configuration of the terminal forces the printing and the device supports the receipt printing.") + public Boolean isPrinted() { + return printed; + } + + + /** + * Each receipt has a different usage. The receipt type indicates for what resp. for whom the document is for. + * @return receiptType + **/ + @ApiModelProperty(value = "Each receipt has a different usage. The receipt type indicates for what resp. for whom the document is for.") + public PaymentTerminalReceiptType getReceiptType() { + return receiptType; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenderedTerminalReceipt renderedTerminalReceipt = (RenderedTerminalReceipt) o; + return Arrays.equals(this.data, renderedTerminalReceipt.data) && + Objects.equals(this.mimeType, renderedTerminalReceipt.mimeType) && + Objects.equals(this.printed, renderedTerminalReceipt.printed) && + Objects.equals(this.receiptType, renderedTerminalReceipt.receiptType); + } + + @Override + public int hashCode() { + return Objects.hash(Arrays.hashCode(data), mimeType, printed, receiptType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenderedTerminalReceipt {\n"); + + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" printed: ").append(toIndentedString(printed)).append("\n"); + sb.append(" receiptType: ").append(toIndentedString(receiptType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifyRecurringOrder.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifyRecurringOrder.java new file mode 100644 index 0000000..a4a7a83 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifyRecurringOrder.java @@ -0,0 +1,316 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.FailureReason; +import com.postfinancecheckout.sdk.model.ShopifyRecurringOrderState; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionVersion; +import com.postfinancecheckout.sdk.model.ShopifyTransaction; +import com.postfinancecheckout.sdk.model.TransactionAwareEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifyRecurringOrder extends TransactionAwareEntity { + + @JsonProperty("billedOn") + protected OffsetDateTime billedOn = null; + + + @JsonProperty("checkoutToken") + protected String checkoutToken = null; + + + @JsonProperty("createdOn") + protected OffsetDateTime createdOn = null; + + + @JsonProperty("failureReason") + protected FailureReason failureReason = null; + + + @JsonProperty("orderId") + protected String orderId = null; + + + @JsonProperty("orderName") + protected String orderName = null; + + + @JsonProperty("plannedExecutionDate") + protected OffsetDateTime plannedExecutionDate = null; + + + @JsonProperty("plannedPurgeDate") + protected OffsetDateTime plannedPurgeDate = null; + + + @JsonProperty("recurrenceNumber") + protected Integer recurrenceNumber = null; + + + @JsonProperty("shop") + protected Long shop = null; + + + @JsonProperty("startedProcessingOn") + protected OffsetDateTime startedProcessingOn = null; + + + @JsonProperty("state") + protected ShopifyRecurringOrderState state = null; + + + @JsonProperty("subscriptionVersion") + protected ShopifySubscriptionVersion subscriptionVersion = null; + + + @JsonProperty("transaction") + protected ShopifyTransaction transaction = null; + + + + /** + * + * @return billedOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getBilledOn() { + return billedOn; + } + + + /** + * + * @return checkoutToken + **/ + @ApiModelProperty(value = "") + public String getCheckoutToken() { + return checkoutToken; + } + + + /** + * + * @return createdOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getCreatedOn() { + return createdOn; + } + + + /** + * + * @return failureReason + **/ + @ApiModelProperty(value = "") + public FailureReason getFailureReason() { + return failureReason; + } + + + /** + * + * @return orderId + **/ + @ApiModelProperty(value = "") + public String getOrderId() { + return orderId; + } + + + /** + * + * @return orderName + **/ + @ApiModelProperty(value = "") + public String getOrderName() { + return orderName; + } + + + /** + * + * @return plannedExecutionDate + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getPlannedExecutionDate() { + return plannedExecutionDate; + } + + + /** + * The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed. + * @return plannedPurgeDate + **/ + @ApiModelProperty(value = "The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.") + public OffsetDateTime getPlannedPurgeDate() { + return plannedPurgeDate; + } + + + /** + * + * @return recurrenceNumber + **/ + @ApiModelProperty(value = "") + public Integer getRecurrenceNumber() { + return recurrenceNumber; + } + + + /** + * + * @return shop + **/ + @ApiModelProperty(value = "") + public Long getShop() { + return shop; + } + + + /** + * + * @return startedProcessingOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getStartedProcessingOn() { + return startedProcessingOn; + } + + + /** + * + * @return state + **/ + @ApiModelProperty(value = "") + public ShopifyRecurringOrderState getState() { + return state; + } + + + /** + * + * @return subscriptionVersion + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionVersion getSubscriptionVersion() { + return subscriptionVersion; + } + + + /** + * + * @return transaction + **/ + @ApiModelProperty(value = "") + public ShopifyTransaction getTransaction() { + return transaction; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifyRecurringOrder shopifyRecurringOrder = (ShopifyRecurringOrder) o; + return Objects.equals(this.id, shopifyRecurringOrder.id) && + Objects.equals(this.linkedSpaceId, shopifyRecurringOrder.linkedSpaceId) && + Objects.equals(this.linkedTransaction, shopifyRecurringOrder.linkedTransaction) && + Objects.equals(this.billedOn, shopifyRecurringOrder.billedOn) && + Objects.equals(this.checkoutToken, shopifyRecurringOrder.checkoutToken) && + Objects.equals(this.createdOn, shopifyRecurringOrder.createdOn) && + Objects.equals(this.failureReason, shopifyRecurringOrder.failureReason) && + Objects.equals(this.orderId, shopifyRecurringOrder.orderId) && + Objects.equals(this.orderName, shopifyRecurringOrder.orderName) && + Objects.equals(this.plannedExecutionDate, shopifyRecurringOrder.plannedExecutionDate) && + Objects.equals(this.plannedPurgeDate, shopifyRecurringOrder.plannedPurgeDate) && + Objects.equals(this.recurrenceNumber, shopifyRecurringOrder.recurrenceNumber) && + Objects.equals(this.shop, shopifyRecurringOrder.shop) && + Objects.equals(this.startedProcessingOn, shopifyRecurringOrder.startedProcessingOn) && + Objects.equals(this.state, shopifyRecurringOrder.state) && + Objects.equals(this.subscriptionVersion, shopifyRecurringOrder.subscriptionVersion) && + Objects.equals(this.transaction, shopifyRecurringOrder.transaction) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(id, linkedSpaceId, linkedTransaction, billedOn, checkoutToken, createdOn, failureReason, orderId, orderName, plannedExecutionDate, plannedPurgeDate, recurrenceNumber, shop, startedProcessingOn, state, subscriptionVersion, transaction, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifyRecurringOrder {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" linkedSpaceId: ").append(toIndentedString(linkedSpaceId)).append("\n"); + sb.append(" linkedTransaction: ").append(toIndentedString(linkedTransaction)).append("\n"); + sb.append(" billedOn: ").append(toIndentedString(billedOn)).append("\n"); + sb.append(" checkoutToken: ").append(toIndentedString(checkoutToken)).append("\n"); + sb.append(" createdOn: ").append(toIndentedString(createdOn)).append("\n"); + sb.append(" failureReason: ").append(toIndentedString(failureReason)).append("\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" orderName: ").append(toIndentedString(orderName)).append("\n"); + sb.append(" plannedExecutionDate: ").append(toIndentedString(plannedExecutionDate)).append("\n"); + sb.append(" plannedPurgeDate: ").append(toIndentedString(plannedPurgeDate)).append("\n"); + sb.append(" recurrenceNumber: ").append(toIndentedString(recurrenceNumber)).append("\n"); + sb.append(" shop: ").append(toIndentedString(shop)).append("\n"); + sb.append(" startedProcessingOn: ").append(toIndentedString(startedProcessingOn)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" subscriptionVersion: ").append(toIndentedString(subscriptionVersion)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifyRecurringOrderState.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifyRecurringOrderState.java new file mode 100644 index 0000000..5d4f5d7 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifyRecurringOrderState.java @@ -0,0 +1,74 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifyRecurringOrderState { + + PENDING("PENDING"), + + ONHOLD("ONHOLD"), + + PROCESSING("PROCESSING"), + + CANCELED("CANCELED"), + + BILLED("BILLED"), + + FAILED("FAILED"); + + private String value; + + ShopifyRecurringOrderState(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifyRecurringOrderState fromValue(String text) { + for (ShopifyRecurringOrderState b : ShopifyRecurringOrderState.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifyRecurringOrderUpdateRequest.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifyRecurringOrderUpdateRequest.java new file mode 100644 index 0000000..ce92e51 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifyRecurringOrderUpdateRequest.java @@ -0,0 +1,130 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifyRecurringOrderUpdateRequest { + + @JsonProperty("executionDate") + protected OffsetDateTime executionDate = null; + + + @JsonProperty("recurringOrderId") + protected Long recurringOrderId = null; + + + + public ShopifyRecurringOrderUpdateRequest executionDate(OffsetDateTime executionDate) { + this.executionDate = executionDate; + return this; + } + + /** + * + * @return executionDate + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getExecutionDate() { + return executionDate; + } + + public void setExecutionDate(OffsetDateTime executionDate) { + this.executionDate = executionDate; + } + + + public ShopifyRecurringOrderUpdateRequest recurringOrderId(Long recurringOrderId) { + this.recurringOrderId = recurringOrderId; + return this; + } + + /** + * + * @return recurringOrderId + **/ + @ApiModelProperty(value = "") + public Long getRecurringOrderId() { + return recurringOrderId; + } + + public void setRecurringOrderId(Long recurringOrderId) { + this.recurringOrderId = recurringOrderId; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifyRecurringOrderUpdateRequest shopifyRecurringOrderUpdateRequest = (ShopifyRecurringOrderUpdateRequest) o; + return Objects.equals(this.executionDate, shopifyRecurringOrderUpdateRequest.executionDate) && + Objects.equals(this.recurringOrderId, shopifyRecurringOrderUpdateRequest.recurringOrderId); + } + + @Override + public int hashCode() { + return Objects.hash(executionDate, recurringOrderId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifyRecurringOrderUpdateRequest {\n"); + + sb.append(" executionDate: ").append(toIndentedString(executionDate)).append("\n"); + sb.append(" recurringOrderId: ").append(toIndentedString(recurringOrderId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriber.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriber.java new file mode 100644 index 0000000..959a1d2 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriber.java @@ -0,0 +1,241 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriberState; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriber { + + @JsonProperty("createdOn") + protected OffsetDateTime createdOn = null; + + + @JsonProperty("emailAddress") + protected String emailAddress = null; + + + @JsonProperty("externalId") + protected String externalId = null; + + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("linkedSpaceId") + protected Long linkedSpaceId = null; + + + @JsonProperty("phoneNumber") + protected String phoneNumber = null; + + + @JsonProperty("plannedPurgeDate") + protected OffsetDateTime plannedPurgeDate = null; + + + @JsonProperty("shop") + protected Long shop = null; + + + @JsonProperty("state") + protected ShopifySubscriberState state = null; + + + @JsonProperty("version") + protected Integer version = null; + + + + /** + * + * @return createdOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getCreatedOn() { + return createdOn; + } + + + /** + * + * @return emailAddress + **/ + @ApiModelProperty(value = "") + public String getEmailAddress() { + return emailAddress; + } + + + /** + * A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead. + * @return externalId + **/ + @ApiModelProperty(value = "A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.") + public String getExternalId() { + return externalId; + } + + + /** + * The ID is the primary key of the entity. The ID identifies the entity uniquely. + * @return id + **/ + @ApiModelProperty(value = "The ID is the primary key of the entity. The ID identifies the entity uniquely.") + public Long getId() { + return id; + } + + + /** + * The linked space id holds the ID of the space to which the entity belongs to. + * @return linkedSpaceId + **/ + @ApiModelProperty(value = "The linked space id holds the ID of the space to which the entity belongs to.") + public Long getLinkedSpaceId() { + return linkedSpaceId; + } + + + /** + * + * @return phoneNumber + **/ + @ApiModelProperty(value = "") + public String getPhoneNumber() { + return phoneNumber; + } + + + /** + * The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed. + * @return plannedPurgeDate + **/ + @ApiModelProperty(value = "The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.") + public OffsetDateTime getPlannedPurgeDate() { + return plannedPurgeDate; + } + + + /** + * + * @return shop + **/ + @ApiModelProperty(value = "") + public Long getShop() { + return shop; + } + + + /** + * + * @return state + **/ + @ApiModelProperty(value = "") + public ShopifySubscriberState getState() { + return state; + } + + + /** + * The version number indicates the version of the entity. The version is incremented whenever the entity is changed. + * @return version + **/ + @ApiModelProperty(value = "The version number indicates the version of the entity. The version is incremented whenever the entity is changed.") + public Integer getVersion() { + return version; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriber shopifySubscriber = (ShopifySubscriber) o; + return Objects.equals(this.createdOn, shopifySubscriber.createdOn) && + Objects.equals(this.emailAddress, shopifySubscriber.emailAddress) && + Objects.equals(this.externalId, shopifySubscriber.externalId) && + Objects.equals(this.id, shopifySubscriber.id) && + Objects.equals(this.linkedSpaceId, shopifySubscriber.linkedSpaceId) && + Objects.equals(this.phoneNumber, shopifySubscriber.phoneNumber) && + Objects.equals(this.plannedPurgeDate, shopifySubscriber.plannedPurgeDate) && + Objects.equals(this.shop, shopifySubscriber.shop) && + Objects.equals(this.state, shopifySubscriber.state) && + Objects.equals(this.version, shopifySubscriber.version); + } + + @Override + public int hashCode() { + return Objects.hash(createdOn, emailAddress, externalId, id, linkedSpaceId, phoneNumber, plannedPurgeDate, shop, state, version); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriber {\n"); + + sb.append(" createdOn: ").append(toIndentedString(createdOn)).append("\n"); + sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" linkedSpaceId: ").append(toIndentedString(linkedSpaceId)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" plannedPurgeDate: ").append(toIndentedString(plannedPurgeDate)).append("\n"); + sb.append(" shop: ").append(toIndentedString(shop)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriberActive.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriberActive.java new file mode 100644 index 0000000..fbb4c22 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriberActive.java @@ -0,0 +1,204 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriberActive { + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("version") + protected Long version = null; + + + @JsonProperty("emailAddress") + protected String emailAddress = null; + + + @JsonProperty("externalId") + protected String externalId = null; + + + @JsonProperty("phoneNumber") + protected String phoneNumber = null; + + + + public ShopifySubscriberActive id(Long id) { + this.id = id; + return this; + } + + /** + * The ID is the primary key of the entity. The ID identifies the entity uniquely. + * @return id + **/ + @ApiModelProperty(required = true, value = "The ID is the primary key of the entity. The ID identifies the entity uniquely.") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + + public ShopifySubscriberActive version(Long version) { + this.version = version; + return this; + } + + /** + * The version number indicates the version of the entity. The version is incremented whenever the entity is changed. + * @return version + **/ + @ApiModelProperty(required = true, value = "The version number indicates the version of the entity. The version is incremented whenever the entity is changed.") + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + + public ShopifySubscriberActive emailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * + * @return emailAddress + **/ + @ApiModelProperty(value = "") + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + + public ShopifySubscriberActive externalId(String externalId) { + this.externalId = externalId; + return this; + } + + /** + * A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead. + * @return externalId + **/ + @ApiModelProperty(value = "A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.") + public String getExternalId() { + return externalId; + } + + public void setExternalId(String externalId) { + this.externalId = externalId; + } + + + public ShopifySubscriberActive phoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * + * @return phoneNumber + **/ + @ApiModelProperty(value = "") + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriberActive shopifySubscriberActive = (ShopifySubscriberActive) o; + return Objects.equals(this.id, shopifySubscriberActive.id) && + Objects.equals(this.version, shopifySubscriberActive.version) && + Objects.equals(this.emailAddress, shopifySubscriberActive.emailAddress) && + Objects.equals(this.externalId, shopifySubscriberActive.externalId) && + Objects.equals(this.phoneNumber, shopifySubscriberActive.phoneNumber); + } + + @Override + public int hashCode() { + return Objects.hash(id, version, emailAddress, externalId, phoneNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriberActive {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriberCreation.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriberCreation.java new file mode 100644 index 0000000..6ad586b --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriberCreation.java @@ -0,0 +1,154 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriberCreation { + + @JsonProperty("emailAddress") + protected String emailAddress = null; + + + @JsonProperty("phoneNumber") + protected String phoneNumber = null; + + + @JsonProperty("shopifyCustomerId") + protected String shopifyCustomerId = null; + + + + public ShopifySubscriberCreation emailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * + * @return emailAddress + **/ + @ApiModelProperty(value = "") + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + + public ShopifySubscriberCreation phoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * + * @return phoneNumber + **/ + @ApiModelProperty(value = "") + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public ShopifySubscriberCreation shopifyCustomerId(String shopifyCustomerId) { + this.shopifyCustomerId = shopifyCustomerId; + return this; + } + + /** + * The customer ID has to correspond to the ID assigned to the customer by Shopify. When the subscriber already exists no new subscriber will be created. + * @return shopifyCustomerId + **/ + @ApiModelProperty(required = true, value = "The customer ID has to correspond to the ID assigned to the customer by Shopify. When the subscriber already exists no new subscriber will be created.") + public String getShopifyCustomerId() { + return shopifyCustomerId; + } + + public void setShopifyCustomerId(String shopifyCustomerId) { + this.shopifyCustomerId = shopifyCustomerId; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriberCreation shopifySubscriberCreation = (ShopifySubscriberCreation) o; + return Objects.equals(this.emailAddress, shopifySubscriberCreation.emailAddress) && + Objects.equals(this.phoneNumber, shopifySubscriberCreation.phoneNumber) && + Objects.equals(this.shopifyCustomerId, shopifySubscriberCreation.shopifyCustomerId); + } + + @Override + public int hashCode() { + return Objects.hash(emailAddress, phoneNumber, shopifyCustomerId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriberCreation {\n"); + + sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" shopifyCustomerId: ").append(toIndentedString(shopifyCustomerId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriberState.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriberState.java new file mode 100644 index 0000000..897862c --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriberState.java @@ -0,0 +1,68 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriberState { + + ACTIVE("ACTIVE"), + + DELETING("DELETING"), + + DELETED("DELETED"); + + private String value; + + ShopifySubscriberState(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriberState fromValue(String text) { + for (ShopifySubscriberState b : ShopifySubscriberState.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscription.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscription.java new file mode 100644 index 0000000..80b1810 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscription.java @@ -0,0 +1,354 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriber; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionState; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscription { + + @JsonProperty("createdBy") + protected Long createdBy = null; + + + @JsonProperty("createdOn") + protected OffsetDateTime createdOn = null; + + + @JsonProperty("externalId") + protected String externalId = null; + + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("initialExecutionDate") + protected OffsetDateTime initialExecutionDate = null; + + + @JsonProperty("initialPaymentTransaction") + protected Long initialPaymentTransaction = null; + + + @JsonProperty("initialShopifyTransaction") + protected Long initialShopifyTransaction = null; + + + @JsonProperty("language") + protected String language = null; + + + @JsonProperty("linkedSpaceId") + protected Long linkedSpaceId = null; + + + @JsonProperty("orderRecurrenceNumber") + protected Integer orderRecurrenceNumber = null; + + + @JsonProperty("shop") + protected Long shop = null; + + + @JsonProperty("state") + protected ShopifySubscriptionState state = null; + + + @JsonProperty("subscriber") + protected ShopifySubscriber subscriber = null; + + + @JsonProperty("terminatedBy") + protected Long terminatedBy = null; + + + @JsonProperty("terminatedOn") + protected OffsetDateTime terminatedOn = null; + + + @JsonProperty("terminationRequestDate") + protected OffsetDateTime terminationRequestDate = null; + + + @JsonProperty("version") + protected Integer version = null; + + + + /** + * + * @return createdBy + **/ + @ApiModelProperty(value = "") + public Long getCreatedBy() { + return createdBy; + } + + + /** + * + * @return createdOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getCreatedOn() { + return createdOn; + } + + + /** + * The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity. + * @return externalId + **/ + @ApiModelProperty(value = "The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.") + public String getExternalId() { + return externalId; + } + + + /** + * The ID is the primary key of the entity. The ID identifies the entity uniquely. + * @return id + **/ + @ApiModelProperty(value = "The ID is the primary key of the entity. The ID identifies the entity uniquely.") + public Long getId() { + return id; + } + + + /** + * + * @return initialExecutionDate + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getInitialExecutionDate() { + return initialExecutionDate; + } + + + /** + * + * @return initialPaymentTransaction + **/ + @ApiModelProperty(value = "") + public Long getInitialPaymentTransaction() { + return initialPaymentTransaction; + } + + + /** + * + * @return initialShopifyTransaction + **/ + @ApiModelProperty(value = "") + public Long getInitialShopifyTransaction() { + return initialShopifyTransaction; + } + + + /** + * + * @return language + **/ + @ApiModelProperty(value = "") + public String getLanguage() { + return language; + } + + + /** + * The linked space id holds the ID of the space to which the entity belongs to. + * @return linkedSpaceId + **/ + @ApiModelProperty(value = "The linked space id holds the ID of the space to which the entity belongs to.") + public Long getLinkedSpaceId() { + return linkedSpaceId; + } + + + /** + * + * @return orderRecurrenceNumber + **/ + @ApiModelProperty(value = "") + public Integer getOrderRecurrenceNumber() { + return orderRecurrenceNumber; + } + + + /** + * + * @return shop + **/ + @ApiModelProperty(value = "") + public Long getShop() { + return shop; + } + + + /** + * + * @return state + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionState getState() { + return state; + } + + + /** + * + * @return subscriber + **/ + @ApiModelProperty(value = "") + public ShopifySubscriber getSubscriber() { + return subscriber; + } + + + /** + * + * @return terminatedBy + **/ + @ApiModelProperty(value = "") + public Long getTerminatedBy() { + return terminatedBy; + } + + + /** + * + * @return terminatedOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getTerminatedOn() { + return terminatedOn; + } + + + /** + * + * @return terminationRequestDate + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getTerminationRequestDate() { + return terminationRequestDate; + } + + + /** + * The version number indicates the version of the entity. The version is incremented whenever the entity is changed. + * @return version + **/ + @ApiModelProperty(value = "The version number indicates the version of the entity. The version is incremented whenever the entity is changed.") + public Integer getVersion() { + return version; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscription shopifySubscription = (ShopifySubscription) o; + return Objects.equals(this.createdBy, shopifySubscription.createdBy) && + Objects.equals(this.createdOn, shopifySubscription.createdOn) && + Objects.equals(this.externalId, shopifySubscription.externalId) && + Objects.equals(this.id, shopifySubscription.id) && + Objects.equals(this.initialExecutionDate, shopifySubscription.initialExecutionDate) && + Objects.equals(this.initialPaymentTransaction, shopifySubscription.initialPaymentTransaction) && + Objects.equals(this.initialShopifyTransaction, shopifySubscription.initialShopifyTransaction) && + Objects.equals(this.language, shopifySubscription.language) && + Objects.equals(this.linkedSpaceId, shopifySubscription.linkedSpaceId) && + Objects.equals(this.orderRecurrenceNumber, shopifySubscription.orderRecurrenceNumber) && + Objects.equals(this.shop, shopifySubscription.shop) && + Objects.equals(this.state, shopifySubscription.state) && + Objects.equals(this.subscriber, shopifySubscription.subscriber) && + Objects.equals(this.terminatedBy, shopifySubscription.terminatedBy) && + Objects.equals(this.terminatedOn, shopifySubscription.terminatedOn) && + Objects.equals(this.terminationRequestDate, shopifySubscription.terminationRequestDate) && + Objects.equals(this.version, shopifySubscription.version); + } + + @Override + public int hashCode() { + return Objects.hash(createdBy, createdOn, externalId, id, initialExecutionDate, initialPaymentTransaction, initialShopifyTransaction, language, linkedSpaceId, orderRecurrenceNumber, shop, state, subscriber, terminatedBy, terminatedOn, terminationRequestDate, version); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscription {\n"); + + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" createdOn: ").append(toIndentedString(createdOn)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" initialExecutionDate: ").append(toIndentedString(initialExecutionDate)).append("\n"); + sb.append(" initialPaymentTransaction: ").append(toIndentedString(initialPaymentTransaction)).append("\n"); + sb.append(" initialShopifyTransaction: ").append(toIndentedString(initialShopifyTransaction)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" linkedSpaceId: ").append(toIndentedString(linkedSpaceId)).append("\n"); + sb.append(" orderRecurrenceNumber: ").append(toIndentedString(orderRecurrenceNumber)).append("\n"); + sb.append(" shop: ").append(toIndentedString(shop)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" subscriber: ").append(toIndentedString(subscriber)).append("\n"); + sb.append(" terminatedBy: ").append(toIndentedString(terminatedBy)).append("\n"); + sb.append(" terminatedOn: ").append(toIndentedString(terminatedOn)).append("\n"); + sb.append(" terminationRequestDate: ").append(toIndentedString(terminationRequestDate)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionAddress.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionAddress.java new file mode 100644 index 0000000..2769da8 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionAddress.java @@ -0,0 +1,121 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.Address; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionAddress extends Address { + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionAddress shopifySubscriptionAddress = (ShopifySubscriptionAddress) o; + return Objects.equals(this.city, shopifySubscriptionAddress.city) && + Objects.equals(this.commercialRegisterNumber, shopifySubscriptionAddress.commercialRegisterNumber) && + Objects.equals(this.country, shopifySubscriptionAddress.country) && + Objects.equals(this.dateOfBirth, shopifySubscriptionAddress.dateOfBirth) && + Objects.equals(this.dependentLocality, shopifySubscriptionAddress.dependentLocality) && + Objects.equals(this.emailAddress, shopifySubscriptionAddress.emailAddress) && + Objects.equals(this.familyName, shopifySubscriptionAddress.familyName) && + Objects.equals(this.gender, shopifySubscriptionAddress.gender) && + Objects.equals(this.givenName, shopifySubscriptionAddress.givenName) && + Objects.equals(this.legalOrganizationForm, shopifySubscriptionAddress.legalOrganizationForm) && + Objects.equals(this.mobilePhoneNumber, shopifySubscriptionAddress.mobilePhoneNumber) && + Objects.equals(this.organizationName, shopifySubscriptionAddress.organizationName) && + Objects.equals(this.phoneNumber, shopifySubscriptionAddress.phoneNumber) && + Objects.equals(this.postalState, shopifySubscriptionAddress.postalState) && + Objects.equals(this.postcode, shopifySubscriptionAddress.postcode) && + Objects.equals(this.salesTaxNumber, shopifySubscriptionAddress.salesTaxNumber) && + Objects.equals(this.salutation, shopifySubscriptionAddress.salutation) && + Objects.equals(this.socialSecurityNumber, shopifySubscriptionAddress.socialSecurityNumber) && + Objects.equals(this.sortingCode, shopifySubscriptionAddress.sortingCode) && + Objects.equals(this.street, shopifySubscriptionAddress.street) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(city, commercialRegisterNumber, country, dateOfBirth, dependentLocality, emailAddress, familyName, gender, givenName, legalOrganizationForm, mobilePhoneNumber, organizationName, phoneNumber, postalState, postcode, salesTaxNumber, salutation, socialSecurityNumber, sortingCode, street, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionAddress {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" commercialRegisterNumber: ").append(toIndentedString(commercialRegisterNumber)).append("\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" dependentLocality: ").append(toIndentedString(dependentLocality)).append("\n"); + sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); + sb.append(" familyName: ").append(toIndentedString(familyName)).append("\n"); + sb.append(" gender: ").append(toIndentedString(gender)).append("\n"); + sb.append(" givenName: ").append(toIndentedString(givenName)).append("\n"); + sb.append(" legalOrganizationForm: ").append(toIndentedString(legalOrganizationForm)).append("\n"); + sb.append(" mobilePhoneNumber: ").append(toIndentedString(mobilePhoneNumber)).append("\n"); + sb.append(" organizationName: ").append(toIndentedString(organizationName)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" postalState: ").append(toIndentedString(postalState)).append("\n"); + sb.append(" postcode: ").append(toIndentedString(postcode)).append("\n"); + sb.append(" salesTaxNumber: ").append(toIndentedString(salesTaxNumber)).append("\n"); + sb.append(" salutation: ").append(toIndentedString(salutation)).append("\n"); + sb.append(" socialSecurityNumber: ").append(toIndentedString(socialSecurityNumber)).append("\n"); + sb.append(" sortingCode: ").append(toIndentedString(sortingCode)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionAddressCreate.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionAddressCreate.java new file mode 100644 index 0000000..3d1bac7 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionAddressCreate.java @@ -0,0 +1,581 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.Gender; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDate; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionAddressCreate { + + @JsonProperty("city") + protected String city = null; + + + @JsonProperty("commercialRegisterNumber") + protected String commercialRegisterNumber = null; + + + @JsonProperty("country") + protected String country = null; + + + @JsonProperty("dateOfBirth") + protected LocalDate dateOfBirth = null; + + + @JsonProperty("dependentLocality") + protected String dependentLocality = null; + + + @JsonProperty("emailAddress") + protected String emailAddress = null; + + + @JsonProperty("familyName") + protected String familyName = null; + + + @JsonProperty("gender") + protected Gender gender = null; + + + @JsonProperty("givenName") + protected String givenName = null; + + + @JsonProperty("legalOrganizationForm") + protected Long legalOrganizationForm = null; + + + @JsonProperty("mobilePhoneNumber") + protected String mobilePhoneNumber = null; + + + @JsonProperty("organizationName") + protected String organizationName = null; + + + @JsonProperty("phoneNumber") + protected String phoneNumber = null; + + + @JsonProperty("postalState") + protected String postalState = null; + + + @JsonProperty("postcode") + protected String postcode = null; + + + @JsonProperty("salesTaxNumber") + protected String salesTaxNumber = null; + + + @JsonProperty("salutation") + protected String salutation = null; + + + @JsonProperty("socialSecurityNumber") + protected String socialSecurityNumber = null; + + + @JsonProperty("sortingCode") + protected String sortingCode = null; + + + @JsonProperty("street") + protected String street = null; + + + + public ShopifySubscriptionAddressCreate city(String city) { + this.city = city; + return this; + } + + /** + * + * @return city + **/ + @ApiModelProperty(value = "") + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + + public ShopifySubscriptionAddressCreate commercialRegisterNumber(String commercialRegisterNumber) { + this.commercialRegisterNumber = commercialRegisterNumber; + return this; + } + + /** + * + * @return commercialRegisterNumber + **/ + @ApiModelProperty(value = "") + public String getCommercialRegisterNumber() { + return commercialRegisterNumber; + } + + public void setCommercialRegisterNumber(String commercialRegisterNumber) { + this.commercialRegisterNumber = commercialRegisterNumber; + } + + + public ShopifySubscriptionAddressCreate country(String country) { + this.country = country; + return this; + } + + /** + * + * @return country + **/ + @ApiModelProperty(value = "") + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + + public ShopifySubscriptionAddressCreate dateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * + * @return dateOfBirth + **/ + @ApiModelProperty(value = "") + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public ShopifySubscriptionAddressCreate dependentLocality(String dependentLocality) { + this.dependentLocality = dependentLocality; + return this; + } + + /** + * + * @return dependentLocality + **/ + @ApiModelProperty(value = "") + public String getDependentLocality() { + return dependentLocality; + } + + public void setDependentLocality(String dependentLocality) { + this.dependentLocality = dependentLocality; + } + + + public ShopifySubscriptionAddressCreate emailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * + * @return emailAddress + **/ + @ApiModelProperty(value = "") + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + + public ShopifySubscriptionAddressCreate familyName(String familyName) { + this.familyName = familyName; + return this; + } + + /** + * + * @return familyName + **/ + @ApiModelProperty(value = "") + public String getFamilyName() { + return familyName; + } + + public void setFamilyName(String familyName) { + this.familyName = familyName; + } + + + public ShopifySubscriptionAddressCreate gender(Gender gender) { + this.gender = gender; + return this; + } + + /** + * + * @return gender + **/ + @ApiModelProperty(value = "") + public Gender getGender() { + return gender; + } + + public void setGender(Gender gender) { + this.gender = gender; + } + + + public ShopifySubscriptionAddressCreate givenName(String givenName) { + this.givenName = givenName; + return this; + } + + /** + * + * @return givenName + **/ + @ApiModelProperty(value = "") + public String getGivenName() { + return givenName; + } + + public void setGivenName(String givenName) { + this.givenName = givenName; + } + + + public ShopifySubscriptionAddressCreate legalOrganizationForm(Long legalOrganizationForm) { + this.legalOrganizationForm = legalOrganizationForm; + return this; + } + + /** + * + * @return legalOrganizationForm + **/ + @ApiModelProperty(value = "") + public Long getLegalOrganizationForm() { + return legalOrganizationForm; + } + + public void setLegalOrganizationForm(Long legalOrganizationForm) { + this.legalOrganizationForm = legalOrganizationForm; + } + + + public ShopifySubscriptionAddressCreate mobilePhoneNumber(String mobilePhoneNumber) { + this.mobilePhoneNumber = mobilePhoneNumber; + return this; + } + + /** + * + * @return mobilePhoneNumber + **/ + @ApiModelProperty(value = "") + public String getMobilePhoneNumber() { + return mobilePhoneNumber; + } + + public void setMobilePhoneNumber(String mobilePhoneNumber) { + this.mobilePhoneNumber = mobilePhoneNumber; + } + + + public ShopifySubscriptionAddressCreate organizationName(String organizationName) { + this.organizationName = organizationName; + return this; + } + + /** + * + * @return organizationName + **/ + @ApiModelProperty(value = "") + public String getOrganizationName() { + return organizationName; + } + + public void setOrganizationName(String organizationName) { + this.organizationName = organizationName; + } + + + public ShopifySubscriptionAddressCreate phoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * + * @return phoneNumber + **/ + @ApiModelProperty(value = "") + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public ShopifySubscriptionAddressCreate postalState(String postalState) { + this.postalState = postalState; + return this; + } + + /** + * + * @return postalState + **/ + @ApiModelProperty(value = "") + public String getPostalState() { + return postalState; + } + + public void setPostalState(String postalState) { + this.postalState = postalState; + } + + + public ShopifySubscriptionAddressCreate postcode(String postcode) { + this.postcode = postcode; + return this; + } + + /** + * + * @return postcode + **/ + @ApiModelProperty(value = "") + public String getPostcode() { + return postcode; + } + + public void setPostcode(String postcode) { + this.postcode = postcode; + } + + + public ShopifySubscriptionAddressCreate salesTaxNumber(String salesTaxNumber) { + this.salesTaxNumber = salesTaxNumber; + return this; + } + + /** + * + * @return salesTaxNumber + **/ + @ApiModelProperty(value = "") + public String getSalesTaxNumber() { + return salesTaxNumber; + } + + public void setSalesTaxNumber(String salesTaxNumber) { + this.salesTaxNumber = salesTaxNumber; + } + + + public ShopifySubscriptionAddressCreate salutation(String salutation) { + this.salutation = salutation; + return this; + } + + /** + * + * @return salutation + **/ + @ApiModelProperty(value = "") + public String getSalutation() { + return salutation; + } + + public void setSalutation(String salutation) { + this.salutation = salutation; + } + + + public ShopifySubscriptionAddressCreate socialSecurityNumber(String socialSecurityNumber) { + this.socialSecurityNumber = socialSecurityNumber; + return this; + } + + /** + * + * @return socialSecurityNumber + **/ + @ApiModelProperty(value = "") + public String getSocialSecurityNumber() { + return socialSecurityNumber; + } + + public void setSocialSecurityNumber(String socialSecurityNumber) { + this.socialSecurityNumber = socialSecurityNumber; + } + + + public ShopifySubscriptionAddressCreate sortingCode(String sortingCode) { + this.sortingCode = sortingCode; + return this; + } + + /** + * The sorting code identifies the post office at which the post box is located in. + * @return sortingCode + **/ + @ApiModelProperty(value = "The sorting code identifies the post office at which the post box is located in.") + public String getSortingCode() { + return sortingCode; + } + + public void setSortingCode(String sortingCode) { + this.sortingCode = sortingCode; + } + + + public ShopifySubscriptionAddressCreate street(String street) { + this.street = street; + return this; + } + + /** + * + * @return street + **/ + @ApiModelProperty(value = "") + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionAddressCreate shopifySubscriptionAddressCreate = (ShopifySubscriptionAddressCreate) o; + return Objects.equals(this.city, shopifySubscriptionAddressCreate.city) && + Objects.equals(this.commercialRegisterNumber, shopifySubscriptionAddressCreate.commercialRegisterNumber) && + Objects.equals(this.country, shopifySubscriptionAddressCreate.country) && + Objects.equals(this.dateOfBirth, shopifySubscriptionAddressCreate.dateOfBirth) && + Objects.equals(this.dependentLocality, shopifySubscriptionAddressCreate.dependentLocality) && + Objects.equals(this.emailAddress, shopifySubscriptionAddressCreate.emailAddress) && + Objects.equals(this.familyName, shopifySubscriptionAddressCreate.familyName) && + Objects.equals(this.gender, shopifySubscriptionAddressCreate.gender) && + Objects.equals(this.givenName, shopifySubscriptionAddressCreate.givenName) && + Objects.equals(this.legalOrganizationForm, shopifySubscriptionAddressCreate.legalOrganizationForm) && + Objects.equals(this.mobilePhoneNumber, shopifySubscriptionAddressCreate.mobilePhoneNumber) && + Objects.equals(this.organizationName, shopifySubscriptionAddressCreate.organizationName) && + Objects.equals(this.phoneNumber, shopifySubscriptionAddressCreate.phoneNumber) && + Objects.equals(this.postalState, shopifySubscriptionAddressCreate.postalState) && + Objects.equals(this.postcode, shopifySubscriptionAddressCreate.postcode) && + Objects.equals(this.salesTaxNumber, shopifySubscriptionAddressCreate.salesTaxNumber) && + Objects.equals(this.salutation, shopifySubscriptionAddressCreate.salutation) && + Objects.equals(this.socialSecurityNumber, shopifySubscriptionAddressCreate.socialSecurityNumber) && + Objects.equals(this.sortingCode, shopifySubscriptionAddressCreate.sortingCode) && + Objects.equals(this.street, shopifySubscriptionAddressCreate.street); + } + + @Override + public int hashCode() { + return Objects.hash(city, commercialRegisterNumber, country, dateOfBirth, dependentLocality, emailAddress, familyName, gender, givenName, legalOrganizationForm, mobilePhoneNumber, organizationName, phoneNumber, postalState, postcode, salesTaxNumber, salutation, socialSecurityNumber, sortingCode, street); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionAddressCreate {\n"); + + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" commercialRegisterNumber: ").append(toIndentedString(commercialRegisterNumber)).append("\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" dependentLocality: ").append(toIndentedString(dependentLocality)).append("\n"); + sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n"); + sb.append(" familyName: ").append(toIndentedString(familyName)).append("\n"); + sb.append(" gender: ").append(toIndentedString(gender)).append("\n"); + sb.append(" givenName: ").append(toIndentedString(givenName)).append("\n"); + sb.append(" legalOrganizationForm: ").append(toIndentedString(legalOrganizationForm)).append("\n"); + sb.append(" mobilePhoneNumber: ").append(toIndentedString(mobilePhoneNumber)).append("\n"); + sb.append(" organizationName: ").append(toIndentedString(organizationName)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" postalState: ").append(toIndentedString(postalState)).append("\n"); + sb.append(" postcode: ").append(toIndentedString(postcode)).append("\n"); + sb.append(" salesTaxNumber: ").append(toIndentedString(salesTaxNumber)).append("\n"); + sb.append(" salutation: ").append(toIndentedString(salutation)).append("\n"); + sb.append(" socialSecurityNumber: ").append(toIndentedString(socialSecurityNumber)).append("\n"); + sb.append(" sortingCode: ").append(toIndentedString(sortingCode)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionBillingIntervalUnit.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionBillingIntervalUnit.java new file mode 100644 index 0000000..978921f --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionBillingIntervalUnit.java @@ -0,0 +1,74 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionBillingIntervalUnit { + + MINUTES("MINUTES"), + + HOURS("HOURS"), + + DAYS("DAYS"), + + WEEKS("WEEKS"), + + MONTHS("MONTHS"), + + YEARS("YEARS"); + + private String value; + + ShopifySubscriptionBillingIntervalUnit(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionBillingIntervalUnit fromValue(String text) { + for (ShopifySubscriptionBillingIntervalUnit b : ShopifySubscriptionBillingIntervalUnit.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionCreationRequest.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionCreationRequest.java new file mode 100644 index 0000000..a535e9e --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionCreationRequest.java @@ -0,0 +1,441 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriberCreation; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionAddressCreate; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionModelBillingConfiguration; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionModelItem; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionCreationRequest { + + @JsonProperty("billingAddress") + protected ShopifySubscriptionAddressCreate billingAddress = null; + + + @JsonProperty("billingConfiguration") + protected ShopifySubscriptionModelBillingConfiguration billingConfiguration = null; + + + @JsonProperty("currency") + protected String currency = null; + + + @JsonProperty("externalId") + protected String externalId = null; + + + @JsonProperty("initialExecutionDate") + protected OffsetDateTime initialExecutionDate = null; + + + @JsonProperty("integration") + protected Long integration = null; + + + @JsonProperty("items") + protected List items = new ArrayList<>(); + + + @JsonProperty("language") + protected String language = null; + + + @JsonProperty("shippingAddress") + protected ShopifySubscriptionAddressCreate shippingAddress = null; + + + @JsonProperty("shippingMethodName") + protected String shippingMethodName = null; + + + @JsonProperty("spaceViewId") + protected Long spaceViewId = null; + + + @JsonProperty("storeOrderConfirmationEmailEnabled") + protected Boolean storeOrderConfirmationEmailEnabled = null; + + + @JsonProperty("subscriber") + protected ShopifySubscriberCreation subscriber = null; + + + @JsonProperty("subscriberSuspensionAllowed") + protected Boolean subscriberSuspensionAllowed = null; + + + + public ShopifySubscriptionCreationRequest billingAddress(ShopifySubscriptionAddressCreate billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + /** + * + * @return billingAddress + **/ + @ApiModelProperty(required = true, value = "") + public ShopifySubscriptionAddressCreate getBillingAddress() { + return billingAddress; + } + + public void setBillingAddress(ShopifySubscriptionAddressCreate billingAddress) { + this.billingAddress = billingAddress; + } + + + public ShopifySubscriptionCreationRequest billingConfiguration(ShopifySubscriptionModelBillingConfiguration billingConfiguration) { + this.billingConfiguration = billingConfiguration; + return this; + } + + /** + * + * @return billingConfiguration + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionModelBillingConfiguration getBillingConfiguration() { + return billingConfiguration; + } + + public void setBillingConfiguration(ShopifySubscriptionModelBillingConfiguration billingConfiguration) { + this.billingConfiguration = billingConfiguration; + } + + + public ShopifySubscriptionCreationRequest currency(String currency) { + this.currency = currency; + return this; + } + + /** + * + * @return currency + **/ + @ApiModelProperty(required = true, value = "") + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + + public ShopifySubscriptionCreationRequest externalId(String externalId) { + this.externalId = externalId; + return this; + } + + /** + * A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead. + * @return externalId + **/ + @ApiModelProperty(required = true, value = "A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.") + public String getExternalId() { + return externalId; + } + + public void setExternalId(String externalId) { + this.externalId = externalId; + } + + + public ShopifySubscriptionCreationRequest initialExecutionDate(OffsetDateTime initialExecutionDate) { + this.initialExecutionDate = initialExecutionDate; + return this; + } + + /** + * + * @return initialExecutionDate + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getInitialExecutionDate() { + return initialExecutionDate; + } + + public void setInitialExecutionDate(OffsetDateTime initialExecutionDate) { + this.initialExecutionDate = initialExecutionDate; + } + + + public ShopifySubscriptionCreationRequest integration(Long integration) { + this.integration = integration; + return this; + } + + /** + * + * @return integration + **/ + @ApiModelProperty(required = true, value = "") + public Long getIntegration() { + return integration; + } + + public void setIntegration(Long integration) { + this.integration = integration; + } + + + public ShopifySubscriptionCreationRequest items(List items) { + this.items = items; + return this; + } + + public ShopifySubscriptionCreationRequest addItemsItem(ShopifySubscriptionModelItem itemsItem) { + this.items.add(itemsItem); + return this; + } + + /** + * + * @return items + **/ + @ApiModelProperty(required = true, value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + public ShopifySubscriptionCreationRequest language(String language) { + this.language = language; + return this; + } + + /** + * + * @return language + **/ + @ApiModelProperty(required = true, value = "") + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + + public ShopifySubscriptionCreationRequest shippingAddress(ShopifySubscriptionAddressCreate shippingAddress) { + this.shippingAddress = shippingAddress; + return this; + } + + /** + * + * @return shippingAddress + **/ + @ApiModelProperty(required = true, value = "") + public ShopifySubscriptionAddressCreate getShippingAddress() { + return shippingAddress; + } + + public void setShippingAddress(ShopifySubscriptionAddressCreate shippingAddress) { + this.shippingAddress = shippingAddress; + } + + + public ShopifySubscriptionCreationRequest shippingMethodName(String shippingMethodName) { + this.shippingMethodName = shippingMethodName; + return this; + } + + /** + * + * @return shippingMethodName + **/ + @ApiModelProperty(value = "") + public String getShippingMethodName() { + return shippingMethodName; + } + + public void setShippingMethodName(String shippingMethodName) { + this.shippingMethodName = shippingMethodName; + } + + + public ShopifySubscriptionCreationRequest spaceViewId(Long spaceViewId) { + this.spaceViewId = spaceViewId; + return this; + } + + /** + * + * @return spaceViewId + **/ + @ApiModelProperty(value = "") + public Long getSpaceViewId() { + return spaceViewId; + } + + public void setSpaceViewId(Long spaceViewId) { + this.spaceViewId = spaceViewId; + } + + + public ShopifySubscriptionCreationRequest storeOrderConfirmationEmailEnabled(Boolean storeOrderConfirmationEmailEnabled) { + this.storeOrderConfirmationEmailEnabled = storeOrderConfirmationEmailEnabled; + return this; + } + + /** + * + * @return storeOrderConfirmationEmailEnabled + **/ + @ApiModelProperty(value = "") + public Boolean isStoreOrderConfirmationEmailEnabled() { + return storeOrderConfirmationEmailEnabled; + } + + public void setStoreOrderConfirmationEmailEnabled(Boolean storeOrderConfirmationEmailEnabled) { + this.storeOrderConfirmationEmailEnabled = storeOrderConfirmationEmailEnabled; + } + + + public ShopifySubscriptionCreationRequest subscriber(ShopifySubscriberCreation subscriber) { + this.subscriber = subscriber; + return this; + } + + /** + * + * @return subscriber + **/ + @ApiModelProperty(required = true, value = "") + public ShopifySubscriberCreation getSubscriber() { + return subscriber; + } + + public void setSubscriber(ShopifySubscriberCreation subscriber) { + this.subscriber = subscriber; + } + + + public ShopifySubscriptionCreationRequest subscriberSuspensionAllowed(Boolean subscriberSuspensionAllowed) { + this.subscriberSuspensionAllowed = subscriberSuspensionAllowed; + return this; + } + + /** + * + * @return subscriberSuspensionAllowed + **/ + @ApiModelProperty(value = "") + public Boolean isSubscriberSuspensionAllowed() { + return subscriberSuspensionAllowed; + } + + public void setSubscriberSuspensionAllowed(Boolean subscriberSuspensionAllowed) { + this.subscriberSuspensionAllowed = subscriberSuspensionAllowed; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionCreationRequest shopifySubscriptionCreationRequest = (ShopifySubscriptionCreationRequest) o; + return Objects.equals(this.billingAddress, shopifySubscriptionCreationRequest.billingAddress) && + Objects.equals(this.billingConfiguration, shopifySubscriptionCreationRequest.billingConfiguration) && + Objects.equals(this.currency, shopifySubscriptionCreationRequest.currency) && + Objects.equals(this.externalId, shopifySubscriptionCreationRequest.externalId) && + Objects.equals(this.initialExecutionDate, shopifySubscriptionCreationRequest.initialExecutionDate) && + Objects.equals(this.integration, shopifySubscriptionCreationRequest.integration) && + Objects.equals(this.items, shopifySubscriptionCreationRequest.items) && + Objects.equals(this.language, shopifySubscriptionCreationRequest.language) && + Objects.equals(this.shippingAddress, shopifySubscriptionCreationRequest.shippingAddress) && + Objects.equals(this.shippingMethodName, shopifySubscriptionCreationRequest.shippingMethodName) && + Objects.equals(this.spaceViewId, shopifySubscriptionCreationRequest.spaceViewId) && + Objects.equals(this.storeOrderConfirmationEmailEnabled, shopifySubscriptionCreationRequest.storeOrderConfirmationEmailEnabled) && + Objects.equals(this.subscriber, shopifySubscriptionCreationRequest.subscriber) && + Objects.equals(this.subscriberSuspensionAllowed, shopifySubscriptionCreationRequest.subscriberSuspensionAllowed); + } + + @Override + public int hashCode() { + return Objects.hash(billingAddress, billingConfiguration, currency, externalId, initialExecutionDate, integration, items, language, shippingAddress, shippingMethodName, spaceViewId, storeOrderConfirmationEmailEnabled, subscriber, subscriberSuspensionAllowed); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionCreationRequest {\n"); + + sb.append(" billingAddress: ").append(toIndentedString(billingAddress)).append("\n"); + sb.append(" billingConfiguration: ").append(toIndentedString(billingConfiguration)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" initialExecutionDate: ").append(toIndentedString(initialExecutionDate)).append("\n"); + sb.append(" integration: ").append(toIndentedString(integration)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n"); + sb.append(" shippingMethodName: ").append(toIndentedString(shippingMethodName)).append("\n"); + sb.append(" spaceViewId: ").append(toIndentedString(spaceViewId)).append("\n"); + sb.append(" storeOrderConfirmationEmailEnabled: ").append(toIndentedString(storeOrderConfirmationEmailEnabled)).append("\n"); + sb.append(" subscriber: ").append(toIndentedString(subscriber)).append("\n"); + sb.append(" subscriberSuspensionAllowed: ").append(toIndentedString(subscriberSuspensionAllowed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionModelBillingConfiguration.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionModelBillingConfiguration.java new file mode 100644 index 0000000..4bc4424 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionModelBillingConfiguration.java @@ -0,0 +1,307 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionBillingIntervalUnit; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionWeekday; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionModelBillingConfiguration { + + @JsonProperty("billingDayOfMonth") + protected Integer billingDayOfMonth = null; + + + @JsonProperty("billingIntervalAmount") + protected Integer billingIntervalAmount = null; + + + @JsonProperty("billingIntervalUnit") + protected ShopifySubscriptionBillingIntervalUnit billingIntervalUnit = null; + + + @JsonProperty("billingReferenceDate") + protected OffsetDateTime billingReferenceDate = null; + + + @JsonProperty("billingWeekday") + protected ShopifySubscriptionWeekday billingWeekday = null; + + + @JsonProperty("maximalBillingCycles") + protected Integer maximalBillingCycles = null; + + + @JsonProperty("maximalSuspendableCycles") + protected Integer maximalSuspendableCycles = null; + + + @JsonProperty("minimalBillingCycles") + protected Integer minimalBillingCycles = null; + + + @JsonProperty("terminationBillingCycles") + protected Integer terminationBillingCycles = null; + + + + public ShopifySubscriptionModelBillingConfiguration billingDayOfMonth(Integer billingDayOfMonth) { + this.billingDayOfMonth = billingDayOfMonth; + return this; + } + + /** + * Define the day of the month on which the recurring orders should be created. + * @return billingDayOfMonth + **/ + @ApiModelProperty(value = "Define the day of the month on which the recurring orders should be created.") + public Integer getBillingDayOfMonth() { + return billingDayOfMonth; + } + + public void setBillingDayOfMonth(Integer billingDayOfMonth) { + this.billingDayOfMonth = billingDayOfMonth; + } + + + public ShopifySubscriptionModelBillingConfiguration billingIntervalAmount(Integer billingIntervalAmount) { + this.billingIntervalAmount = billingIntervalAmount; + return this; + } + + /** + * + * @return billingIntervalAmount + **/ + @ApiModelProperty(value = "") + public Integer getBillingIntervalAmount() { + return billingIntervalAmount; + } + + public void setBillingIntervalAmount(Integer billingIntervalAmount) { + this.billingIntervalAmount = billingIntervalAmount; + } + + + public ShopifySubscriptionModelBillingConfiguration billingIntervalUnit(ShopifySubscriptionBillingIntervalUnit billingIntervalUnit) { + this.billingIntervalUnit = billingIntervalUnit; + return this; + } + + /** + * Define how frequently recurring orders should be created. + * @return billingIntervalUnit + **/ + @ApiModelProperty(value = "Define how frequently recurring orders should be created.") + public ShopifySubscriptionBillingIntervalUnit getBillingIntervalUnit() { + return billingIntervalUnit; + } + + public void setBillingIntervalUnit(ShopifySubscriptionBillingIntervalUnit billingIntervalUnit) { + this.billingIntervalUnit = billingIntervalUnit; + } + + + public ShopifySubscriptionModelBillingConfiguration billingReferenceDate(OffsetDateTime billingReferenceDate) { + this.billingReferenceDate = billingReferenceDate; + return this; + } + + /** + * This date will be used as basis to calculate the dates of recurring orders. + * @return billingReferenceDate + **/ + @ApiModelProperty(value = "This date will be used as basis to calculate the dates of recurring orders.") + public OffsetDateTime getBillingReferenceDate() { + return billingReferenceDate; + } + + public void setBillingReferenceDate(OffsetDateTime billingReferenceDate) { + this.billingReferenceDate = billingReferenceDate; + } + + + public ShopifySubscriptionModelBillingConfiguration billingWeekday(ShopifySubscriptionWeekday billingWeekday) { + this.billingWeekday = billingWeekday; + return this; + } + + /** + * Define the weekday on which the recurring orders should be created. + * @return billingWeekday + **/ + @ApiModelProperty(value = "Define the weekday on which the recurring orders should be created.") + public ShopifySubscriptionWeekday getBillingWeekday() { + return billingWeekday; + } + + public void setBillingWeekday(ShopifySubscriptionWeekday billingWeekday) { + this.billingWeekday = billingWeekday; + } + + + public ShopifySubscriptionModelBillingConfiguration maximalBillingCycles(Integer maximalBillingCycles) { + this.maximalBillingCycles = maximalBillingCycles; + return this; + } + + /** + * Define the maximum number of orders the subscription will run for. + * @return maximalBillingCycles + **/ + @ApiModelProperty(value = "Define the maximum number of orders the subscription will run for.") + public Integer getMaximalBillingCycles() { + return maximalBillingCycles; + } + + public void setMaximalBillingCycles(Integer maximalBillingCycles) { + this.maximalBillingCycles = maximalBillingCycles; + } + + + public ShopifySubscriptionModelBillingConfiguration maximalSuspendableCycles(Integer maximalSuspendableCycles) { + this.maximalSuspendableCycles = maximalSuspendableCycles; + return this; + } + + /** + * Define the maximum number of orders the subscription can be suspended for at a time. + * @return maximalSuspendableCycles + **/ + @ApiModelProperty(value = "Define the maximum number of orders the subscription can be suspended for at a time.") + public Integer getMaximalSuspendableCycles() { + return maximalSuspendableCycles; + } + + public void setMaximalSuspendableCycles(Integer maximalSuspendableCycles) { + this.maximalSuspendableCycles = maximalSuspendableCycles; + } + + + public ShopifySubscriptionModelBillingConfiguration minimalBillingCycles(Integer minimalBillingCycles) { + this.minimalBillingCycles = minimalBillingCycles; + return this; + } + + /** + * Define the minimal number of orders the subscription will run for. + * @return minimalBillingCycles + **/ + @ApiModelProperty(value = "Define the minimal number of orders the subscription will run for.") + public Integer getMinimalBillingCycles() { + return minimalBillingCycles; + } + + public void setMinimalBillingCycles(Integer minimalBillingCycles) { + this.minimalBillingCycles = minimalBillingCycles; + } + + + public ShopifySubscriptionModelBillingConfiguration terminationBillingCycles(Integer terminationBillingCycles) { + this.terminationBillingCycles = terminationBillingCycles; + return this; + } + + /** + * Define the number of orders the subscription will keep running for after its termination has been requested. + * @return terminationBillingCycles + **/ + @ApiModelProperty(value = "Define the number of orders the subscription will keep running for after its termination has been requested.") + public Integer getTerminationBillingCycles() { + return terminationBillingCycles; + } + + public void setTerminationBillingCycles(Integer terminationBillingCycles) { + this.terminationBillingCycles = terminationBillingCycles; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionModelBillingConfiguration shopifySubscriptionModelBillingConfiguration = (ShopifySubscriptionModelBillingConfiguration) o; + return Objects.equals(this.billingDayOfMonth, shopifySubscriptionModelBillingConfiguration.billingDayOfMonth) && + Objects.equals(this.billingIntervalAmount, shopifySubscriptionModelBillingConfiguration.billingIntervalAmount) && + Objects.equals(this.billingIntervalUnit, shopifySubscriptionModelBillingConfiguration.billingIntervalUnit) && + Objects.equals(this.billingReferenceDate, shopifySubscriptionModelBillingConfiguration.billingReferenceDate) && + Objects.equals(this.billingWeekday, shopifySubscriptionModelBillingConfiguration.billingWeekday) && + Objects.equals(this.maximalBillingCycles, shopifySubscriptionModelBillingConfiguration.maximalBillingCycles) && + Objects.equals(this.maximalSuspendableCycles, shopifySubscriptionModelBillingConfiguration.maximalSuspendableCycles) && + Objects.equals(this.minimalBillingCycles, shopifySubscriptionModelBillingConfiguration.minimalBillingCycles) && + Objects.equals(this.terminationBillingCycles, shopifySubscriptionModelBillingConfiguration.terminationBillingCycles); + } + + @Override + public int hashCode() { + return Objects.hash(billingDayOfMonth, billingIntervalAmount, billingIntervalUnit, billingReferenceDate, billingWeekday, maximalBillingCycles, maximalSuspendableCycles, minimalBillingCycles, terminationBillingCycles); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionModelBillingConfiguration {\n"); + + sb.append(" billingDayOfMonth: ").append(toIndentedString(billingDayOfMonth)).append("\n"); + sb.append(" billingIntervalAmount: ").append(toIndentedString(billingIntervalAmount)).append("\n"); + sb.append(" billingIntervalUnit: ").append(toIndentedString(billingIntervalUnit)).append("\n"); + sb.append(" billingReferenceDate: ").append(toIndentedString(billingReferenceDate)).append("\n"); + sb.append(" billingWeekday: ").append(toIndentedString(billingWeekday)).append("\n"); + sb.append(" maximalBillingCycles: ").append(toIndentedString(maximalBillingCycles)).append("\n"); + sb.append(" maximalSuspendableCycles: ").append(toIndentedString(maximalSuspendableCycles)).append("\n"); + sb.append(" minimalBillingCycles: ").append(toIndentedString(minimalBillingCycles)).append("\n"); + sb.append(" terminationBillingCycles: ").append(toIndentedString(terminationBillingCycles)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionModelItem.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionModelItem.java new file mode 100644 index 0000000..f1faf93 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionModelItem.java @@ -0,0 +1,216 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionModelTaxLine; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionModelItem { + + @JsonProperty("priceIncludingTax") + protected BigDecimal priceIncludingTax = null; + + + @JsonProperty("productId") + protected Long productId = null; + + + @JsonProperty("quantity") + protected BigDecimal quantity = null; + + + @JsonProperty("recalculatePrice") + protected Boolean recalculatePrice = null; + + + @JsonProperty("taxLines") + protected List taxLines = null; + + + + public ShopifySubscriptionModelItem priceIncludingTax(BigDecimal priceIncludingTax) { + this.priceIncludingTax = priceIncludingTax; + return this; + } + + /** + * + * @return priceIncludingTax + **/ + @ApiModelProperty(value = "") + public BigDecimal getPriceIncludingTax() { + return priceIncludingTax; + } + + public void setPriceIncludingTax(BigDecimal priceIncludingTax) { + this.priceIncludingTax = priceIncludingTax; + } + + + public ShopifySubscriptionModelItem productId(Long productId) { + this.productId = productId; + return this; + } + + /** + * + * @return productId + **/ + @ApiModelProperty(value = "") + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + + public ShopifySubscriptionModelItem quantity(BigDecimal quantity) { + this.quantity = quantity; + return this; + } + + /** + * + * @return quantity + **/ + @ApiModelProperty(value = "") + public BigDecimal getQuantity() { + return quantity; + } + + public void setQuantity(BigDecimal quantity) { + this.quantity = quantity; + } + + + public ShopifySubscriptionModelItem recalculatePrice(Boolean recalculatePrice) { + this.recalculatePrice = recalculatePrice; + return this; + } + + /** + * + * @return recalculatePrice + **/ + @ApiModelProperty(value = "") + public Boolean isRecalculatePrice() { + return recalculatePrice; + } + + public void setRecalculatePrice(Boolean recalculatePrice) { + this.recalculatePrice = recalculatePrice; + } + + + public ShopifySubscriptionModelItem taxLines(List taxLines) { + this.taxLines = taxLines; + return this; + } + + public ShopifySubscriptionModelItem addTaxLinesItem(ShopifySubscriptionModelTaxLine taxLinesItem) { + if (this.taxLines == null) { + this.taxLines = new ArrayList<>(); + } + this.taxLines.add(taxLinesItem); + return this; + } + + /** + * + * @return taxLines + **/ + @ApiModelProperty(value = "") + public List getTaxLines() { + return taxLines; + } + + public void setTaxLines(List taxLines) { + this.taxLines = taxLines; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionModelItem shopifySubscriptionModelItem = (ShopifySubscriptionModelItem) o; + return Objects.equals(this.priceIncludingTax, shopifySubscriptionModelItem.priceIncludingTax) && + Objects.equals(this.productId, shopifySubscriptionModelItem.productId) && + Objects.equals(this.quantity, shopifySubscriptionModelItem.quantity) && + Objects.equals(this.recalculatePrice, shopifySubscriptionModelItem.recalculatePrice) && + Objects.equals(this.taxLines, shopifySubscriptionModelItem.taxLines); + } + + @Override + public int hashCode() { + return Objects.hash(priceIncludingTax, productId, quantity, recalculatePrice, taxLines); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionModelItem {\n"); + + sb.append(" priceIncludingTax: ").append(toIndentedString(priceIncludingTax)).append("\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" recalculatePrice: ").append(toIndentedString(recalculatePrice)).append("\n"); + sb.append(" taxLines: ").append(toIndentedString(taxLines)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionModelTaxLine.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionModelTaxLine.java new file mode 100644 index 0000000..d1c1afd --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionModelTaxLine.java @@ -0,0 +1,130 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionModelTaxLine { + + @JsonProperty("rate") + protected BigDecimal rate = null; + + + @JsonProperty("title") + protected String title = null; + + + + public ShopifySubscriptionModelTaxLine rate(BigDecimal rate) { + this.rate = rate; + return this; + } + + /** + * + * @return rate + **/ + @ApiModelProperty(value = "") + public BigDecimal getRate() { + return rate; + } + + public void setRate(BigDecimal rate) { + this.rate = rate; + } + + + public ShopifySubscriptionModelTaxLine title(String title) { + this.title = title; + return this; + } + + /** + * + * @return title + **/ + @ApiModelProperty(value = "") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionModelTaxLine shopifySubscriptionModelTaxLine = (ShopifySubscriptionModelTaxLine) o; + return Objects.equals(this.rate, shopifySubscriptionModelTaxLine.rate) && + Objects.equals(this.title, shopifySubscriptionModelTaxLine.title); + } + + @Override + public int hashCode() { + return Objects.hash(rate, title); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionModelTaxLine {\n"); + + sb.append(" rate: ").append(toIndentedString(rate)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProduct.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProduct.java new file mode 100644 index 0000000..3d25329 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProduct.java @@ -0,0 +1,549 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionBillingIntervalUnit; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionProductPricingOption; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionProductState; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionWeekday; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionProduct { + + @JsonProperty("absolutePriceAdjustment") + protected BigDecimal absolutePriceAdjustment = null; + + + @JsonProperty("billingDayOfMonth") + protected Integer billingDayOfMonth = null; + + + @JsonProperty("billingIntervalAmount") + protected Integer billingIntervalAmount = null; + + + @JsonProperty("billingIntervalUnit") + protected ShopifySubscriptionBillingIntervalUnit billingIntervalUnit = null; + + + @JsonProperty("billingWeekday") + protected ShopifySubscriptionWeekday billingWeekday = null; + + + @JsonProperty("fixedPrice") + protected BigDecimal fixedPrice = null; + + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("linkedSpaceId") + protected Long linkedSpaceId = null; + + + @JsonProperty("maximalBillingCycles") + protected Integer maximalBillingCycles = null; + + + @JsonProperty("maximalSuspendableCycles") + protected Integer maximalSuspendableCycles = null; + + + @JsonProperty("minimalBillingCycles") + protected Integer minimalBillingCycles = null; + + + @JsonProperty("plannedPurgeDate") + protected OffsetDateTime plannedPurgeDate = null; + + + @JsonProperty("pricingOption") + protected ShopifySubscriptionProductPricingOption pricingOption = null; + + + @JsonProperty("productId") + protected String productId = null; + + + @JsonProperty("productName") + protected String productName = null; + + + @JsonProperty("productPrice") + protected BigDecimal productPrice = null; + + + @JsonProperty("productSku") + protected String productSku = null; + + + @JsonProperty("productVariantId") + protected String productVariantId = null; + + + @JsonProperty("productVariantName") + protected String productVariantName = null; + + + @JsonProperty("relativePriceAdjustment") + protected BigDecimal relativePriceAdjustment = null; + + + @JsonProperty("shippingRequired") + protected Boolean shippingRequired = null; + + + @JsonProperty("shop") + protected Long shop = null; + + + @JsonProperty("state") + protected ShopifySubscriptionProductState state = null; + + + @JsonProperty("stockCheckRequired") + protected Boolean stockCheckRequired = null; + + + @JsonProperty("storeOrderConfirmationEmailEnabled") + protected Boolean storeOrderConfirmationEmailEnabled = null; + + + @JsonProperty("subscriberSuspensionAllowed") + protected Boolean subscriberSuspensionAllowed = null; + + + @JsonProperty("terminationBillingCycles") + protected Integer terminationBillingCycles = null; + + + @JsonProperty("updatedAt") + protected OffsetDateTime updatedAt = null; + + + @JsonProperty("version") + protected Integer version = null; + + + + /** + * + * @return absolutePriceAdjustment + **/ + @ApiModelProperty(value = "") + public BigDecimal getAbsolutePriceAdjustment() { + return absolutePriceAdjustment; + } + + + /** + * Define the day of the month on which the recurring orders should be created. + * @return billingDayOfMonth + **/ + @ApiModelProperty(value = "Define the day of the month on which the recurring orders should be created.") + public Integer getBillingDayOfMonth() { + return billingDayOfMonth; + } + + + /** + * + * @return billingIntervalAmount + **/ + @ApiModelProperty(value = "") + public Integer getBillingIntervalAmount() { + return billingIntervalAmount; + } + + + /** + * Define how frequently recurring orders should be created. + * @return billingIntervalUnit + **/ + @ApiModelProperty(value = "Define how frequently recurring orders should be created.") + public ShopifySubscriptionBillingIntervalUnit getBillingIntervalUnit() { + return billingIntervalUnit; + } + + + /** + * Define the weekday on which the recurring orders should be created. + * @return billingWeekday + **/ + @ApiModelProperty(value = "Define the weekday on which the recurring orders should be created.") + public ShopifySubscriptionWeekday getBillingWeekday() { + return billingWeekday; + } + + + /** + * + * @return fixedPrice + **/ + @ApiModelProperty(value = "") + public BigDecimal getFixedPrice() { + return fixedPrice; + } + + + /** + * The ID is the primary key of the entity. The ID identifies the entity uniquely. + * @return id + **/ + @ApiModelProperty(value = "The ID is the primary key of the entity. The ID identifies the entity uniquely.") + public Long getId() { + return id; + } + + + /** + * The linked space id holds the ID of the space to which the entity belongs to. + * @return linkedSpaceId + **/ + @ApiModelProperty(value = "The linked space id holds the ID of the space to which the entity belongs to.") + public Long getLinkedSpaceId() { + return linkedSpaceId; + } + + + /** + * Define the maximum number of orders the subscription will run for. + * @return maximalBillingCycles + **/ + @ApiModelProperty(value = "Define the maximum number of orders the subscription will run for.") + public Integer getMaximalBillingCycles() { + return maximalBillingCycles; + } + + + /** + * Define the maximum number of orders the subscription can be suspended for at a time. + * @return maximalSuspendableCycles + **/ + @ApiModelProperty(value = "Define the maximum number of orders the subscription can be suspended for at a time.") + public Integer getMaximalSuspendableCycles() { + return maximalSuspendableCycles; + } + + + /** + * Define the minimal number of orders the subscription will run for. + * @return minimalBillingCycles + **/ + @ApiModelProperty(value = "Define the minimal number of orders the subscription will run for.") + public Integer getMinimalBillingCycles() { + return minimalBillingCycles; + } + + + /** + * The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed. + * @return plannedPurgeDate + **/ + @ApiModelProperty(value = "The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.") + public OffsetDateTime getPlannedPurgeDate() { + return plannedPurgeDate; + } + + + /** + * + * @return pricingOption + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionProductPricingOption getPricingOption() { + return pricingOption; + } + + + /** + * The ID of the Shopify product that is enabled to be ordered as subscription. + * @return productId + **/ + @ApiModelProperty(value = "The ID of the Shopify product that is enabled to be ordered as subscription.") + public String getProductId() { + return productId; + } + + + /** + * + * @return productName + **/ + @ApiModelProperty(value = "") + public String getProductName() { + return productName; + } + + + /** + * + * @return productPrice + **/ + @ApiModelProperty(value = "") + public BigDecimal getProductPrice() { + return productPrice; + } + + + /** + * + * @return productSku + **/ + @ApiModelProperty(value = "") + public String getProductSku() { + return productSku; + } + + + /** + * + * @return productVariantId + **/ + @ApiModelProperty(value = "") + public String getProductVariantId() { + return productVariantId; + } + + + /** + * + * @return productVariantName + **/ + @ApiModelProperty(value = "") + public String getProductVariantName() { + return productVariantName; + } + + + /** + * + * @return relativePriceAdjustment + **/ + @ApiModelProperty(value = "") + public BigDecimal getRelativePriceAdjustment() { + return relativePriceAdjustment; + } + + + /** + * + * @return shippingRequired + **/ + @ApiModelProperty(value = "") + public Boolean isShippingRequired() { + return shippingRequired; + } + + + /** + * + * @return shop + **/ + @ApiModelProperty(value = "") + public Long getShop() { + return shop; + } + + + /** + * + * @return state + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionProductState getState() { + return state; + } + + + /** + * + * @return stockCheckRequired + **/ + @ApiModelProperty(value = "") + public Boolean isStockCheckRequired() { + return stockCheckRequired; + } + + + /** + * Define whether the order confirmation email of the Shopify shop is sent to the customer for recurring orders. + * @return storeOrderConfirmationEmailEnabled + **/ + @ApiModelProperty(value = "Define whether the order confirmation email of the Shopify shop is sent to the customer for recurring orders.") + public Boolean isStoreOrderConfirmationEmailEnabled() { + return storeOrderConfirmationEmailEnabled; + } + + + /** + * Define whether the customer is allowed to suspend subscriptions. + * @return subscriberSuspensionAllowed + **/ + @ApiModelProperty(value = "Define whether the customer is allowed to suspend subscriptions.") + public Boolean isSubscriberSuspensionAllowed() { + return subscriberSuspensionAllowed; + } + + + /** + * Define the number of orders the subscription will keep running for after its termination has been requested. + * @return terminationBillingCycles + **/ + @ApiModelProperty(value = "Define the number of orders the subscription will keep running for after its termination has been requested.") + public Integer getTerminationBillingCycles() { + return terminationBillingCycles; + } + + + /** + * + * @return updatedAt + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + /** + * The version number indicates the version of the entity. The version is incremented whenever the entity is changed. + * @return version + **/ + @ApiModelProperty(value = "The version number indicates the version of the entity. The version is incremented whenever the entity is changed.") + public Integer getVersion() { + return version; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionProduct shopifySubscriptionProduct = (ShopifySubscriptionProduct) o; + return Objects.equals(this.absolutePriceAdjustment, shopifySubscriptionProduct.absolutePriceAdjustment) && + Objects.equals(this.billingDayOfMonth, shopifySubscriptionProduct.billingDayOfMonth) && + Objects.equals(this.billingIntervalAmount, shopifySubscriptionProduct.billingIntervalAmount) && + Objects.equals(this.billingIntervalUnit, shopifySubscriptionProduct.billingIntervalUnit) && + Objects.equals(this.billingWeekday, shopifySubscriptionProduct.billingWeekday) && + Objects.equals(this.fixedPrice, shopifySubscriptionProduct.fixedPrice) && + Objects.equals(this.id, shopifySubscriptionProduct.id) && + Objects.equals(this.linkedSpaceId, shopifySubscriptionProduct.linkedSpaceId) && + Objects.equals(this.maximalBillingCycles, shopifySubscriptionProduct.maximalBillingCycles) && + Objects.equals(this.maximalSuspendableCycles, shopifySubscriptionProduct.maximalSuspendableCycles) && + Objects.equals(this.minimalBillingCycles, shopifySubscriptionProduct.minimalBillingCycles) && + Objects.equals(this.plannedPurgeDate, shopifySubscriptionProduct.plannedPurgeDate) && + Objects.equals(this.pricingOption, shopifySubscriptionProduct.pricingOption) && + Objects.equals(this.productId, shopifySubscriptionProduct.productId) && + Objects.equals(this.productName, shopifySubscriptionProduct.productName) && + Objects.equals(this.productPrice, shopifySubscriptionProduct.productPrice) && + Objects.equals(this.productSku, shopifySubscriptionProduct.productSku) && + Objects.equals(this.productVariantId, shopifySubscriptionProduct.productVariantId) && + Objects.equals(this.productVariantName, shopifySubscriptionProduct.productVariantName) && + Objects.equals(this.relativePriceAdjustment, shopifySubscriptionProduct.relativePriceAdjustment) && + Objects.equals(this.shippingRequired, shopifySubscriptionProduct.shippingRequired) && + Objects.equals(this.shop, shopifySubscriptionProduct.shop) && + Objects.equals(this.state, shopifySubscriptionProduct.state) && + Objects.equals(this.stockCheckRequired, shopifySubscriptionProduct.stockCheckRequired) && + Objects.equals(this.storeOrderConfirmationEmailEnabled, shopifySubscriptionProduct.storeOrderConfirmationEmailEnabled) && + Objects.equals(this.subscriberSuspensionAllowed, shopifySubscriptionProduct.subscriberSuspensionAllowed) && + Objects.equals(this.terminationBillingCycles, shopifySubscriptionProduct.terminationBillingCycles) && + Objects.equals(this.updatedAt, shopifySubscriptionProduct.updatedAt) && + Objects.equals(this.version, shopifySubscriptionProduct.version); + } + + @Override + public int hashCode() { + return Objects.hash(absolutePriceAdjustment, billingDayOfMonth, billingIntervalAmount, billingIntervalUnit, billingWeekday, fixedPrice, id, linkedSpaceId, maximalBillingCycles, maximalSuspendableCycles, minimalBillingCycles, plannedPurgeDate, pricingOption, productId, productName, productPrice, productSku, productVariantId, productVariantName, relativePriceAdjustment, shippingRequired, shop, state, stockCheckRequired, storeOrderConfirmationEmailEnabled, subscriberSuspensionAllowed, terminationBillingCycles, updatedAt, version); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionProduct {\n"); + + sb.append(" absolutePriceAdjustment: ").append(toIndentedString(absolutePriceAdjustment)).append("\n"); + sb.append(" billingDayOfMonth: ").append(toIndentedString(billingDayOfMonth)).append("\n"); + sb.append(" billingIntervalAmount: ").append(toIndentedString(billingIntervalAmount)).append("\n"); + sb.append(" billingIntervalUnit: ").append(toIndentedString(billingIntervalUnit)).append("\n"); + sb.append(" billingWeekday: ").append(toIndentedString(billingWeekday)).append("\n"); + sb.append(" fixedPrice: ").append(toIndentedString(fixedPrice)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" linkedSpaceId: ").append(toIndentedString(linkedSpaceId)).append("\n"); + sb.append(" maximalBillingCycles: ").append(toIndentedString(maximalBillingCycles)).append("\n"); + sb.append(" maximalSuspendableCycles: ").append(toIndentedString(maximalSuspendableCycles)).append("\n"); + sb.append(" minimalBillingCycles: ").append(toIndentedString(minimalBillingCycles)).append("\n"); + sb.append(" plannedPurgeDate: ").append(toIndentedString(plannedPurgeDate)).append("\n"); + sb.append(" pricingOption: ").append(toIndentedString(pricingOption)).append("\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" productName: ").append(toIndentedString(productName)).append("\n"); + sb.append(" productPrice: ").append(toIndentedString(productPrice)).append("\n"); + sb.append(" productSku: ").append(toIndentedString(productSku)).append("\n"); + sb.append(" productVariantId: ").append(toIndentedString(productVariantId)).append("\n"); + sb.append(" productVariantName: ").append(toIndentedString(productVariantName)).append("\n"); + sb.append(" relativePriceAdjustment: ").append(toIndentedString(relativePriceAdjustment)).append("\n"); + sb.append(" shippingRequired: ").append(toIndentedString(shippingRequired)).append("\n"); + sb.append(" shop: ").append(toIndentedString(shop)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" stockCheckRequired: ").append(toIndentedString(stockCheckRequired)).append("\n"); + sb.append(" storeOrderConfirmationEmailEnabled: ").append(toIndentedString(storeOrderConfirmationEmailEnabled)).append("\n"); + sb.append(" subscriberSuspensionAllowed: ").append(toIndentedString(subscriberSuspensionAllowed)).append("\n"); + sb.append(" terminationBillingCycles: ").append(toIndentedString(terminationBillingCycles)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductCreate.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductCreate.java new file mode 100644 index 0000000..da7d177 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductCreate.java @@ -0,0 +1,184 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.AbstractShopifySubscriptionProductUpdate; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionProductCreate extends AbstractShopifySubscriptionProductUpdate { + + @JsonProperty("productId") + protected String productId = null; + + + @JsonProperty("productVariantId") + protected String productVariantId = null; + + + @JsonProperty("shop") + protected Long shop = null; + + + + public ShopifySubscriptionProductCreate productId(String productId) { + this.productId = productId; + return this; + } + + /** + * The ID of the Shopify product that is enabled to be ordered as subscription. + * @return productId + **/ + @ApiModelProperty(required = true, value = "The ID of the Shopify product that is enabled to be ordered as subscription.") + public String getProductId() { + return productId; + } + + public void setProductId(String productId) { + this.productId = productId; + } + + + public ShopifySubscriptionProductCreate productVariantId(String productVariantId) { + this.productVariantId = productVariantId; + return this; + } + + /** + * + * @return productVariantId + **/ + @ApiModelProperty(required = true, value = "") + public String getProductVariantId() { + return productVariantId; + } + + public void setProductVariantId(String productVariantId) { + this.productVariantId = productVariantId; + } + + + public ShopifySubscriptionProductCreate shop(Long shop) { + this.shop = shop; + return this; + } + + /** + * + * @return shop + **/ + @ApiModelProperty(required = true, value = "") + public Long getShop() { + return shop; + } + + public void setShop(Long shop) { + this.shop = shop; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionProductCreate shopifySubscriptionProductCreate = (ShopifySubscriptionProductCreate) o; + return Objects.equals(this.absolutePriceAdjustment, shopifySubscriptionProductCreate.absolutePriceAdjustment) && + Objects.equals(this.billingDayOfMonth, shopifySubscriptionProductCreate.billingDayOfMonth) && + Objects.equals(this.billingIntervalAmount, shopifySubscriptionProductCreate.billingIntervalAmount) && + Objects.equals(this.billingIntervalUnit, shopifySubscriptionProductCreate.billingIntervalUnit) && + Objects.equals(this.billingWeekday, shopifySubscriptionProductCreate.billingWeekday) && + Objects.equals(this.fixedPrice, shopifySubscriptionProductCreate.fixedPrice) && + Objects.equals(this.maximalBillingCycles, shopifySubscriptionProductCreate.maximalBillingCycles) && + Objects.equals(this.maximalSuspendableCycles, shopifySubscriptionProductCreate.maximalSuspendableCycles) && + Objects.equals(this.minimalBillingCycles, shopifySubscriptionProductCreate.minimalBillingCycles) && + Objects.equals(this.pricingOption, shopifySubscriptionProductCreate.pricingOption) && + Objects.equals(this.relativePriceAdjustment, shopifySubscriptionProductCreate.relativePriceAdjustment) && + Objects.equals(this.storeOrderConfirmationEmailEnabled, shopifySubscriptionProductCreate.storeOrderConfirmationEmailEnabled) && + Objects.equals(this.subscriberSuspensionAllowed, shopifySubscriptionProductCreate.subscriberSuspensionAllowed) && + Objects.equals(this.terminationBillingCycles, shopifySubscriptionProductCreate.terminationBillingCycles) && + Objects.equals(this.productId, shopifySubscriptionProductCreate.productId) && + Objects.equals(this.productVariantId, shopifySubscriptionProductCreate.productVariantId) && + Objects.equals(this.shop, shopifySubscriptionProductCreate.shop) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(absolutePriceAdjustment, billingDayOfMonth, billingIntervalAmount, billingIntervalUnit, billingWeekday, fixedPrice, maximalBillingCycles, maximalSuspendableCycles, minimalBillingCycles, pricingOption, relativePriceAdjustment, storeOrderConfirmationEmailEnabled, subscriberSuspensionAllowed, terminationBillingCycles, productId, productVariantId, shop, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionProductCreate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" absolutePriceAdjustment: ").append(toIndentedString(absolutePriceAdjustment)).append("\n"); + sb.append(" billingDayOfMonth: ").append(toIndentedString(billingDayOfMonth)).append("\n"); + sb.append(" billingIntervalAmount: ").append(toIndentedString(billingIntervalAmount)).append("\n"); + sb.append(" billingIntervalUnit: ").append(toIndentedString(billingIntervalUnit)).append("\n"); + sb.append(" billingWeekday: ").append(toIndentedString(billingWeekday)).append("\n"); + sb.append(" fixedPrice: ").append(toIndentedString(fixedPrice)).append("\n"); + sb.append(" maximalBillingCycles: ").append(toIndentedString(maximalBillingCycles)).append("\n"); + sb.append(" maximalSuspendableCycles: ").append(toIndentedString(maximalSuspendableCycles)).append("\n"); + sb.append(" minimalBillingCycles: ").append(toIndentedString(minimalBillingCycles)).append("\n"); + sb.append(" pricingOption: ").append(toIndentedString(pricingOption)).append("\n"); + sb.append(" relativePriceAdjustment: ").append(toIndentedString(relativePriceAdjustment)).append("\n"); + sb.append(" storeOrderConfirmationEmailEnabled: ").append(toIndentedString(storeOrderConfirmationEmailEnabled)).append("\n"); + sb.append(" subscriberSuspensionAllowed: ").append(toIndentedString(subscriberSuspensionAllowed)).append("\n"); + sb.append(" terminationBillingCycles: ").append(toIndentedString(terminationBillingCycles)).append("\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" productVariantId: ").append(toIndentedString(productVariantId)).append("\n"); + sb.append(" shop: ").append(toIndentedString(shop)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductPricingOption.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductPricingOption.java new file mode 100644 index 0000000..765465f --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductPricingOption.java @@ -0,0 +1,72 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionProductPricingOption { + + CURRENT_PRICE("CURRENT_PRICE"), + + ORIGINAL_PRICE("ORIGINAL_PRICE"), + + FIXED_PRICE("FIXED_PRICE"), + + RELATIVE_ADJUSTMENT("RELATIVE_ADJUSTMENT"), + + ABSOLUTE_ADJUSTMENT("ABSOLUTE_ADJUSTMENT"); + + private String value; + + ShopifySubscriptionProductPricingOption(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionProductPricingOption fromValue(String text) { + for (ShopifySubscriptionProductPricingOption b : ShopifySubscriptionProductPricingOption.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductState.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductState.java new file mode 100644 index 0000000..1556ceb --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductState.java @@ -0,0 +1,74 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionProductState { + + CREATE("CREATE"), + + ACTIVE("ACTIVE"), + + INACTIVE("INACTIVE"), + + OBSOLETE("OBSOLETE"), + + DELETING("DELETING"), + + DELETED("DELETED"); + + private String value; + + ShopifySubscriptionProductState(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionProductState fromValue(String text) { + for (ShopifySubscriptionProductState b : ShopifySubscriptionProductState.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductUpdate.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductUpdate.java new file mode 100644 index 0000000..92a8485 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionProductUpdate.java @@ -0,0 +1,159 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.AbstractShopifySubscriptionProductUpdate; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionProductUpdate extends AbstractShopifySubscriptionProductUpdate { + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("version") + protected Long version = null; + + + + public ShopifySubscriptionProductUpdate id(Long id) { + this.id = id; + return this; + } + + /** + * The ID is the primary key of the entity. The ID identifies the entity uniquely. + * @return id + **/ + @ApiModelProperty(required = true, value = "The ID is the primary key of the entity. The ID identifies the entity uniquely.") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + + public ShopifySubscriptionProductUpdate version(Long version) { + this.version = version; + return this; + } + + /** + * The version number indicates the version of the entity. The version is incremented whenever the entity is changed. + * @return version + **/ + @ApiModelProperty(required = true, value = "The version number indicates the version of the entity. The version is incremented whenever the entity is changed.") + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionProductUpdate shopifySubscriptionProductUpdate = (ShopifySubscriptionProductUpdate) o; + return Objects.equals(this.absolutePriceAdjustment, shopifySubscriptionProductUpdate.absolutePriceAdjustment) && + Objects.equals(this.billingDayOfMonth, shopifySubscriptionProductUpdate.billingDayOfMonth) && + Objects.equals(this.billingIntervalAmount, shopifySubscriptionProductUpdate.billingIntervalAmount) && + Objects.equals(this.billingIntervalUnit, shopifySubscriptionProductUpdate.billingIntervalUnit) && + Objects.equals(this.billingWeekday, shopifySubscriptionProductUpdate.billingWeekday) && + Objects.equals(this.fixedPrice, shopifySubscriptionProductUpdate.fixedPrice) && + Objects.equals(this.maximalBillingCycles, shopifySubscriptionProductUpdate.maximalBillingCycles) && + Objects.equals(this.maximalSuspendableCycles, shopifySubscriptionProductUpdate.maximalSuspendableCycles) && + Objects.equals(this.minimalBillingCycles, shopifySubscriptionProductUpdate.minimalBillingCycles) && + Objects.equals(this.pricingOption, shopifySubscriptionProductUpdate.pricingOption) && + Objects.equals(this.relativePriceAdjustment, shopifySubscriptionProductUpdate.relativePriceAdjustment) && + Objects.equals(this.storeOrderConfirmationEmailEnabled, shopifySubscriptionProductUpdate.storeOrderConfirmationEmailEnabled) && + Objects.equals(this.subscriberSuspensionAllowed, shopifySubscriptionProductUpdate.subscriberSuspensionAllowed) && + Objects.equals(this.terminationBillingCycles, shopifySubscriptionProductUpdate.terminationBillingCycles) && + Objects.equals(this.id, shopifySubscriptionProductUpdate.id) && + Objects.equals(this.version, shopifySubscriptionProductUpdate.version) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(absolutePriceAdjustment, billingDayOfMonth, billingIntervalAmount, billingIntervalUnit, billingWeekday, fixedPrice, maximalBillingCycles, maximalSuspendableCycles, minimalBillingCycles, pricingOption, relativePriceAdjustment, storeOrderConfirmationEmailEnabled, subscriberSuspensionAllowed, terminationBillingCycles, id, version, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionProductUpdate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" absolutePriceAdjustment: ").append(toIndentedString(absolutePriceAdjustment)).append("\n"); + sb.append(" billingDayOfMonth: ").append(toIndentedString(billingDayOfMonth)).append("\n"); + sb.append(" billingIntervalAmount: ").append(toIndentedString(billingIntervalAmount)).append("\n"); + sb.append(" billingIntervalUnit: ").append(toIndentedString(billingIntervalUnit)).append("\n"); + sb.append(" billingWeekday: ").append(toIndentedString(billingWeekday)).append("\n"); + sb.append(" fixedPrice: ").append(toIndentedString(fixedPrice)).append("\n"); + sb.append(" maximalBillingCycles: ").append(toIndentedString(maximalBillingCycles)).append("\n"); + sb.append(" maximalSuspendableCycles: ").append(toIndentedString(maximalSuspendableCycles)).append("\n"); + sb.append(" minimalBillingCycles: ").append(toIndentedString(minimalBillingCycles)).append("\n"); + sb.append(" pricingOption: ").append(toIndentedString(pricingOption)).append("\n"); + sb.append(" relativePriceAdjustment: ").append(toIndentedString(relativePriceAdjustment)).append("\n"); + sb.append(" storeOrderConfirmationEmailEnabled: ").append(toIndentedString(storeOrderConfirmationEmailEnabled)).append("\n"); + sb.append(" subscriberSuspensionAllowed: ").append(toIndentedString(subscriberSuspensionAllowed)).append("\n"); + sb.append(" terminationBillingCycles: ").append(toIndentedString(terminationBillingCycles)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionState.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionState.java new file mode 100644 index 0000000..d0b34e0 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionState.java @@ -0,0 +1,74 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionState { + + INITIATING("INITIATING"), + + FAILED("FAILED"), + + ACTIVE("ACTIVE"), + + SUSPENDED("SUSPENDED"), + + TERMINATING("TERMINATING"), + + TERMINATED("TERMINATED"); + + private String value; + + ShopifySubscriptionState(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionState fromValue(String text) { + for (ShopifySubscriptionState b : ShopifySubscriptionState.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspension.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspension.java new file mode 100644 index 0000000..bb45191 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspension.java @@ -0,0 +1,292 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscription; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionSuspensionInitiator; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionSuspensionState; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionSuspensionType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionSuspension { + + @JsonProperty("createdBy") + protected Long createdBy = null; + + + @JsonProperty("createdOn") + protected OffsetDateTime createdOn = null; + + + @JsonProperty("endedBy") + protected Long endedBy = null; + + + @JsonProperty("endedOn") + protected OffsetDateTime endedOn = null; + + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("initiator") + protected ShopifySubscriptionSuspensionInitiator initiator = null; + + + @JsonProperty("linkedSpaceId") + protected Long linkedSpaceId = null; + + + @JsonProperty("plannedEndDate") + protected OffsetDateTime plannedEndDate = null; + + + @JsonProperty("shop") + protected Long shop = null; + + + @JsonProperty("state") + protected ShopifySubscriptionSuspensionState state = null; + + + @JsonProperty("subscription") + protected ShopifySubscription subscription = null; + + + @JsonProperty("type") + protected ShopifySubscriptionSuspensionType type = null; + + + @JsonProperty("version") + protected Integer version = null; + + + + /** + * + * @return createdBy + **/ + @ApiModelProperty(value = "") + public Long getCreatedBy() { + return createdBy; + } + + + /** + * + * @return createdOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getCreatedOn() { + return createdOn; + } + + + /** + * + * @return endedBy + **/ + @ApiModelProperty(value = "") + public Long getEndedBy() { + return endedBy; + } + + + /** + * + * @return endedOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getEndedOn() { + return endedOn; + } + + + /** + * The ID is the primary key of the entity. The ID identifies the entity uniquely. + * @return id + **/ + @ApiModelProperty(value = "The ID is the primary key of the entity. The ID identifies the entity uniquely.") + public Long getId() { + return id; + } + + + /** + * + * @return initiator + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionSuspensionInitiator getInitiator() { + return initiator; + } + + + /** + * The linked space id holds the ID of the space to which the entity belongs to. + * @return linkedSpaceId + **/ + @ApiModelProperty(value = "The linked space id holds the ID of the space to which the entity belongs to.") + public Long getLinkedSpaceId() { + return linkedSpaceId; + } + + + /** + * + * @return plannedEndDate + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getPlannedEndDate() { + return plannedEndDate; + } + + + /** + * + * @return shop + **/ + @ApiModelProperty(value = "") + public Long getShop() { + return shop; + } + + + /** + * + * @return state + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionSuspensionState getState() { + return state; + } + + + /** + * + * @return subscription + **/ + @ApiModelProperty(value = "") + public ShopifySubscription getSubscription() { + return subscription; + } + + + /** + * + * @return type + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionSuspensionType getType() { + return type; + } + + + /** + * The version number indicates the version of the entity. The version is incremented whenever the entity is changed. + * @return version + **/ + @ApiModelProperty(value = "The version number indicates the version of the entity. The version is incremented whenever the entity is changed.") + public Integer getVersion() { + return version; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionSuspension shopifySubscriptionSuspension = (ShopifySubscriptionSuspension) o; + return Objects.equals(this.createdBy, shopifySubscriptionSuspension.createdBy) && + Objects.equals(this.createdOn, shopifySubscriptionSuspension.createdOn) && + Objects.equals(this.endedBy, shopifySubscriptionSuspension.endedBy) && + Objects.equals(this.endedOn, shopifySubscriptionSuspension.endedOn) && + Objects.equals(this.id, shopifySubscriptionSuspension.id) && + Objects.equals(this.initiator, shopifySubscriptionSuspension.initiator) && + Objects.equals(this.linkedSpaceId, shopifySubscriptionSuspension.linkedSpaceId) && + Objects.equals(this.plannedEndDate, shopifySubscriptionSuspension.plannedEndDate) && + Objects.equals(this.shop, shopifySubscriptionSuspension.shop) && + Objects.equals(this.state, shopifySubscriptionSuspension.state) && + Objects.equals(this.subscription, shopifySubscriptionSuspension.subscription) && + Objects.equals(this.type, shopifySubscriptionSuspension.type) && + Objects.equals(this.version, shopifySubscriptionSuspension.version); + } + + @Override + public int hashCode() { + return Objects.hash(createdBy, createdOn, endedBy, endedOn, id, initiator, linkedSpaceId, plannedEndDate, shop, state, subscription, type, version); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionSuspension {\n"); + + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" createdOn: ").append(toIndentedString(createdOn)).append("\n"); + sb.append(" endedBy: ").append(toIndentedString(endedBy)).append("\n"); + sb.append(" endedOn: ").append(toIndentedString(endedOn)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" initiator: ").append(toIndentedString(initiator)).append("\n"); + sb.append(" linkedSpaceId: ").append(toIndentedString(linkedSpaceId)).append("\n"); + sb.append(" plannedEndDate: ").append(toIndentedString(plannedEndDate)).append("\n"); + sb.append(" shop: ").append(toIndentedString(shop)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" subscription: ").append(toIndentedString(subscription)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionCreate.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionCreate.java new file mode 100644 index 0000000..078a4f5 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionCreate.java @@ -0,0 +1,156 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionSuspensionType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionSuspensionCreate { + + @JsonProperty("plannedEndDate") + protected OffsetDateTime plannedEndDate = null; + + + @JsonProperty("subscription") + protected Long subscription = null; + + + @JsonProperty("type") + protected ShopifySubscriptionSuspensionType type = null; + + + + public ShopifySubscriptionSuspensionCreate plannedEndDate(OffsetDateTime plannedEndDate) { + this.plannedEndDate = plannedEndDate; + return this; + } + + /** + * + * @return plannedEndDate + **/ + @ApiModelProperty(required = true, value = "") + public OffsetDateTime getPlannedEndDate() { + return plannedEndDate; + } + + public void setPlannedEndDate(OffsetDateTime plannedEndDate) { + this.plannedEndDate = plannedEndDate; + } + + + public ShopifySubscriptionSuspensionCreate subscription(Long subscription) { + this.subscription = subscription; + return this; + } + + /** + * + * @return subscription + **/ + @ApiModelProperty(required = true, value = "") + public Long getSubscription() { + return subscription; + } + + public void setSubscription(Long subscription) { + this.subscription = subscription; + } + + + public ShopifySubscriptionSuspensionCreate type(ShopifySubscriptionSuspensionType type) { + this.type = type; + return this; + } + + /** + * + * @return type + **/ + @ApiModelProperty(required = true, value = "") + public ShopifySubscriptionSuspensionType getType() { + return type; + } + + public void setType(ShopifySubscriptionSuspensionType type) { + this.type = type; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionSuspensionCreate shopifySubscriptionSuspensionCreate = (ShopifySubscriptionSuspensionCreate) o; + return Objects.equals(this.plannedEndDate, shopifySubscriptionSuspensionCreate.plannedEndDate) && + Objects.equals(this.subscription, shopifySubscriptionSuspensionCreate.subscription) && + Objects.equals(this.type, shopifySubscriptionSuspensionCreate.type); + } + + @Override + public int hashCode() { + return Objects.hash(plannedEndDate, subscription, type); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionSuspensionCreate {\n"); + + sb.append(" plannedEndDate: ").append(toIndentedString(plannedEndDate)).append("\n"); + sb.append(" subscription: ").append(toIndentedString(subscription)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionInitiator.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionInitiator.java new file mode 100644 index 0000000..7ce6988 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionInitiator.java @@ -0,0 +1,66 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionSuspensionInitiator { + + MERCHANT("MERCHANT"), + + CUSTOMER("CUSTOMER"); + + private String value; + + ShopifySubscriptionSuspensionInitiator(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionSuspensionInitiator fromValue(String text) { + for (ShopifySubscriptionSuspensionInitiator b : ShopifySubscriptionSuspensionInitiator.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionState.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionState.java new file mode 100644 index 0000000..aa3dd68 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionState.java @@ -0,0 +1,66 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionSuspensionState { + + ACTIVE("ACTIVE"), + + ENDED("ENDED"); + + private String value; + + ShopifySubscriptionSuspensionState(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionSuspensionState fromValue(String text) { + for (ShopifySubscriptionSuspensionState b : ShopifySubscriptionSuspensionState.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionType.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionType.java new file mode 100644 index 0000000..1b7e0a2 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionSuspensionType.java @@ -0,0 +1,66 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionSuspensionType { + + REACTIVATE("REACTIVATE"), + + TERMINATE("TERMINATE"); + + private String value; + + ShopifySubscriptionSuspensionType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionSuspensionType fromValue(String text) { + for (ShopifySubscriptionSuspensionType b : ShopifySubscriptionSuspensionType.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionUpdateAddressesRequest.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionUpdateAddressesRequest.java new file mode 100644 index 0000000..0a562d8 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionUpdateAddressesRequest.java @@ -0,0 +1,155 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionAddressCreate; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionUpdateAddressesRequest { + + @JsonProperty("billingAddress") + protected ShopifySubscriptionAddressCreate billingAddress = null; + + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("shippingAddress") + protected ShopifySubscriptionAddressCreate shippingAddress = null; + + + + public ShopifySubscriptionUpdateAddressesRequest billingAddress(ShopifySubscriptionAddressCreate billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + /** + * + * @return billingAddress + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionAddressCreate getBillingAddress() { + return billingAddress; + } + + public void setBillingAddress(ShopifySubscriptionAddressCreate billingAddress) { + this.billingAddress = billingAddress; + } + + + public ShopifySubscriptionUpdateAddressesRequest id(Long id) { + this.id = id; + return this; + } + + /** + * + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + + public ShopifySubscriptionUpdateAddressesRequest shippingAddress(ShopifySubscriptionAddressCreate shippingAddress) { + this.shippingAddress = shippingAddress; + return this; + } + + /** + * + * @return shippingAddress + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionAddressCreate getShippingAddress() { + return shippingAddress; + } + + public void setShippingAddress(ShopifySubscriptionAddressCreate shippingAddress) { + this.shippingAddress = shippingAddress; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionUpdateAddressesRequest shopifySubscriptionUpdateAddressesRequest = (ShopifySubscriptionUpdateAddressesRequest) o; + return Objects.equals(this.billingAddress, shopifySubscriptionUpdateAddressesRequest.billingAddress) && + Objects.equals(this.id, shopifySubscriptionUpdateAddressesRequest.id) && + Objects.equals(this.shippingAddress, shopifySubscriptionUpdateAddressesRequest.shippingAddress); + } + + @Override + public int hashCode() { + return Objects.hash(billingAddress, id, shippingAddress); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionUpdateAddressesRequest {\n"); + + sb.append(" billingAddress: ").append(toIndentedString(billingAddress)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionUpdateRequest.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionUpdateRequest.java new file mode 100644 index 0000000..90423c0 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionUpdateRequest.java @@ -0,0 +1,216 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionModelBillingConfiguration; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionModelItem; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionUpdateRequest { + + @JsonProperty("billingConfiguration") + protected ShopifySubscriptionModelBillingConfiguration billingConfiguration = null; + + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("items") + protected List items = null; + + + @JsonProperty("storeOrderConfirmationEmailEnabled") + protected Boolean storeOrderConfirmationEmailEnabled = null; + + + @JsonProperty("subscriberSuspensionAllowed") + protected Boolean subscriberSuspensionAllowed = null; + + + + public ShopifySubscriptionUpdateRequest billingConfiguration(ShopifySubscriptionModelBillingConfiguration billingConfiguration) { + this.billingConfiguration = billingConfiguration; + return this; + } + + /** + * + * @return billingConfiguration + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionModelBillingConfiguration getBillingConfiguration() { + return billingConfiguration; + } + + public void setBillingConfiguration(ShopifySubscriptionModelBillingConfiguration billingConfiguration) { + this.billingConfiguration = billingConfiguration; + } + + + public ShopifySubscriptionUpdateRequest id(Long id) { + this.id = id; + return this; + } + + /** + * + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + + public ShopifySubscriptionUpdateRequest items(List items) { + this.items = items; + return this; + } + + public ShopifySubscriptionUpdateRequest addItemsItem(ShopifySubscriptionModelItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * + * @return items + **/ + @ApiModelProperty(value = "") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + public ShopifySubscriptionUpdateRequest storeOrderConfirmationEmailEnabled(Boolean storeOrderConfirmationEmailEnabled) { + this.storeOrderConfirmationEmailEnabled = storeOrderConfirmationEmailEnabled; + return this; + } + + /** + * + * @return storeOrderConfirmationEmailEnabled + **/ + @ApiModelProperty(value = "") + public Boolean isStoreOrderConfirmationEmailEnabled() { + return storeOrderConfirmationEmailEnabled; + } + + public void setStoreOrderConfirmationEmailEnabled(Boolean storeOrderConfirmationEmailEnabled) { + this.storeOrderConfirmationEmailEnabled = storeOrderConfirmationEmailEnabled; + } + + + public ShopifySubscriptionUpdateRequest subscriberSuspensionAllowed(Boolean subscriberSuspensionAllowed) { + this.subscriberSuspensionAllowed = subscriberSuspensionAllowed; + return this; + } + + /** + * + * @return subscriberSuspensionAllowed + **/ + @ApiModelProperty(value = "") + public Boolean isSubscriberSuspensionAllowed() { + return subscriberSuspensionAllowed; + } + + public void setSubscriberSuspensionAllowed(Boolean subscriberSuspensionAllowed) { + this.subscriberSuspensionAllowed = subscriberSuspensionAllowed; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionUpdateRequest shopifySubscriptionUpdateRequest = (ShopifySubscriptionUpdateRequest) o; + return Objects.equals(this.billingConfiguration, shopifySubscriptionUpdateRequest.billingConfiguration) && + Objects.equals(this.id, shopifySubscriptionUpdateRequest.id) && + Objects.equals(this.items, shopifySubscriptionUpdateRequest.items) && + Objects.equals(this.storeOrderConfirmationEmailEnabled, shopifySubscriptionUpdateRequest.storeOrderConfirmationEmailEnabled) && + Objects.equals(this.subscriberSuspensionAllowed, shopifySubscriptionUpdateRequest.subscriberSuspensionAllowed); + } + + @Override + public int hashCode() { + return Objects.hash(billingConfiguration, id, items, storeOrderConfirmationEmailEnabled, subscriberSuspensionAllowed); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionUpdateRequest {\n"); + + sb.append(" billingConfiguration: ").append(toIndentedString(billingConfiguration)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" storeOrderConfirmationEmailEnabled: ").append(toIndentedString(storeOrderConfirmationEmailEnabled)).append("\n"); + sb.append(" subscriberSuspensionAllowed: ").append(toIndentedString(subscriberSuspensionAllowed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersion.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersion.java new file mode 100644 index 0000000..9a010a9 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersion.java @@ -0,0 +1,536 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscription; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionAddress; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionBillingIntervalUnit; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionVersionItem; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionVersionState; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionWeekday; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionVersion { + + @JsonProperty("billingAddress") + protected ShopifySubscriptionAddress billingAddress = null; + + + @JsonProperty("billingDayOfMonth") + protected Integer billingDayOfMonth = null; + + + @JsonProperty("billingIntervalAmount") + protected Integer billingIntervalAmount = null; + + + @JsonProperty("billingIntervalUnit") + protected ShopifySubscriptionBillingIntervalUnit billingIntervalUnit = null; + + + @JsonProperty("billingReferenceDate") + protected OffsetDateTime billingReferenceDate = null; + + + @JsonProperty("billingWeekday") + protected ShopifySubscriptionWeekday billingWeekday = null; + + + @JsonProperty("createdBy") + protected Long createdBy = null; + + + @JsonProperty("createdOn") + protected OffsetDateTime createdOn = null; + + + @JsonProperty("currency") + protected String currency = null; + + + @JsonProperty("dischargedBy") + protected Long dischargedBy = null; + + + @JsonProperty("dischargedOn") + protected OffsetDateTime dischargedOn = null; + + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("items") + protected List items = null; + + + @JsonProperty("linkedSpaceId") + protected Long linkedSpaceId = null; + + + @JsonProperty("maximalBillingCycles") + protected Integer maximalBillingCycles = null; + + + @JsonProperty("maximalSuspendableCycles") + protected Integer maximalSuspendableCycles = null; + + + @JsonProperty("minimalBillingCycles") + protected Integer minimalBillingCycles = null; + + + @JsonProperty("paymentGateway") + protected String paymentGateway = null; + + + @JsonProperty("shippingAddress") + protected ShopifySubscriptionAddress shippingAddress = null; + + + @JsonProperty("shippingRate") + protected String shippingRate = null; + + + @JsonProperty("shop") + protected Long shop = null; + + + @JsonProperty("state") + protected ShopifySubscriptionVersionState state = null; + + + @JsonProperty("storeOrderConfirmationEmailEnabled") + protected Boolean storeOrderConfirmationEmailEnabled = null; + + + @JsonProperty("subscriberSuspensionAllowed") + protected Boolean subscriberSuspensionAllowed = null; + + + @JsonProperty("subscription") + protected ShopifySubscription subscription = null; + + + @JsonProperty("terminationBillingCycles") + protected Integer terminationBillingCycles = null; + + + @JsonProperty("token") + protected Long token = null; + + + @JsonProperty("version") + protected Integer version = null; + + + + /** + * + * @return billingAddress + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionAddress getBillingAddress() { + return billingAddress; + } + + + /** + * + * @return billingDayOfMonth + **/ + @ApiModelProperty(value = "") + public Integer getBillingDayOfMonth() { + return billingDayOfMonth; + } + + + /** + * + * @return billingIntervalAmount + **/ + @ApiModelProperty(value = "") + public Integer getBillingIntervalAmount() { + return billingIntervalAmount; + } + + + /** + * + * @return billingIntervalUnit + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionBillingIntervalUnit getBillingIntervalUnit() { + return billingIntervalUnit; + } + + + /** + * + * @return billingReferenceDate + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getBillingReferenceDate() { + return billingReferenceDate; + } + + + /** + * + * @return billingWeekday + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionWeekday getBillingWeekday() { + return billingWeekday; + } + + + /** + * + * @return createdBy + **/ + @ApiModelProperty(value = "") + public Long getCreatedBy() { + return createdBy; + } + + + /** + * + * @return createdOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getCreatedOn() { + return createdOn; + } + + + /** + * + * @return currency + **/ + @ApiModelProperty(value = "") + public String getCurrency() { + return currency; + } + + + /** + * + * @return dischargedBy + **/ + @ApiModelProperty(value = "") + public Long getDischargedBy() { + return dischargedBy; + } + + + /** + * + * @return dischargedOn + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getDischargedOn() { + return dischargedOn; + } + + + /** + * The ID is the primary key of the entity. The ID identifies the entity uniquely. + * @return id + **/ + @ApiModelProperty(value = "The ID is the primary key of the entity. The ID identifies the entity uniquely.") + public Long getId() { + return id; + } + + + /** + * + * @return items + **/ + @ApiModelProperty(value = "") + public List getItems() { + return items; + } + + + /** + * The linked space id holds the ID of the space to which the entity belongs to. + * @return linkedSpaceId + **/ + @ApiModelProperty(value = "The linked space id holds the ID of the space to which the entity belongs to.") + public Long getLinkedSpaceId() { + return linkedSpaceId; + } + + + /** + * + * @return maximalBillingCycles + **/ + @ApiModelProperty(value = "") + public Integer getMaximalBillingCycles() { + return maximalBillingCycles; + } + + + /** + * + * @return maximalSuspendableCycles + **/ + @ApiModelProperty(value = "") + public Integer getMaximalSuspendableCycles() { + return maximalSuspendableCycles; + } + + + /** + * + * @return minimalBillingCycles + **/ + @ApiModelProperty(value = "") + public Integer getMinimalBillingCycles() { + return minimalBillingCycles; + } + + + /** + * + * @return paymentGateway + **/ + @ApiModelProperty(value = "") + public String getPaymentGateway() { + return paymentGateway; + } + + + /** + * + * @return shippingAddress + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionAddress getShippingAddress() { + return shippingAddress; + } + + + /** + * + * @return shippingRate + **/ + @ApiModelProperty(value = "") + public String getShippingRate() { + return shippingRate; + } + + + /** + * + * @return shop + **/ + @ApiModelProperty(value = "") + public Long getShop() { + return shop; + } + + + /** + * + * @return state + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionVersionState getState() { + return state; + } + + + /** + * + * @return storeOrderConfirmationEmailEnabled + **/ + @ApiModelProperty(value = "") + public Boolean isStoreOrderConfirmationEmailEnabled() { + return storeOrderConfirmationEmailEnabled; + } + + + /** + * + * @return subscriberSuspensionAllowed + **/ + @ApiModelProperty(value = "") + public Boolean isSubscriberSuspensionAllowed() { + return subscriberSuspensionAllowed; + } + + + /** + * + * @return subscription + **/ + @ApiModelProperty(value = "") + public ShopifySubscription getSubscription() { + return subscription; + } + + + /** + * + * @return terminationBillingCycles + **/ + @ApiModelProperty(value = "") + public Integer getTerminationBillingCycles() { + return terminationBillingCycles; + } + + + /** + * + * @return token + **/ + @ApiModelProperty(value = "") + public Long getToken() { + return token; + } + + + /** + * The version number indicates the version of the entity. The version is incremented whenever the entity is changed. + * @return version + **/ + @ApiModelProperty(value = "The version number indicates the version of the entity. The version is incremented whenever the entity is changed.") + public Integer getVersion() { + return version; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionVersion shopifySubscriptionVersion = (ShopifySubscriptionVersion) o; + return Objects.equals(this.billingAddress, shopifySubscriptionVersion.billingAddress) && + Objects.equals(this.billingDayOfMonth, shopifySubscriptionVersion.billingDayOfMonth) && + Objects.equals(this.billingIntervalAmount, shopifySubscriptionVersion.billingIntervalAmount) && + Objects.equals(this.billingIntervalUnit, shopifySubscriptionVersion.billingIntervalUnit) && + Objects.equals(this.billingReferenceDate, shopifySubscriptionVersion.billingReferenceDate) && + Objects.equals(this.billingWeekday, shopifySubscriptionVersion.billingWeekday) && + Objects.equals(this.createdBy, shopifySubscriptionVersion.createdBy) && + Objects.equals(this.createdOn, shopifySubscriptionVersion.createdOn) && + Objects.equals(this.currency, shopifySubscriptionVersion.currency) && + Objects.equals(this.dischargedBy, shopifySubscriptionVersion.dischargedBy) && + Objects.equals(this.dischargedOn, shopifySubscriptionVersion.dischargedOn) && + Objects.equals(this.id, shopifySubscriptionVersion.id) && + Objects.equals(this.items, shopifySubscriptionVersion.items) && + Objects.equals(this.linkedSpaceId, shopifySubscriptionVersion.linkedSpaceId) && + Objects.equals(this.maximalBillingCycles, shopifySubscriptionVersion.maximalBillingCycles) && + Objects.equals(this.maximalSuspendableCycles, shopifySubscriptionVersion.maximalSuspendableCycles) && + Objects.equals(this.minimalBillingCycles, shopifySubscriptionVersion.minimalBillingCycles) && + Objects.equals(this.paymentGateway, shopifySubscriptionVersion.paymentGateway) && + Objects.equals(this.shippingAddress, shopifySubscriptionVersion.shippingAddress) && + Objects.equals(this.shippingRate, shopifySubscriptionVersion.shippingRate) && + Objects.equals(this.shop, shopifySubscriptionVersion.shop) && + Objects.equals(this.state, shopifySubscriptionVersion.state) && + Objects.equals(this.storeOrderConfirmationEmailEnabled, shopifySubscriptionVersion.storeOrderConfirmationEmailEnabled) && + Objects.equals(this.subscriberSuspensionAllowed, shopifySubscriptionVersion.subscriberSuspensionAllowed) && + Objects.equals(this.subscription, shopifySubscriptionVersion.subscription) && + Objects.equals(this.terminationBillingCycles, shopifySubscriptionVersion.terminationBillingCycles) && + Objects.equals(this.token, shopifySubscriptionVersion.token) && + Objects.equals(this.version, shopifySubscriptionVersion.version); + } + + @Override + public int hashCode() { + return Objects.hash(billingAddress, billingDayOfMonth, billingIntervalAmount, billingIntervalUnit, billingReferenceDate, billingWeekday, createdBy, createdOn, currency, dischargedBy, dischargedOn, id, items, linkedSpaceId, maximalBillingCycles, maximalSuspendableCycles, minimalBillingCycles, paymentGateway, shippingAddress, shippingRate, shop, state, storeOrderConfirmationEmailEnabled, subscriberSuspensionAllowed, subscription, terminationBillingCycles, token, version); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionVersion {\n"); + + sb.append(" billingAddress: ").append(toIndentedString(billingAddress)).append("\n"); + sb.append(" billingDayOfMonth: ").append(toIndentedString(billingDayOfMonth)).append("\n"); + sb.append(" billingIntervalAmount: ").append(toIndentedString(billingIntervalAmount)).append("\n"); + sb.append(" billingIntervalUnit: ").append(toIndentedString(billingIntervalUnit)).append("\n"); + sb.append(" billingReferenceDate: ").append(toIndentedString(billingReferenceDate)).append("\n"); + sb.append(" billingWeekday: ").append(toIndentedString(billingWeekday)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" createdOn: ").append(toIndentedString(createdOn)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" dischargedBy: ").append(toIndentedString(dischargedBy)).append("\n"); + sb.append(" dischargedOn: ").append(toIndentedString(dischargedOn)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" linkedSpaceId: ").append(toIndentedString(linkedSpaceId)).append("\n"); + sb.append(" maximalBillingCycles: ").append(toIndentedString(maximalBillingCycles)).append("\n"); + sb.append(" maximalSuspendableCycles: ").append(toIndentedString(maximalSuspendableCycles)).append("\n"); + sb.append(" minimalBillingCycles: ").append(toIndentedString(minimalBillingCycles)).append("\n"); + sb.append(" paymentGateway: ").append(toIndentedString(paymentGateway)).append("\n"); + sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n"); + sb.append(" shippingRate: ").append(toIndentedString(shippingRate)).append("\n"); + sb.append(" shop: ").append(toIndentedString(shop)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" storeOrderConfirmationEmailEnabled: ").append(toIndentedString(storeOrderConfirmationEmailEnabled)).append("\n"); + sb.append(" subscriberSuspensionAllowed: ").append(toIndentedString(subscriberSuspensionAllowed)).append("\n"); + sb.append(" subscription: ").append(toIndentedString(subscription)).append("\n"); + sb.append(" terminationBillingCycles: ").append(toIndentedString(terminationBillingCycles)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersionItem.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersionItem.java new file mode 100644 index 0000000..4bc20b2 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersionItem.java @@ -0,0 +1,164 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionVersionItemPriceStrategy; +import com.postfinancecheckout.sdk.model.ShopifyTaxLine; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifySubscriptionVersionItem { + + @JsonProperty("priceIncludingTax") + protected BigDecimal priceIncludingTax = null; + + + @JsonProperty("priceStrategy") + protected ShopifySubscriptionVersionItemPriceStrategy priceStrategy = null; + + + @JsonProperty("product") + protected Long product = null; + + + @JsonProperty("quantity") + protected BigDecimal quantity = null; + + + @JsonProperty("taxLines") + protected List taxLines = null; + + + + /** + * + * @return priceIncludingTax + **/ + @ApiModelProperty(value = "") + public BigDecimal getPriceIncludingTax() { + return priceIncludingTax; + } + + + /** + * + * @return priceStrategy + **/ + @ApiModelProperty(value = "") + public ShopifySubscriptionVersionItemPriceStrategy getPriceStrategy() { + return priceStrategy; + } + + + /** + * + * @return product + **/ + @ApiModelProperty(value = "") + public Long getProduct() { + return product; + } + + + /** + * + * @return quantity + **/ + @ApiModelProperty(value = "") + public BigDecimal getQuantity() { + return quantity; + } + + + /** + * + * @return taxLines + **/ + @ApiModelProperty(value = "") + public List getTaxLines() { + return taxLines; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifySubscriptionVersionItem shopifySubscriptionVersionItem = (ShopifySubscriptionVersionItem) o; + return Objects.equals(this.priceIncludingTax, shopifySubscriptionVersionItem.priceIncludingTax) && + Objects.equals(this.priceStrategy, shopifySubscriptionVersionItem.priceStrategy) && + Objects.equals(this.product, shopifySubscriptionVersionItem.product) && + Objects.equals(this.quantity, shopifySubscriptionVersionItem.quantity) && + Objects.equals(this.taxLines, shopifySubscriptionVersionItem.taxLines); + } + + @Override + public int hashCode() { + return Objects.hash(priceIncludingTax, priceStrategy, product, quantity, taxLines); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifySubscriptionVersionItem {\n"); + + sb.append(" priceIncludingTax: ").append(toIndentedString(priceIncludingTax)).append("\n"); + sb.append(" priceStrategy: ").append(toIndentedString(priceStrategy)).append("\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" taxLines: ").append(toIndentedString(taxLines)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersionItemPriceStrategy.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersionItemPriceStrategy.java new file mode 100644 index 0000000..2ef39c5 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersionItemPriceStrategy.java @@ -0,0 +1,66 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionVersionItemPriceStrategy { + + INITIALLY_CALCULATED("INITIALLY_CALCULATED"), + + RECALCULATE("RECALCULATE"); + + private String value; + + ShopifySubscriptionVersionItemPriceStrategy(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionVersionItemPriceStrategy fromValue(String text) { + for (ShopifySubscriptionVersionItemPriceStrategy b : ShopifySubscriptionVersionItemPriceStrategy.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersionState.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersionState.java new file mode 100644 index 0000000..f978bbf --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionVersionState.java @@ -0,0 +1,68 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionVersionState { + + CREATE("CREATE"), + + ACTIVE("ACTIVE"), + + DISCHARGED("DISCHARGED"); + + private String value; + + ShopifySubscriptionVersionState(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionVersionState fromValue(String text) { + for (ShopifySubscriptionVersionState b : ShopifySubscriptionVersionState.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionWeekday.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionWeekday.java new file mode 100644 index 0000000..0337259 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifySubscriptionWeekday.java @@ -0,0 +1,76 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum ShopifySubscriptionWeekday { + + MONDAY("MONDAY"), + + TUESDAY("TUESDAY"), + + WEDNESDAY("WEDNESDAY"), + + THURSDAY("THURSDAY"), + + FRIDAY("FRIDAY"), + + SATURDAY("SATURDAY"), + + SUNDAY("SUNDAY"); + + private String value; + + ShopifySubscriptionWeekday(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ShopifySubscriptionWeekday fromValue(String text) { + for (ShopifySubscriptionWeekday b : ShopifySubscriptionWeekday.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/ShopifyTaxLine.java b/src/main/java/com/postfinancecheckout/sdk/model/ShopifyTaxLine.java new file mode 100644 index 0000000..3146db6 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/ShopifyTaxLine.java @@ -0,0 +1,160 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * + */ +@ApiModel(description = "") + +public class ShopifyTaxLine { + + @JsonProperty("fractionRate") + protected BigDecimal fractionRate = null; + + + @JsonProperty("id") + protected Long id = null; + + + @JsonProperty("rate") + protected BigDecimal rate = null; + + + @JsonProperty("title") + protected String title = null; + + + @JsonProperty("version") + protected Integer version = null; + + + + /** + * + * @return fractionRate + **/ + @ApiModelProperty(value = "") + public BigDecimal getFractionRate() { + return fractionRate; + } + + + /** + * The ID is the primary key of the entity. The ID identifies the entity uniquely. + * @return id + **/ + @ApiModelProperty(value = "The ID is the primary key of the entity. The ID identifies the entity uniquely.") + public Long getId() { + return id; + } + + + /** + * + * @return rate + **/ + @ApiModelProperty(value = "") + public BigDecimal getRate() { + return rate; + } + + + /** + * + * @return title + **/ + @ApiModelProperty(value = "") + public String getTitle() { + return title; + } + + + /** + * The version number indicates the version of the entity. The version is incremented whenever the entity is changed. + * @return version + **/ + @ApiModelProperty(value = "The version number indicates the version of the entity. The version is incremented whenever the entity is changed.") + public Integer getVersion() { + return version; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShopifyTaxLine shopifyTaxLine = (ShopifyTaxLine) o; + return Objects.equals(this.fractionRate, shopifyTaxLine.fractionRate) && + Objects.equals(this.id, shopifyTaxLine.id) && + Objects.equals(this.rate, shopifyTaxLine.rate) && + Objects.equals(this.title, shopifyTaxLine.title) && + Objects.equals(this.version, shopifyTaxLine.version); + } + + @Override + public int hashCode() { + return Objects.hash(fractionRate, id, rate, title, version); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShopifyTaxLine {\n"); + + sb.append(" fractionRate: ").append(toIndentedString(fractionRate)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" rate: ").append(toIndentedString(rate)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/TerminalReceiptFetchRequest.java b/src/main/java/com/postfinancecheckout/sdk/model/TerminalReceiptFetchRequest.java new file mode 100644 index 0000000..e41f396 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/TerminalReceiptFetchRequest.java @@ -0,0 +1,155 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.postfinancecheckout.sdk.model.TerminalReceiptFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.*; +import java.time.OffsetDateTime; + +/** + * The receipt fetch request allows to retrieve the receipt documents for a terminal transaction. + */ +@ApiModel(description = "The receipt fetch request allows to retrieve the receipt documents for a terminal transaction.") + +public class TerminalReceiptFetchRequest { + + @JsonProperty("format") + protected TerminalReceiptFormat format = null; + + + @JsonProperty("transaction") + protected Long transaction = null; + + + @JsonProperty("width") + protected Integer width = null; + + + + public TerminalReceiptFetchRequest format(TerminalReceiptFormat format) { + this.format = format; + return this; + } + + /** + * The format determines in what format the receipts will be returned in. + * @return format + **/ + @ApiModelProperty(required = true, value = "The format determines in what format the receipts will be returned in.") + public TerminalReceiptFormat getFormat() { + return format; + } + + public void setFormat(TerminalReceiptFormat format) { + this.format = format; + } + + + public TerminalReceiptFetchRequest transaction(Long transaction) { + this.transaction = transaction; + return this; + } + + /** + * Provide here the ID of the transaction for which the receipts should be fetched. + * @return transaction + **/ + @ApiModelProperty(required = true, value = "Provide here the ID of the transaction for which the receipts should be fetched.") + public Long getTransaction() { + return transaction; + } + + public void setTransaction(Long transaction) { + this.transaction = transaction; + } + + + public TerminalReceiptFetchRequest width(Integer width) { + this.width = width; + return this; + } + + /** + * The width controls how width the document will be rendered. In case of the PDF format the width is in mm. In case of the text format the width is in the number of chars per line. + * @return width + **/ + @ApiModelProperty(value = "The width controls how width the document will be rendered. In case of the PDF format the width is in mm. In case of the text format the width is in the number of chars per line.") + public Integer getWidth() { + return width; + } + + public void setWidth(Integer width) { + this.width = width; + } + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerminalReceiptFetchRequest terminalReceiptFetchRequest = (TerminalReceiptFetchRequest) o; + return Objects.equals(this.format, terminalReceiptFetchRequest.format) && + Objects.equals(this.transaction, terminalReceiptFetchRequest.transaction) && + Objects.equals(this.width, terminalReceiptFetchRequest.width); + } + + @Override + public int hashCode() { + return Objects.hash(format, transaction, width); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerminalReceiptFetchRequest {\n"); + + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append(" width: ").append(toIndentedString(width)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/model/TerminalReceiptFormat.java b/src/main/java/com/postfinancecheckout/sdk/model/TerminalReceiptFormat.java new file mode 100644 index 0000000..4469dda --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/model/TerminalReceiptFormat.java @@ -0,0 +1,66 @@ +/** +* PostFinance Checkout SDK +* +* This library allows to interact with the PostFinance Checkout payment service. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +package com.postfinancecheckout.sdk.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import java.util.*; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * + */ +public enum TerminalReceiptFormat { + + PDF("PDF"), + + TXT("TXT"); + + private String value; + + TerminalReceiptFormat(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TerminalReceiptFormat fromValue(String text) { + for (TerminalReceiptFormat b : TerminalReceiptFormat.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/src/main/java/com/postfinancecheckout/sdk/service/PaymentTerminalService.java b/src/main/java/com/postfinancecheckout/sdk/service/PaymentTerminalService.java new file mode 100644 index 0000000..487f99d --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/service/PaymentTerminalService.java @@ -0,0 +1,473 @@ +package com.postfinancecheckout.sdk.service; + +import com.postfinancecheckout.sdk.ApiClient; + +import com.postfinancecheckout.sdk.model.ClientError; +import com.postfinancecheckout.sdk.model.EntityQuery; +import com.postfinancecheckout.sdk.model.EntityQueryFilter; +import com.postfinancecheckout.sdk.model.PaymentTerminal; +import com.postfinancecheckout.sdk.model.ServerError; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.*; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + + +public class PaymentTerminalService { + private ApiClient apiClient; + + public PaymentTerminalService(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param filter The filter which restricts the entities which are used to calculate the count. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(Long spaceId, EntityQueryFilter filter) throws IOException { + HttpResponse response = countForHttpResponse(spaceId, filter); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + HttpResponse response = countForHttpResponse(filter, spaceId, params); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse countForHttpResponse(Long spaceId, EntityQueryFilter filter) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(Long spaceId, java.io.InputStream filter, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = filter == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal/count"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the payment terminal which should be returned. + * @return PaymentTerminal + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public PaymentTerminal read(Long spaceId, Long id) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id); + String returnType = "PaymentTerminal"; + if(returnType.equals("String")){ + return (PaymentTerminal) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (PaymentTerminal)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the payment terminal which should be returned. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return PaymentTerminal + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public PaymentTerminal read(Long spaceId, Long id, Map params) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id, params); + String returnType = "PaymentTerminal"; + if(returnType.equals("String")){ + return (PaymentTerminal) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (PaymentTerminal)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal/read"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (id != null) { + String key = "id"; + Object value = id; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal/read"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'id' to the map of query params + allParams.put("id", id); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the payment terminals which are returned by the search. + * @return List<PaymentTerminal> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query); + String returnType = "List<PaymentTerminal>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the payment terminals which are returned by the search. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return List<PaymentTerminal> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query, Map params) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query, params); + String returnType = "List<PaymentTerminal>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = query == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal/search"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + +} diff --git a/src/main/java/com/postfinancecheckout/sdk/service/PaymentTerminalTillService.java b/src/main/java/com/postfinancecheckout/sdk/service/PaymentTerminalTillService.java new file mode 100644 index 0000000..7c54d35 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/service/PaymentTerminalTillService.java @@ -0,0 +1,375 @@ +package com.postfinancecheckout.sdk.service; + +import com.postfinancecheckout.sdk.ApiClient; + +import com.postfinancecheckout.sdk.model.ClientError; +import com.postfinancecheckout.sdk.model.ServerError; +import com.postfinancecheckout.sdk.model.Transaction; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.*; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + + +public class PaymentTerminalTillService { + private ApiClient apiClient; + + public PaymentTerminalTillService(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Perform Payment Terminal Transaction + * Starts a payment terminal transaction and waits for its completion. If the call returns with a long polling timeout status, you may try again. The processing of the transaction will be picked up where it was left off. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + *

543 - This status code indicates that the long polling request timed out. + * @param spaceId + * @param transactionId The ID of the transaction which is used to process with the terminal. + * @param terminalId The ID of the terminal which should be used to process the transaction. + * @param language The language in which the messages should be rendered in. + * @return Transaction + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Perform Payment Terminal Transaction Documentation + + **/ + public Transaction performTransaction(Long spaceId, Long transactionId, Long terminalId, String language) throws IOException { + HttpResponse response = performTransactionForHttpResponse(spaceId, transactionId, terminalId, language); + String returnType = "Transaction"; + if(returnType.equals("String")){ + return (Transaction) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Perform Payment Terminal Transaction + * Starts a payment terminal transaction and waits for its completion. If the call returns with a long polling timeout status, you may try again. The processing of the transaction will be picked up where it was left off. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + *

543 - This status code indicates that the long polling request timed out. + * @param spaceId + * @param transactionId The ID of the transaction which is used to process with the terminal. + * @param terminalId The ID of the terminal which should be used to process the transaction. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Transaction + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Perform Payment Terminal Transaction Documentation + + **/ + public Transaction performTransaction(Long spaceId, Long transactionId, Long terminalId, Map params) throws IOException { + HttpResponse response = performTransactionForHttpResponse(spaceId, transactionId, terminalId, params); + String returnType = "Transaction"; + if(returnType.equals("String")){ + return (Transaction) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse performTransactionForHttpResponse(Long spaceId, Long transactionId, Long terminalId, String language) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling performTransaction"); + }// verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling performTransaction"); + }// verify the required parameter 'terminalId' is set + if (terminalId == null) { + throw new IllegalArgumentException("Missing the required parameter 'terminalId' when calling performTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal-till/perform-transaction"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (transactionId != null) { + String key = "transactionId"; + Object value = transactionId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (terminalId != null) { + String key = "terminalId"; + Object value = terminalId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (language != null) { + String key = "language"; + Object value = language; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("application/json;charset=utf-8"); + httpRequest.setReadTimeout(90 * 1000); + + return httpRequest.execute(); + } + + public HttpResponse performTransactionForHttpResponse(Long spaceId, Long transactionId, Long terminalId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling performTransaction"); + }// verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling performTransaction"); + }// verify the required parameter 'terminalId' is set + if (terminalId == null) { + throw new IllegalArgumentException("Missing the required parameter 'terminalId' when calling performTransaction"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal-till/perform-transaction"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'transactionId' to the map of query params + allParams.put("transactionId", transactionId); + // Add the required query param 'terminalId' to the map of query params + allParams.put("terminalId", terminalId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("application/json;charset=utf-8"); + httpRequest.setReadTimeout(90 * 1000); + + return httpRequest.execute(); + } + + /** + * Perform Payment Terminal Transaction (using TID) + * Starts a payment terminal transaction and waits for its completion. If the call returns with a long polling timeout status, you may try again. The processing of the transaction will be picked up where it was left off. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + *

543 - This status code indicates that the long polling request timed out. + * @param spaceId + * @param transactionId The ID of the transaction which is used to process with the terminal. + * @param terminalIdentifier The identifier (aka TID) of the terminal which should be used to process the transaction. + * @param language The language in which the messages should be rendered in. + * @return Transaction + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Perform Payment Terminal Transaction (using TID) Documentation + + **/ + public Transaction performTransactionByIdentifier(Long spaceId, Long transactionId, String terminalIdentifier, String language) throws IOException { + HttpResponse response = performTransactionByIdentifierForHttpResponse(spaceId, transactionId, terminalIdentifier, language); + String returnType = "Transaction"; + if(returnType.equals("String")){ + return (Transaction) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Perform Payment Terminal Transaction (using TID) + * Starts a payment terminal transaction and waits for its completion. If the call returns with a long polling timeout status, you may try again. The processing of the transaction will be picked up where it was left off. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + *

543 - This status code indicates that the long polling request timed out. + * @param spaceId + * @param transactionId The ID of the transaction which is used to process with the terminal. + * @param terminalIdentifier The identifier (aka TID) of the terminal which should be used to process the transaction. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Transaction + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Perform Payment Terminal Transaction (using TID) Documentation + + **/ + public Transaction performTransactionByIdentifier(Long spaceId, Long transactionId, String terminalIdentifier, Map params) throws IOException { + HttpResponse response = performTransactionByIdentifierForHttpResponse(spaceId, transactionId, terminalIdentifier, params); + String returnType = "Transaction"; + if(returnType.equals("String")){ + return (Transaction) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse performTransactionByIdentifierForHttpResponse(Long spaceId, Long transactionId, String terminalIdentifier, String language) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling performTransactionByIdentifier"); + }// verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling performTransactionByIdentifier"); + }// verify the required parameter 'terminalIdentifier' is set + if (terminalIdentifier == null) { + throw new IllegalArgumentException("Missing the required parameter 'terminalIdentifier' when calling performTransactionByIdentifier"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal-till/perform-transaction-by-identifier"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (transactionId != null) { + String key = "transactionId"; + Object value = transactionId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (terminalIdentifier != null) { + String key = "terminalIdentifier"; + Object value = terminalIdentifier; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (language != null) { + String key = "language"; + Object value = language; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("application/json;charset=utf-8"); + httpRequest.setReadTimeout(90 * 1000); + + return httpRequest.execute(); + } + + public HttpResponse performTransactionByIdentifierForHttpResponse(Long spaceId, Long transactionId, String terminalIdentifier, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling performTransactionByIdentifier"); + }// verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling performTransactionByIdentifier"); + }// verify the required parameter 'terminalIdentifier' is set + if (terminalIdentifier == null) { + throw new IllegalArgumentException("Missing the required parameter 'terminalIdentifier' when calling performTransactionByIdentifier"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal-till/perform-transaction-by-identifier"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'transactionId' to the map of query params + allParams.put("transactionId", transactionId); + // Add the required query param 'terminalIdentifier' to the map of query params + allParams.put("terminalIdentifier", terminalIdentifier); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("application/json;charset=utf-8"); + httpRequest.setReadTimeout(90 * 1000); + + return httpRequest.execute(); + } + +} diff --git a/src/main/java/com/postfinancecheckout/sdk/service/ShopifyRecurringOrderService.java b/src/main/java/com/postfinancecheckout/sdk/service/ShopifyRecurringOrderService.java new file mode 100644 index 0000000..c619b83 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/service/ShopifyRecurringOrderService.java @@ -0,0 +1,613 @@ +package com.postfinancecheckout.sdk.service; + +import com.postfinancecheckout.sdk.ApiClient; + +import com.postfinancecheckout.sdk.model.ClientError; +import com.postfinancecheckout.sdk.model.EntityQuery; +import com.postfinancecheckout.sdk.model.EntityQueryFilter; +import com.postfinancecheckout.sdk.model.ServerError; +import com.postfinancecheckout.sdk.model.ShopifyRecurringOrder; +import com.postfinancecheckout.sdk.model.ShopifyRecurringOrderUpdateRequest; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.*; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + + +public class ShopifyRecurringOrderService { + private ApiClient apiClient; + + public ShopifyRecurringOrderService(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param filter The filter which restricts the entities which are used to calculate the count. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(Long spaceId, EntityQueryFilter filter) throws IOException { + HttpResponse response = countForHttpResponse(spaceId, filter); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + HttpResponse response = countForHttpResponse(filter, spaceId, params); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse countForHttpResponse(Long spaceId, EntityQueryFilter filter) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(Long spaceId, java.io.InputStream filter, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = filter == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/count"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify recurring order which should be returned. + * @return ShopifyRecurringOrder + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifyRecurringOrder read(Long spaceId, Long id) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id); + String returnType = "ShopifyRecurringOrder"; + if(returnType.equals("String")){ + return (ShopifyRecurringOrder) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifyRecurringOrder)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify recurring order which should be returned. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifyRecurringOrder + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifyRecurringOrder read(Long spaceId, Long id, Map params) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id, params); + String returnType = "ShopifyRecurringOrder"; + if(returnType.equals("String")){ + return (ShopifyRecurringOrder) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifyRecurringOrder)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/read"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (id != null) { + String key = "id"; + Object value = id; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/read"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'id' to the map of query params + allParams.put("id", id); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify recurring orders which are returned by the search. + * @return List<ShopifyRecurringOrder> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query); + String returnType = "List<ShopifyRecurringOrder>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify recurring orders which are returned by the search. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return List<ShopifyRecurringOrder> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query, Map params) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query, params); + String returnType = "List<ShopifyRecurringOrder>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = query == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/search"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Update + * This operation allows to update a Shopify recurring order. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param updateRequest + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Documentation + + **/ + public void update(Long spaceId, ShopifyRecurringOrderUpdateRequest updateRequest) throws IOException { + updateForHttpResponse(spaceId, updateRequest); + } + + /** + * Update + * This operation allows to update a Shopify recurring order. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param updateRequest + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Documentation + + **/ + public void update(Long spaceId, ShopifyRecurringOrderUpdateRequest updateRequest, Map params) throws IOException { + updateForHttpResponse(spaceId, updateRequest, params); + } + + public HttpResponse updateForHttpResponse(Long spaceId, ShopifyRecurringOrderUpdateRequest updateRequest) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'updateRequest' is set + if (updateRequest == null) { + throw new IllegalArgumentException("Missing the required parameter 'updateRequest' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/update"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(updateRequest); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateForHttpResponse(Long spaceId, java.io.InputStream updateRequest, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'updateRequest' is set + if (updateRequest == null) { + throw new IllegalArgumentException("Missing the required parameter 'updateRequest' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/update"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = updateRequest == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, updateRequest); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateForHttpResponse(Long spaceId, ShopifyRecurringOrderUpdateRequest updateRequest, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'updateRequest' is set + if (updateRequest == null) { + throw new IllegalArgumentException("Missing the required parameter 'updateRequest' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-recurring-order/update"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(updateRequest); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + +} diff --git a/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriberService.java b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriberService.java new file mode 100644 index 0000000..146ea92 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriberService.java @@ -0,0 +1,631 @@ +package com.postfinancecheckout.sdk.service; + +import com.postfinancecheckout.sdk.ApiClient; + +import com.postfinancecheckout.sdk.model.ClientError; +import com.postfinancecheckout.sdk.model.EntityQuery; +import com.postfinancecheckout.sdk.model.EntityQueryFilter; +import com.postfinancecheckout.sdk.model.ServerError; +import com.postfinancecheckout.sdk.model.ShopifySubscriber; +import com.postfinancecheckout.sdk.model.ShopifySubscriberActive; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.*; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + + +public class ShopifySubscriberService { + private ApiClient apiClient; + + public ShopifySubscriberService(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param filter The filter which restricts the entities which are used to calculate the count. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(Long spaceId, EntityQueryFilter filter) throws IOException { + HttpResponse response = countForHttpResponse(spaceId, filter); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + HttpResponse response = countForHttpResponse(filter, spaceId, params); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse countForHttpResponse(Long spaceId, EntityQueryFilter filter) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(Long spaceId, java.io.InputStream filter, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = filter == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/count"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscriber which should be returned. + * @return ShopifySubscriber + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscriber read(Long spaceId, Long id) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id); + String returnType = "ShopifySubscriber"; + if(returnType.equals("String")){ + return (ShopifySubscriber) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriber)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscriber which should be returned. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriber + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscriber read(Long spaceId, Long id, Map params) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id, params); + String returnType = "ShopifySubscriber"; + if(returnType.equals("String")){ + return (ShopifySubscriber) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriber)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/read"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (id != null) { + String key = "id"; + Object value = id; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/read"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'id' to the map of query params + allParams.put("id", id); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscribers which are returned by the search. + * @return List<ShopifySubscriber> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query); + String returnType = "List<ShopifySubscriber>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscribers which are returned by the search. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return List<ShopifySubscriber> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query, Map params) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query, params); + String returnType = "List<ShopifySubscriber>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = query == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/search"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Update + * This updates the entity with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the entity. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The Shopify subscriber object with all the properties which should be updated. The id and the version are required properties. + * @return ShopifySubscriber + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Documentation + + **/ + public ShopifySubscriber update(Long spaceId, ShopifySubscriberActive query) throws IOException { + HttpResponse response = updateForHttpResponse(spaceId, query); + String returnType = "ShopifySubscriber"; + if(returnType.equals("String")){ + return (ShopifySubscriber) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriber)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Update + * This updates the entity with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the entity. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The Shopify subscriber object with all the properties which should be updated. The id and the version are required properties. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriber + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Documentation + + **/ + public ShopifySubscriber update(Long spaceId, ShopifySubscriberActive query, Map params) throws IOException { + HttpResponse response = updateForHttpResponse(spaceId, query, params); + String returnType = "ShopifySubscriber"; + if(returnType.equals("String")){ + return (ShopifySubscriber) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriber)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateForHttpResponse(Long spaceId, ShopifySubscriberActive query) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/update"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/update"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = query == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateForHttpResponse(Long spaceId, ShopifySubscriberActive query, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscriber/update"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + +} diff --git a/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionProductService.java b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionProductService.java new file mode 100644 index 0000000..f8cf1fe --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionProductService.java @@ -0,0 +1,787 @@ +package com.postfinancecheckout.sdk.service; + +import com.postfinancecheckout.sdk.ApiClient; + +import com.postfinancecheckout.sdk.model.ClientError; +import com.postfinancecheckout.sdk.model.EntityQuery; +import com.postfinancecheckout.sdk.model.EntityQueryFilter; +import com.postfinancecheckout.sdk.model.ServerError; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionProduct; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionProductCreate; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionProductUpdate; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.*; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + + +public class ShopifySubscriptionProductService { + private ApiClient apiClient; + + public ShopifySubscriptionProductService(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param filter The filter which restricts the entities which are used to calculate the count. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(Long spaceId, EntityQueryFilter filter) throws IOException { + HttpResponse response = countForHttpResponse(spaceId, filter); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + HttpResponse response = countForHttpResponse(filter, spaceId, params); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse countForHttpResponse(Long spaceId, EntityQueryFilter filter) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(Long spaceId, java.io.InputStream filter, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = filter == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/count"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Create + * Creates the entity with the given properties. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param entity The Shopify subscription product object with the properties which should be created. + * @return ShopifySubscriptionProduct + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Create Documentation + + **/ + public ShopifySubscriptionProduct create(Long spaceId, ShopifySubscriptionProductCreate entity) throws IOException { + HttpResponse response = createForHttpResponse(spaceId, entity); + String returnType = "ShopifySubscriptionProduct"; + if(returnType.equals("String")){ + return (ShopifySubscriptionProduct) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionProduct)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Create + * Creates the entity with the given properties. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param entity The Shopify subscription product object with the properties which should be created. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriptionProduct + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Create Documentation + + **/ + public ShopifySubscriptionProduct create(Long spaceId, ShopifySubscriptionProductCreate entity, Map params) throws IOException { + HttpResponse response = createForHttpResponse(spaceId, entity, params); + String returnType = "ShopifySubscriptionProduct"; + if(returnType.equals("String")){ + return (ShopifySubscriptionProduct) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionProduct)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createForHttpResponse(Long spaceId, ShopifySubscriptionProductCreate entity) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create"); + }// verify the required parameter 'entity' is set + if (entity == null) { + throw new IllegalArgumentException("Missing the required parameter 'entity' when calling create"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/create"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(entity); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse createForHttpResponse(Long spaceId, java.io.InputStream entity, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create"); + }// verify the required parameter 'entity' is set + if (entity == null) { + throw new IllegalArgumentException("Missing the required parameter 'entity' when calling create"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/create"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = entity == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, entity); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse createForHttpResponse(Long spaceId, ShopifySubscriptionProductCreate entity, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create"); + }// verify the required parameter 'entity' is set + if (entity == null) { + throw new IllegalArgumentException("Missing the required parameter 'entity' when calling create"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/create"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(entity); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscription product which should be returned. + * @return ShopifySubscriptionProduct + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscriptionProduct read(Long spaceId, Long id) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id); + String returnType = "ShopifySubscriptionProduct"; + if(returnType.equals("String")){ + return (ShopifySubscriptionProduct) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionProduct)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscription product which should be returned. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriptionProduct + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscriptionProduct read(Long spaceId, Long id, Map params) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id, params); + String returnType = "ShopifySubscriptionProduct"; + if(returnType.equals("String")){ + return (ShopifySubscriptionProduct) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionProduct)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/read"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (id != null) { + String key = "id"; + Object value = id; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/read"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'id' to the map of query params + allParams.put("id", id); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscription products which are returned by the search. + * @return List<ShopifySubscriptionProduct> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query); + String returnType = "List<ShopifySubscriptionProduct>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscription products which are returned by the search. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return List<ShopifySubscriptionProduct> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query, Map params) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query, params); + String returnType = "List<ShopifySubscriptionProduct>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = query == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/search"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Update + * This updates the entity with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the entity. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param entity The Shopify subscription product object with all the properties which should be updated. The id and the version are required properties. + * @return ShopifySubscriptionProduct + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Documentation + + **/ + public ShopifySubscriptionProduct update(Long spaceId, ShopifySubscriptionProductUpdate entity) throws IOException { + HttpResponse response = updateForHttpResponse(spaceId, entity); + String returnType = "ShopifySubscriptionProduct"; + if(returnType.equals("String")){ + return (ShopifySubscriptionProduct) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionProduct)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Update + * This updates the entity with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the entity. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param entity The Shopify subscription product object with all the properties which should be updated. The id and the version are required properties. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriptionProduct + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Documentation + + **/ + public ShopifySubscriptionProduct update(Long spaceId, ShopifySubscriptionProductUpdate entity, Map params) throws IOException { + HttpResponse response = updateForHttpResponse(spaceId, entity, params); + String returnType = "ShopifySubscriptionProduct"; + if(returnType.equals("String")){ + return (ShopifySubscriptionProduct) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionProduct)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateForHttpResponse(Long spaceId, ShopifySubscriptionProductUpdate entity) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'entity' is set + if (entity == null) { + throw new IllegalArgumentException("Missing the required parameter 'entity' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/update"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(entity); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateForHttpResponse(Long spaceId, java.io.InputStream entity, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'entity' is set + if (entity == null) { + throw new IllegalArgumentException("Missing the required parameter 'entity' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/update"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = entity == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, entity); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateForHttpResponse(Long spaceId, ShopifySubscriptionProductUpdate entity, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'entity' is set + if (entity == null) { + throw new IllegalArgumentException("Missing the required parameter 'entity' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-product/update"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(entity); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + +} diff --git a/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionService.java b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionService.java new file mode 100644 index 0000000..9111527 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionService.java @@ -0,0 +1,1080 @@ +package com.postfinancecheckout.sdk.service; + +import com.postfinancecheckout.sdk.ApiClient; + +import com.postfinancecheckout.sdk.model.ClientError; +import com.postfinancecheckout.sdk.model.EntityQuery; +import com.postfinancecheckout.sdk.model.EntityQueryFilter; +import com.postfinancecheckout.sdk.model.ServerError; +import com.postfinancecheckout.sdk.model.ShopifySubscription; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionCreationRequest; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionUpdateAddressesRequest; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionUpdateRequest; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionVersion; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.*; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + + +public class ShopifySubscriptionService { + private ApiClient apiClient; + + public ShopifySubscriptionService(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param filter The filter which restricts the entities which are used to calculate the count. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(Long spaceId, EntityQueryFilter filter) throws IOException { + HttpResponse response = countForHttpResponse(spaceId, filter); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + HttpResponse response = countForHttpResponse(filter, spaceId, params); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse countForHttpResponse(Long spaceId, EntityQueryFilter filter) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(Long spaceId, java.io.InputStream filter, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = filter == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/count"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Create + * This operation allows to create a Shopify subscription. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param creationRequest + * @return ShopifySubscriptionVersion + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Create Documentation + + **/ + public ShopifySubscriptionVersion create(Long spaceId, ShopifySubscriptionCreationRequest creationRequest) throws IOException { + HttpResponse response = createForHttpResponse(spaceId, creationRequest); + String returnType = "ShopifySubscriptionVersion"; + if(returnType.equals("String")){ + return (ShopifySubscriptionVersion) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Create + * This operation allows to create a Shopify subscription. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param creationRequest + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriptionVersion + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Create Documentation + + **/ + public ShopifySubscriptionVersion create(Long spaceId, ShopifySubscriptionCreationRequest creationRequest, Map params) throws IOException { + HttpResponse response = createForHttpResponse(spaceId, creationRequest, params); + String returnType = "ShopifySubscriptionVersion"; + if(returnType.equals("String")){ + return (ShopifySubscriptionVersion) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse createForHttpResponse(Long spaceId, ShopifySubscriptionCreationRequest creationRequest) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create"); + }// verify the required parameter 'creationRequest' is set + if (creationRequest == null) { + throw new IllegalArgumentException("Missing the required parameter 'creationRequest' when calling create"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/create"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creationRequest); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse createForHttpResponse(Long spaceId, java.io.InputStream creationRequest, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create"); + }// verify the required parameter 'creationRequest' is set + if (creationRequest == null) { + throw new IllegalArgumentException("Missing the required parameter 'creationRequest' when calling create"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/create"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = creationRequest == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, creationRequest); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse createForHttpResponse(Long spaceId, ShopifySubscriptionCreationRequest creationRequest, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create"); + }// verify the required parameter 'creationRequest' is set + if (creationRequest == null) { + throw new IllegalArgumentException("Missing the required parameter 'creationRequest' when calling create"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/create"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(creationRequest); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscription which should be returned. + * @return ShopifySubscription + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscription read(Long spaceId, Long id) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id); + String returnType = "ShopifySubscription"; + if(returnType.equals("String")){ + return (ShopifySubscription) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscription)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscription which should be returned. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscription + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscription read(Long spaceId, Long id, Map params) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id, params); + String returnType = "ShopifySubscription"; + if(returnType.equals("String")){ + return (ShopifySubscription) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscription)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/read"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (id != null) { + String key = "id"; + Object value = id; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/read"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'id' to the map of query params + allParams.put("id", id); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscriptions which are returned by the search. + * @return List<ShopifySubscription> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query); + String returnType = "List<ShopifySubscription>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscriptions which are returned by the search. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return List<ShopifySubscription> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query, Map params) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query, params); + String returnType = "List<ShopifySubscription>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = query == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/search"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Terminate + * This operation allows to terminate a Shopify subscription. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param subscriptionId The ID identifies the Shopify subscription which should be terminated. + * @param respectTerminationPeriod The respect termination period controls whether the termination period configured on the product version should be respected or if the operation should take effect immediately. + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Terminate Documentation + + **/ + public void terminate(Long spaceId, Long subscriptionId, Boolean respectTerminationPeriod) throws IOException { + terminateForHttpResponse(spaceId, subscriptionId, respectTerminationPeriod); + } + + /** + * Terminate + * This operation allows to terminate a Shopify subscription. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param subscriptionId The ID identifies the Shopify subscription which should be terminated. + * @param respectTerminationPeriod The respect termination period controls whether the termination period configured on the product version should be respected or if the operation should take effect immediately. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Terminate Documentation + + **/ + public void terminate(Long spaceId, Long subscriptionId, Boolean respectTerminationPeriod, Map params) throws IOException { + terminateForHttpResponse(spaceId, subscriptionId, respectTerminationPeriod, params); + } + + public HttpResponse terminateForHttpResponse(Long spaceId, Long subscriptionId, Boolean respectTerminationPeriod) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling terminate"); + }// verify the required parameter 'subscriptionId' is set + if (subscriptionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'subscriptionId' when calling terminate"); + }// verify the required parameter 'respectTerminationPeriod' is set + if (respectTerminationPeriod == null) { + throw new IllegalArgumentException("Missing the required parameter 'respectTerminationPeriod' when calling terminate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/terminate"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (subscriptionId != null) { + String key = "subscriptionId"; + Object value = subscriptionId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (respectTerminationPeriod != null) { + String key = "respectTerminationPeriod"; + Object value = respectTerminationPeriod; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(null); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse terminateForHttpResponse(Long spaceId, Long subscriptionId, Boolean respectTerminationPeriod, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling terminate"); + }// verify the required parameter 'subscriptionId' is set + if (subscriptionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'subscriptionId' when calling terminate"); + }// verify the required parameter 'respectTerminationPeriod' is set + if (respectTerminationPeriod == null) { + throw new IllegalArgumentException("Missing the required parameter 'respectTerminationPeriod' when calling terminate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/terminate"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'subscriptionId' to the map of query params + allParams.put("subscriptionId", subscriptionId); + // Add the required query param 'respectTerminationPeriod' to the map of query params + allParams.put("respectTerminationPeriod", respectTerminationPeriod); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(null); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Update + * This operation allows to update a Shopify subscription. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param subscription + * @return ShopifySubscriptionVersion + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Documentation + + **/ + public ShopifySubscriptionVersion update(Long spaceId, ShopifySubscriptionUpdateRequest subscription) throws IOException { + HttpResponse response = updateForHttpResponse(spaceId, subscription); + String returnType = "ShopifySubscriptionVersion"; + if(returnType.equals("String")){ + return (ShopifySubscriptionVersion) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Update + * This operation allows to update a Shopify subscription. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param subscription + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriptionVersion + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Documentation + + **/ + public ShopifySubscriptionVersion update(Long spaceId, ShopifySubscriptionUpdateRequest subscription, Map params) throws IOException { + HttpResponse response = updateForHttpResponse(spaceId, subscription, params); + String returnType = "ShopifySubscriptionVersion"; + if(returnType.equals("String")){ + return (ShopifySubscriptionVersion) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateForHttpResponse(Long spaceId, ShopifySubscriptionUpdateRequest subscription) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'subscription' is set + if (subscription == null) { + throw new IllegalArgumentException("Missing the required parameter 'subscription' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/update"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(subscription); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateForHttpResponse(Long spaceId, java.io.InputStream subscription, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'subscription' is set + if (subscription == null) { + throw new IllegalArgumentException("Missing the required parameter 'subscription' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/update"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = subscription == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, subscription); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateForHttpResponse(Long spaceId, ShopifySubscriptionUpdateRequest subscription, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update"); + }// verify the required parameter 'subscription' is set + if (subscription == null) { + throw new IllegalArgumentException("Missing the required parameter 'subscription' when calling update"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/update"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(subscription); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Update Addresses + * This operation allows to update a Shopify subscription addresses. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param updateRequest + * @return ShopifySubscriptionVersion + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Addresses Documentation + + **/ + public ShopifySubscriptionVersion updateAddresses(Long spaceId, ShopifySubscriptionUpdateAddressesRequest updateRequest) throws IOException { + HttpResponse response = updateAddressesForHttpResponse(spaceId, updateRequest); + String returnType = "ShopifySubscriptionVersion"; + if(returnType.equals("String")){ + return (ShopifySubscriptionVersion) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Update Addresses + * This operation allows to update a Shopify subscription addresses. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param updateRequest + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriptionVersion + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Update Addresses Documentation + + **/ + public ShopifySubscriptionVersion updateAddresses(Long spaceId, ShopifySubscriptionUpdateAddressesRequest updateRequest, Map params) throws IOException { + HttpResponse response = updateAddressesForHttpResponse(spaceId, updateRequest, params); + String returnType = "ShopifySubscriptionVersion"; + if(returnType.equals("String")){ + return (ShopifySubscriptionVersion) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse updateAddressesForHttpResponse(Long spaceId, ShopifySubscriptionUpdateAddressesRequest updateRequest) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling updateAddresses"); + }// verify the required parameter 'updateRequest' is set + if (updateRequest == null) { + throw new IllegalArgumentException("Missing the required parameter 'updateRequest' when calling updateAddresses"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/update-addresses"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(updateRequest); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateAddressesForHttpResponse(Long spaceId, java.io.InputStream updateRequest, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling updateAddresses"); + }// verify the required parameter 'updateRequest' is set + if (updateRequest == null) { + throw new IllegalArgumentException("Missing the required parameter 'updateRequest' when calling updateAddresses"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/update-addresses"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = updateRequest == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, updateRequest); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse updateAddressesForHttpResponse(Long spaceId, ShopifySubscriptionUpdateAddressesRequest updateRequest, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling updateAddresses"); + }// verify the required parameter 'updateRequest' is set + if (updateRequest == null) { + throw new IllegalArgumentException("Missing the required parameter 'updateRequest' when calling updateAddresses"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription/update-addresses"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(updateRequest); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + +} diff --git a/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionSuspensionService.java b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionSuspensionService.java new file mode 100644 index 0000000..e289a2a --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionSuspensionService.java @@ -0,0 +1,747 @@ +package com.postfinancecheckout.sdk.service; + +import com.postfinancecheckout.sdk.ApiClient; + +import com.postfinancecheckout.sdk.model.ClientError; +import com.postfinancecheckout.sdk.model.EntityQuery; +import com.postfinancecheckout.sdk.model.EntityQueryFilter; +import com.postfinancecheckout.sdk.model.ServerError; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionSuspension; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionSuspensionCreate; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.*; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + + +public class ShopifySubscriptionSuspensionService { + private ApiClient apiClient; + + public ShopifySubscriptionSuspensionService(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param filter The filter which restricts the entities which are used to calculate the count. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(Long spaceId, EntityQueryFilter filter) throws IOException { + HttpResponse response = countForHttpResponse(spaceId, filter); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + HttpResponse response = countForHttpResponse(filter, spaceId, params); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse countForHttpResponse(Long spaceId, EntityQueryFilter filter) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(Long spaceId, java.io.InputStream filter, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = filter == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/count"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Reactivate + * This operation allows to reactivate a suspended Shopify subscription. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param subscriptionId The ID identifies the suspended Shopify subscription which should be reactivated. + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Reactivate Documentation + + **/ + public void reactivate(Long spaceId, Long subscriptionId) throws IOException { + reactivateForHttpResponse(spaceId, subscriptionId); + } + + /** + * Reactivate + * This operation allows to reactivate a suspended Shopify subscription. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param subscriptionId The ID identifies the suspended Shopify subscription which should be reactivated. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Reactivate Documentation + + **/ + public void reactivate(Long spaceId, Long subscriptionId, Map params) throws IOException { + reactivateForHttpResponse(spaceId, subscriptionId, params); + } + + public HttpResponse reactivateForHttpResponse(Long spaceId, Long subscriptionId) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling reactivate"); + }// verify the required parameter 'subscriptionId' is set + if (subscriptionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'subscriptionId' when calling reactivate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/reactivate"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (subscriptionId != null) { + String key = "subscriptionId"; + Object value = subscriptionId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(null); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse reactivateForHttpResponse(Long spaceId, Long subscriptionId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling reactivate"); + }// verify the required parameter 'subscriptionId' is set + if (subscriptionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'subscriptionId' when calling reactivate"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/reactivate"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'subscriptionId' to the map of query params + allParams.put("subscriptionId", subscriptionId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(null); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscription suspension which should be returned. + * @return ShopifySubscriptionSuspension + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscriptionSuspension read(Long spaceId, Long id) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id); + String returnType = "ShopifySubscriptionSuspension"; + if(returnType.equals("String")){ + return (ShopifySubscriptionSuspension) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionSuspension)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscription suspension which should be returned. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriptionSuspension + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscriptionSuspension read(Long spaceId, Long id, Map params) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id, params); + String returnType = "ShopifySubscriptionSuspension"; + if(returnType.equals("String")){ + return (ShopifySubscriptionSuspension) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionSuspension)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/read"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (id != null) { + String key = "id"; + Object value = id; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/read"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'id' to the map of query params + allParams.put("id", id); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscription suspensions which are returned by the search. + * @return List<ShopifySubscriptionSuspension> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query); + String returnType = "List<ShopifySubscriptionSuspension>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscription suspensions which are returned by the search. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return List<ShopifySubscriptionSuspension> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query, Map params) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query, params); + String returnType = "List<ShopifySubscriptionSuspension>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = query == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/search"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Suspend + * This operation allows to suspend a Shopify subscription. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param suspension + * @return ShopifySubscriptionSuspension + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Suspend Documentation + + **/ + public ShopifySubscriptionSuspension suspend(Long spaceId, ShopifySubscriptionSuspensionCreate suspension) throws IOException { + HttpResponse response = suspendForHttpResponse(spaceId, suspension); + String returnType = "ShopifySubscriptionSuspension"; + if(returnType.equals("String")){ + return (ShopifySubscriptionSuspension) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionSuspension)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Suspend + * This operation allows to suspend a Shopify subscription. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param suspension + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriptionSuspension + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Suspend Documentation + + **/ + public ShopifySubscriptionSuspension suspend(Long spaceId, ShopifySubscriptionSuspensionCreate suspension, Map params) throws IOException { + HttpResponse response = suspendForHttpResponse(spaceId, suspension, params); + String returnType = "ShopifySubscriptionSuspension"; + if(returnType.equals("String")){ + return (ShopifySubscriptionSuspension) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionSuspension)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse suspendForHttpResponse(Long spaceId, ShopifySubscriptionSuspensionCreate suspension) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling suspend"); + }// verify the required parameter 'suspension' is set + if (suspension == null) { + throw new IllegalArgumentException("Missing the required parameter 'suspension' when calling suspend"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/suspend"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(suspension); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse suspendForHttpResponse(Long spaceId, java.io.InputStream suspension, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling suspend"); + }// verify the required parameter 'suspension' is set + if (suspension == null) { + throw new IllegalArgumentException("Missing the required parameter 'suspension' when calling suspend"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/suspend"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = suspension == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, suspension); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse suspendForHttpResponse(Long spaceId, ShopifySubscriptionSuspensionCreate suspension, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling suspend"); + }// verify the required parameter 'suspension' is set + if (suspension == null) { + throw new IllegalArgumentException("Missing the required parameter 'suspension' when calling suspend"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-suspension/suspend"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(suspension); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + +} diff --git a/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionVersionService.java b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionVersionService.java new file mode 100644 index 0000000..b699bc8 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/service/ShopifySubscriptionVersionService.java @@ -0,0 +1,473 @@ +package com.postfinancecheckout.sdk.service; + +import com.postfinancecheckout.sdk.ApiClient; + +import com.postfinancecheckout.sdk.model.ClientError; +import com.postfinancecheckout.sdk.model.EntityQuery; +import com.postfinancecheckout.sdk.model.EntityQueryFilter; +import com.postfinancecheckout.sdk.model.ServerError; +import com.postfinancecheckout.sdk.model.ShopifySubscriptionVersion; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.*; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + + +public class ShopifySubscriptionVersionService { + private ApiClient apiClient; + + public ShopifySubscriptionVersionService(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param filter The filter which restricts the entities which are used to calculate the count. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(Long spaceId, EntityQueryFilter filter) throws IOException { + HttpResponse response = countForHttpResponse(spaceId, filter); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Count + * Counts the number of items in the database as restricted by the given filter. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Long + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Count Documentation + + **/ + public Long count(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + HttpResponse response = countForHttpResponse(filter, spaceId, params); + String returnType = "Long"; + if(returnType.equals("String")){ + return (Long) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse countForHttpResponse(Long spaceId, EntityQueryFilter filter) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-version/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(Long spaceId, java.io.InputStream filter, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-version/count"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = filter == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse countForHttpResponse(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-version/count"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(filter); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscription version which should be returned. + * @return ShopifySubscriptionVersion + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscriptionVersion read(Long spaceId, Long id) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id); + String returnType = "ShopifySubscriptionVersion"; + if(returnType.equals("String")){ + return (ShopifySubscriptionVersion) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Read + * Reads the entity with the given 'id' and returns it. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param id The id of the Shopify subscription version which should be returned. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return ShopifySubscriptionVersion + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Read Documentation + + **/ + public ShopifySubscriptionVersion read(Long spaceId, Long id, Map params) throws IOException { + HttpResponse response = readForHttpResponse(spaceId, id, params); + String returnType = "ShopifySubscriptionVersion"; + if(returnType.equals("String")){ + return (ShopifySubscriptionVersion) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (ShopifySubscriptionVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-version/read"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (id != null) { + String key = "id"; + Object value = id; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse readForHttpResponse(Long spaceId, Long id, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); + }// verify the required parameter 'id' is set + if (id == null) { + throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-version/read"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'id' to the map of query params + allParams.put("id", id); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("*/*"); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscription versions which are returned by the search. + * @return List<ShopifySubscriptionVersion> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query); + String returnType = "List<ShopifySubscriptionVersion>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Search + * Searches for the entities as specified by the given query. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param query The query restricts the Shopify subscription versions which are returned by the search. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return List<ShopifySubscriptionVersion> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Search Documentation + + **/ + public List search(Long spaceId, EntityQuery query, Map params) throws IOException { + HttpResponse response = searchForHttpResponse(spaceId, query, params); + String returnType = "List<ShopifySubscriptionVersion>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-version/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-version/search"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = query == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/shopify-subscription-version/search"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(query); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + +} diff --git a/src/main/java/com/postfinancecheckout/sdk/service/TransactionTerminalService.java b/src/main/java/com/postfinancecheckout/sdk/service/TransactionTerminalService.java new file mode 100644 index 0000000..11e01a7 --- /dev/null +++ b/src/main/java/com/postfinancecheckout/sdk/service/TransactionTerminalService.java @@ -0,0 +1,358 @@ +package com.postfinancecheckout.sdk.service; + +import com.postfinancecheckout.sdk.ApiClient; + +import com.postfinancecheckout.sdk.model.ClientError; +import com.postfinancecheckout.sdk.model.RenderedTerminalReceipt; +import com.postfinancecheckout.sdk.model.ServerError; +import com.postfinancecheckout.sdk.model.TerminalReceiptFetchRequest; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.api.client.http.*; +import com.google.api.client.json.Json; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; + + +public class TransactionTerminalService { + private ApiClient apiClient; + + public TransactionTerminalService(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Fetch Receipts + * Returns all receipts for the requested terminal transaction. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param request + * @return List<RenderedTerminalReceipt> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Fetch Receipts Documentation + + **/ + public List fetchReceipts(Long spaceId, TerminalReceiptFetchRequest request) throws IOException { + HttpResponse response = fetchReceiptsForHttpResponse(spaceId, request); + String returnType = "List<RenderedTerminalReceipt>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Fetch Receipts + * Returns all receipts for the requested terminal transaction. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param request + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return List<RenderedTerminalReceipt> + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Fetch Receipts Documentation + + **/ + public List fetchReceipts(Long spaceId, TerminalReceiptFetchRequest request, Map params) throws IOException { + HttpResponse response = fetchReceiptsForHttpResponse(spaceId, request, params); + String returnType = "List<RenderedTerminalReceipt>"; + if(returnType.equals("String")){ + return (List) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference>() {}; + return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse fetchReceiptsForHttpResponse(Long spaceId, TerminalReceiptFetchRequest request) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling fetchReceipts"); + }// verify the required parameter 'request' is set + if (request == null) { + throw new IllegalArgumentException("Missing the required parameter 'request' when calling fetchReceipts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/transaction-terminal/fetch-receipts"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(request); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse fetchReceiptsForHttpResponse(Long spaceId, java.io.InputStream request, String mediaType) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling fetchReceipts"); + }// verify the required parameter 'request' is set + if (request == null) { + throw new IllegalArgumentException("Missing the required parameter 'request' when calling fetchReceipts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/transaction-terminal/fetch-receipts"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = request == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, request); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse fetchReceiptsForHttpResponse(Long spaceId, TerminalReceiptFetchRequest request, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling fetchReceipts"); + }// verify the required parameter 'request' is set + if (request == null) { + throw new IllegalArgumentException("Missing the required parameter 'request' when calling fetchReceipts"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/transaction-terminal/fetch-receipts"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(request); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + /** + * Create Till Connection Credentials + * This operation creates a set of credentials to use within the WebSocket. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param transactionId The ID of the transaction which is used to process with the terminal. + * @param terminalId The ID of the terminal which should be used to process the transaction. + * @param language The language in which the messages should be rendered in. + * @return String + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Create Till Connection Credentials Documentation + + **/ + public String tillConnectionCredentials(Long spaceId, Long transactionId, Long terminalId, String language) throws IOException { + HttpResponse response = tillConnectionCredentialsForHttpResponse(spaceId, transactionId, terminalId, language); + String returnType = "String"; + if(returnType.equals("String")){ + return (String) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (String)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Create Till Connection Credentials + * This operation creates a set of credentials to use within the WebSocket. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + * @param spaceId + * @param transactionId The ID of the transaction which is used to process with the terminal. + * @param terminalId The ID of the terminal which should be used to process the transaction. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return String + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Create Till Connection Credentials Documentation + + **/ + public String tillConnectionCredentials(Long spaceId, Long transactionId, Long terminalId, Map params) throws IOException { + HttpResponse response = tillConnectionCredentialsForHttpResponse(spaceId, transactionId, terminalId, params); + String returnType = "String"; + if(returnType.equals("String")){ + return (String) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (String)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse tillConnectionCredentialsForHttpResponse(Long spaceId, Long transactionId, Long terminalId, String language) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling tillConnectionCredentials"); + }// verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling tillConnectionCredentials"); + }// verify the required parameter 'terminalId' is set + if (terminalId == null) { + throw new IllegalArgumentException("Missing the required parameter 'terminalId' when calling tillConnectionCredentials"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/transaction-terminal/till-connection-credentials"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (transactionId != null) { + String key = "transactionId"; + Object value = transactionId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (terminalId != null) { + String key = "terminalId"; + Object value = terminalId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (language != null) { + String key = "language"; + Object value = language; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(null); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + + public HttpResponse tillConnectionCredentialsForHttpResponse(Long spaceId, Long transactionId, Long terminalId, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling tillConnectionCredentials"); + }// verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling tillConnectionCredentials"); + }// verify the required parameter 'terminalId' is set + if (terminalId == null) { + throw new IllegalArgumentException("Missing the required parameter 'terminalId' when calling tillConnectionCredentials"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/transaction-terminal/till-connection-credentials"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'transactionId' to the map of query params + allParams.put("transactionId", transactionId); + // Add the required query param 'terminalId' to the map of query params + allParams.put("terminalId", terminalId); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(null); + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); + + + httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT); + return httpRequest.execute(); + } + +}