diff --git a/CHANGELOG.md b/CHANGELOG.md index e5d9e61..cdb8b91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.7.0](https://github.com/PAYONE-GmbH/PCP-ServerSDK-java/compare/v1.6.0...v1.7.0) (2026-02-26) + +### Features + +* feat: add fund split property to CapturePaymentRequest ([85b0a3368c7b67418c332580800ff26cfbadb5a5](https://github.com/PAYONE-GmbH/PCP-ServerSDK-java/commit/85b0a3368c7b67418c332580800ff26cfbadb5a5)) +* feat: implement api definition 1.47.0 ([c564ac873cb9b1150e074c44213df077364c9ea9](https://github.com/PAYONE-GmbH/PCP-ServerSDK-java/commit/c564ac873cb9b1150e074c44213df077364c9ea9)) + # [1.6.0](https://github.com/PAYONE-GmbH/PCP-ServerSDK-java/compare/v1.5.0...v1.6.0) (2025-12-09) ### Features diff --git a/README.md b/README.md index d63c530..0c23fd1 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Welcome to the Java SDK for the PAYONE Commerce Platform (api-version 1.40.0)! T ```groovy dependencies { - implementation group: 'io.github.payone-gmbh', name: 'pcp-serversdk-java', version: '1.6.0' + implementation group: 'io.github.payone-gmbh', name: 'pcp-serversdk-java', version: '1.7.0' } ``` diff --git a/api-definition.yaml b/api-definition.yaml index 72f9579..0782114 100644 --- a/api-definition.yaml +++ b/api-definition.yaml @@ -1,7 +1,7 @@ openapi: "3.0.3" info: - version: 1.40.0 + version: 1.48.0 title: "Commerce Platform API" description: | RESTful API for the creation of Commerce Cases with Checkouts and the execution of Payments. @@ -2214,6 +2214,8 @@ components: $ref: '#/components/schemas/PaymentReferences' delivery: $ref: '#/components/schemas/DeliveryInformation' + fundSplit: + $ref: '#/components/schemas/FundSplit' CapturePaymentResponse: type: object additionalProperties: false @@ -2224,6 +2226,8 @@ components: $ref: '#/components/schemas/StatusValue' statusOutput: $ref: '#/components/schemas/PaymentStatusOutput' + fundSplit: + $ref: '#/components/schemas/FundSplit' id: type: string description: Unique payment transaction identifier of the payment gateway. @@ -2452,6 +2456,8 @@ components: $ref: '#/components/schemas/CartItemInvoiceData' orderLineDetails: $ref: '#/components/schemas/OrderLineDetailsInput' + supplierReferences: + $ref: '#/components/schemas/CartItemSupplierReferences' CartItemInvoiceData: type: object description: Object containing the line items of the invoice or shopping cart. @@ -2473,6 +2479,8 @@ components: $ref: '#/components/schemas/CartItemInvoiceData' orderLineDetails: $ref: '#/components/schemas/OrderLineDetailsPatch' + supplierReferences: + $ref: '#/components/schemas/CartItemSupplierReferences' CartItemResult: type: object description: This object contains information of all items in the cart. @@ -2483,6 +2491,8 @@ components: $ref: '#/components/schemas/CartItemInvoiceData' orderLineDetails: $ref: '#/components/schemas/OrderLineDetailsResult' + supplierReferences: + $ref: '#/components/schemas/CartItemSupplierReferences' CartItemStatus: type: string enum: @@ -2492,6 +2502,23 @@ components: - RETURNED - WAITING_FOR_PAYMENT description: Indicates in which status the line item is + CartItemSupplierReferences: + type: object + description: | + This object contains references of the seller of the cart item. + additionalProperties: false + properties: + supplierId: + type: string + description: Unique identifier for the supplier. + maxLength: 64 + example: "5678" + orderReference: + type: string + description: |- + Reference of the order for the supplier. + maxLength: 64 + example: "Order-5678" CheckoutResponse: type: object xml: @@ -2842,6 +2869,8 @@ components: $ref: '#/components/schemas/MerchantAction' payment: $ref: '#/components/schemas/PaymentResponse' + fundSplit: + $ref: '#/components/schemas/FundSplit' paymentExecutionId: description: reference to the paymentExecution. type: string @@ -2944,7 +2973,7 @@ components: properties: acceptHeader: type: string - description: | + description: | The accept-header of the customer client from the HTTP Headers. This field can be mandatory depending on the selected payment method and routing option. maxLength: 2048 @@ -3016,6 +3045,8 @@ components: type: array items: $ref: '#/components/schemas/DeliverItem' + fundSplit: + $ref: '#/components/schemas/FundSplit' DeliverResponse: type: object properties: @@ -3134,6 +3165,75 @@ components: $ref: '#/components/schemas/PaymentProduct3391SpecificOutput' paymentInstructions: $ref: '#/components/schemas/PaymentInstructions' + FundDistribution: + type: object + description: Instructions for distributing funds to multiple sellers or partners in a marketplace context. + additionalProperties: false + properties: + id: + type: string + format: UUID + readOnly: true + accountId: + type: string + description: >- + Unique identifier of the beneficiary (seller/partner/sub-account) to receive funds (e.g., payout account ID). + description: + type: string + description: Human-readable description for reconciliation. Appears on reports. + example: "Commission for order #ORD-2025-0001" + maxLength: 128 + amount: + type: integer + description: Amount in cents and always having 2 decimals, in the currency of the original transaction + format: int64 + maximum: 999999999999 + minimum: 1 + example: 1000 + type: + type: string + format: string + description: Classification or purpose of the fund distribution to the receiving account within a given order. + enum: + - SELLER_REVENUE + - COMMISSION_FEE + - SHIPPING_COSTS + - TAX + - PLATFORM_FEE + - OTHER + merchantReference: + type: string + description: Unique reference of the part of the fund/payment to be distributed that is also returned for reporting and reconciliation purposes. + maxLength: 40 + example: customer-order-1234 + merchantParameters: + type: string + maxLength: 1000 + description: >- + It allows you to store additional parameters for the transaction in JSON format. + This field must not contain any personal data. + example: "{'marketplaceOrderId':'ORD-2025-0001','sellerId':'seller-789'}" + required: + - accountId + - amount + - type + FundSplit: + type: object + description: Instructions for distributing funds to multiple sellers or partners in a marketplace context. + additionalProperties: false + properties: + id: + type: string + format: UUID + readOnly: true + paymentEventId: + type: string + format: UUID + readOnly: true + fundDistributions: + type: array + items: + $ref: '#/components/schemas/FundDistribution' InstallmentOption: type: object properties: @@ -3274,6 +3374,8 @@ components: $ref: '#/components/schemas/MobilePaymentThreeDSecure' paymentProduct302SpecificInput: $ref: '#/components/schemas/PaymentProduct302SpecificInput' + paymentProduct5002SpecificInput: + $ref: '#/components/schemas/PaymentProduct5002SpecificInput' MobilePaymentMethodSpecificOutput: type: object description: Object containing the mobile payment method details. @@ -3297,6 +3399,24 @@ components: network: type: string description: The card network that was used for a mobile payment method operation + MobilePaymentNetwork: + type: string + description: |- + Network/Scheme of the card used for the payment. + * MASTERCARD + * VISA + * AMEX + * GIROCARD + * DISCOVER (not supported yet) + * JCB (not supported yet) + enum: + - MASTERCARD + - VISA + - AMEX + - GIROCARD + - DISCOVER + - JCB + example: MASTERCARD MobilePaymentThreeDSecure: type: object description: |- @@ -3383,7 +3503,7 @@ components: example: 0 taxAmountPerUnit: type: boolean - description: |- + description: |- This field indicates if the `taxAmount` is to be interpreted as the tax amount per unit rather than for the entire line item. This field is included in the response only when `taxAmount` is set; otherwise, it will return as `null`. format: int64 @@ -3481,6 +3601,8 @@ components: $ref: '#/components/schemas/OrderItem' paymentMethodSpecificInput: $ref: '#/components/schemas/PaymentMethodSpecificInput' + fundSplit: + $ref: '#/components/schemas/FundSplit' OrderResponse: type: object description: Object that contains details on the created payment in case one has been created. @@ -3507,6 +3629,7 @@ components: enum: - FULL - PARTIAL + readOnly: true PatchCheckoutRequest: type: object description: | @@ -3604,6 +3727,22 @@ components: example: Customer complained paymentInstructions: $ref: '#/components/schemas/PaymentInstructions' + paymentEventId: + type: string + format: UUID + readOnly: true + creationDateTime: + type: string + format: date-time + readOnly: true + description: |- + The date and time when the payment event was created. + + Format will be in one of the following formats: + * YYYY-MM-DD'T'HH:mm:ss'Z' + * YYYY-MM-DD'T'HH:mm:ss+XX:XX + * YYYY-MM-DD'T'HH:mm:ss-XX:XX + example: 2022-01-01T00:00:00Z PaymentExecution: type: object description: |- @@ -3664,6 +3803,10 @@ components: type: array items: $ref: '#/components/schemas/PaymentEvent' + fundSplits: + type: array + items: + $ref: '#/components/schemas/FundSplit' PaymentExecutionRequest: type: object description: | @@ -3693,6 +3836,8 @@ components: $ref: '#/components/schemas/ShoppingCartInput' paymentReferences: $ref: '#/components/schemas/References' + fundSplit: + $ref: '#/components/schemas/FundSplit' required: - paymentReferences PaymentInformationRefundRequest: @@ -3920,23 +4065,7 @@ components: - MASS_ENABLEMENT example: MASS_ENABLEMENT network: - type: string - description: |- - Network/Scheme of the card used for the payment. - * MASTERCARD - * VISA - * AMEX - * GIROCARD - * DISCOVER (not supported yet) - * JCB (not supported yet) - enum: - - MASTERCARD - - VISA - - AMEX - - GIROCARD - - DISCOVER - - JCB - example: GIROCARD + $ref: '#/components/schemas/MobilePaymentNetwork' token: $ref: '#/components/schemas/ApplePaymentDataTokenInformation' domainName: @@ -3977,6 +4106,22 @@ components: $ref: '#/components/schemas/BankAccountInformation' required: - bankAccountInformation + PaymentProduct5002SpecificInput: + type: object + description: Object containing additional Information needed for Click To Pay processing. + properties: + network: + $ref: '#/components/schemas/MobilePaymentNetwork' + paymentCheckoutData: + type: string + description: |- + JWS Token Value (checkoutResponseSignature) as received in the Checkout Response on Client Side, Base64URL encoded. + example: rhHAQUrR118u[...]cwDw== + srcDpaId: + type: string + description: |- + DPA Identifier provided by PAYONE during client side initialization for the corresponding card type selected by the end consumer in the Click to Pay flow. + maxLength: 64 PaymentProduct771SpecificOutput: type: object description: Output that is SEPA Direct Debit specific (i.e. the used mandate). @@ -4487,6 +4632,8 @@ components: $ref: '#/components/schemas/StatusValue' statusOutput: $ref: '#/components/schemas/PaymentStatusOutput' + fundSplit: + $ref: '#/components/schemas/FundSplit' id: type: string description: Unique payment transaction identifier of the payment gateway. @@ -4505,6 +4652,8 @@ components: $ref: '#/components/schemas/PaymentReferences' return: $ref: '#/components/schemas/ReturnInformation' + fundSplit: + $ref: '#/components/schemas/FundSplit' ReturnInformation: type: object description: |- @@ -4566,6 +4715,8 @@ components: type: array items: $ref: '#/components/schemas/ReturnItem' + fundSplit: + $ref: '#/components/schemas/FundSplit' ReturnResponse: type: object properties: @@ -4831,3 +4982,4 @@ components: - first - subsequent x-enum-to-string: false + \ No newline at end of file diff --git a/lib/build.gradle b/lib/build.gradle index f29ddde..5613969 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -34,7 +34,7 @@ if (JavaVersion.current().majorVersion != '8') { apply plugin: 'org.sonarqube' } -version = '1.6.0' +version = '1.7.0' repositories { mavenCentral() diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/endpoints/CommerceCaseApiClient.java b/lib/src/main/java/com/payone/commerce/platform/lib/endpoints/CommerceCaseApiClient.java index 1e9f0f1..5fb0673 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/endpoints/CommerceCaseApiClient.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/endpoints/CommerceCaseApiClient.java @@ -15,7 +15,7 @@ import com.payone.commerce.platform.lib.models.CommerceCaseResponse; import com.payone.commerce.platform.lib.models.CreateCommerceCaseRequest; import com.payone.commerce.platform.lib.models.CreateCommerceCaseResponse; -import com.payone.commerce.platform.lib.models.Customer; +import com.payone.commerce.platform.lib.models.PatchCommerceCaseRequest; import com.payone.commerce.platform.lib.queries.GetCommerceCasesQuery; import com.payone.commerce.platform.lib.serializer.JsonSerializer; @@ -125,7 +125,7 @@ public List getCommerceCasesRequest(String merchantId, } public void updateCommerceCaseRequest(String merchantId, String commerceCaseId, - Customer payload) throws ApiErrorResponseException, ApiResponseRetrievalException, IOException { + PatchCommerceCaseRequest payload) throws ApiErrorResponseException, ApiResponseRetrievalException, IOException { if (merchantId == null) { throw new IllegalArgumentException(MERCHANT_ID_REQUIRED_ERROR); } @@ -147,7 +147,7 @@ public void updateCommerceCaseRequest(String merchantId, String commerceCaseId, String jsonString = JsonSerializer.serializeToJson(payload); - RequestBody formBody = RequestBody.create("{\"customer\":" + jsonString + "}", JSON); + RequestBody formBody = RequestBody.create(jsonString, JSON); Request request = new Request.Builder() .url(url) diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/CapturePaymentRequest.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/CapturePaymentRequest.java index b9fffab..7eefa2e 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/CapturePaymentRequest.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/CapturePaymentRequest.java @@ -16,7 +16,8 @@ CapturePaymentRequest.JSON_PROPERTY_IS_FINAL, CapturePaymentRequest.JSON_PROPERTY_CANCELLATION_REASON, CapturePaymentRequest.JSON_PROPERTY_REFERENCES, - CapturePaymentRequest.JSON_PROPERTY_DELIVERY + CapturePaymentRequest.JSON_PROPERTY_DELIVERY, + CapturePaymentRequest.JSON_PROPERTY_FUND_SPLIT }) public class CapturePaymentRequest implements Serializable { private static final long serialVersionUID = 1L; @@ -36,6 +37,9 @@ public class CapturePaymentRequest implements Serializable { public static final String JSON_PROPERTY_DELIVERY = "delivery"; private DeliveryInformation delivery; + public static final String JSON_PROPERTY_FUND_SPLIT = "fundSplit"; + private FundSplit fundSplit; + public CapturePaymentRequest() { } @@ -172,6 +176,31 @@ public void setDelivery(DeliveryInformation delivery) { this.delivery = delivery; } + public CapturePaymentRequest fundSplit(FundSplit fundSplit) { + + this.fundSplit = fundSplit; + return this; + } + + /** + * Get fundSplit + * + * @return fundSplit + **/ + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FundSplit getFundSplit() { + return fundSplit; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplit(FundSplit fundSplit) { + this.fundSplit = fundSplit; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -185,12 +214,13 @@ public boolean equals(Object o) { Objects.equals(this.isFinal, capturePaymentRequest.isFinal) && Objects.equals(this.cancellationReason, capturePaymentRequest.cancellationReason) && Objects.equals(this.references, capturePaymentRequest.references) && - Objects.equals(this.delivery, capturePaymentRequest.delivery); + Objects.equals(this.delivery, capturePaymentRequest.delivery) && + Objects.equals(this.fundSplit, capturePaymentRequest.fundSplit); } @Override public int hashCode() { - return Objects.hash(amount, isFinal, cancellationReason, references, delivery); + return Objects.hash(amount, isFinal, cancellationReason, references, delivery, fundSplit); } @Override @@ -202,6 +232,7 @@ public String toString() { sb.append(" cancellationReason: ").append(toIndentedString(cancellationReason)).append("\n"); sb.append(" references: ").append(toIndentedString(references)).append("\n"); sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" fundSplit: ").append(toIndentedString(fundSplit)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/CapturePaymentResponse.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/CapturePaymentResponse.java index 26be001..f16b1c3 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/CapturePaymentResponse.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/CapturePaymentResponse.java @@ -14,7 +14,8 @@ CapturePaymentResponse.JSON_PROPERTY_CAPTURE_OUTPUT, CapturePaymentResponse.JSON_PROPERTY_STATUS, CapturePaymentResponse.JSON_PROPERTY_STATUS_OUTPUT, - CapturePaymentResponse.JSON_PROPERTY_ID + CapturePaymentResponse.JSON_PROPERTY_ID, + CapturePaymentResponse.JSON_PROPERTY_FUND_SPLIT }) public class CapturePaymentResponse implements Serializable { private static final long serialVersionUID = 1L; @@ -31,6 +32,9 @@ public class CapturePaymentResponse implements Serializable { public static final String JSON_PROPERTY_ID = "id"; private String id; + public static final String JSON_PROPERTY_FUND_SPLIT = "fundSplit"; + private FundSplit fundSplit; + public CapturePaymentResponse() { } @@ -134,6 +138,31 @@ public void setId(String id) { this.id = id; } + public CapturePaymentResponse fundSplit(FundSplit fundSplit) { + + this.fundSplit = fundSplit; + return this; + } + + /** + * Get fundSplit + * + * @return fundSplit + **/ + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FundSplit getFundSplit() { + return fundSplit; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplit(FundSplit fundSplit) { + this.fundSplit = fundSplit; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -146,12 +175,13 @@ public boolean equals(Object o) { return Objects.equals(this.captureOutput, capturePaymentResponse.captureOutput) && Objects.equals(this.status, capturePaymentResponse.status) && Objects.equals(this.statusOutput, capturePaymentResponse.statusOutput) && - Objects.equals(this.id, capturePaymentResponse.id); + Objects.equals(this.id, capturePaymentResponse.id) && + Objects.equals(this.fundSplit, capturePaymentResponse.fundSplit); } @Override public int hashCode() { - return Objects.hash(captureOutput, status, statusOutput, id); + return Objects.hash(captureOutput, status, statusOutput, id, fundSplit); } @Override @@ -162,6 +192,7 @@ public String toString() { sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" statusOutput: ").append(toIndentedString(statusOutput)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" fundSplit: ").append(toIndentedString(fundSplit)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/CardPaymentDetails.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/CardPaymentDetails.java index c994005..48b72d9 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/CardPaymentDetails.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/CardPaymentDetails.java @@ -13,7 +13,8 @@ @JsonPropertyOrder({ CardPaymentDetails.JSON_PROPERTY_MASKED_CARD_NUMBER, CardPaymentDetails.JSON_PROPERTY_PAYMENT_PROCESSING_TOKEN, - CardPaymentDetails.JSON_PROPERTY_REPORTING_TOKEN + CardPaymentDetails.JSON_PROPERTY_REPORTING_TOKEN, + CardPaymentDetails.JSON_PROPERTY_CARD_AUTHORIZATION_ID }) public class CardPaymentDetails implements Serializable { private static final long serialVersionUID = 1L; @@ -27,6 +28,9 @@ public class CardPaymentDetails implements Serializable { public static final String JSON_PROPERTY_REPORTING_TOKEN = "reportingToken"; private String reportingToken; + public static final String JSON_PROPERTY_CARD_AUTHORIZATION_ID = "cardAuthorizationId"; + private String cardAuthorizationId; + public CardPaymentDetails() { } @@ -106,6 +110,32 @@ public void setReportingToken(String reportingToken) { this.reportingToken = reportingToken; } + public CardPaymentDetails cardAuthorizationId(String cardAuthorizationId) { + + this.cardAuthorizationId = cardAuthorizationId; + return this; + } + + /** + * Identifier for a successful authorization, reversal or refund. Usually + * provided by the issuer system. Only provided for card payments. + * + * @return cardAuthorizationId + **/ + + @JsonProperty(JSON_PROPERTY_CARD_AUTHORIZATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCardAuthorizationId() { + return cardAuthorizationId; + } + + @JsonProperty(JSON_PROPERTY_CARD_AUTHORIZATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCardAuthorizationId(String cardAuthorizationId) { + this.cardAuthorizationId = cardAuthorizationId; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -117,12 +147,13 @@ public boolean equals(Object o) { CardPaymentDetails cardPaymentDetails = (CardPaymentDetails) o; return Objects.equals(this.maskedCardNumber, cardPaymentDetails.maskedCardNumber) && Objects.equals(this.paymentProcessingToken, cardPaymentDetails.paymentProcessingToken) && - Objects.equals(this.reportingToken, cardPaymentDetails.reportingToken); + Objects.equals(this.reportingToken, cardPaymentDetails.reportingToken) && + Objects.equals(this.cardAuthorizationId, cardPaymentDetails.cardAuthorizationId); } @Override public int hashCode() { - return Objects.hash(maskedCardNumber, paymentProcessingToken, reportingToken); + return Objects.hash(maskedCardNumber, paymentProcessingToken, reportingToken, cardAuthorizationId); } @Override @@ -132,6 +163,7 @@ public String toString() { sb.append(" maskedCardNumber: ").append(toIndentedString(maskedCardNumber)).append("\n"); sb.append(" paymentProcessingToken: ").append(toIndentedString(paymentProcessingToken)).append("\n"); sb.append(" reportingToken: ").append(toIndentedString(reportingToken)).append("\n"); + sb.append(" cardAuthorizationId: ").append(toIndentedString(cardAuthorizationId)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemInput.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemInput.java index eb52214..0f90b67 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemInput.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemInput.java @@ -13,7 +13,8 @@ */ @JsonPropertyOrder({ CartItemInput.JSON_PROPERTY_INVOICE_DATA, - CartItemInput.JSON_PROPERTY_ORDER_LINE_DETAILS + CartItemInput.JSON_PROPERTY_ORDER_LINE_DETAILS, + CartItemInput.JSON_PROPERTY_SUPPLIER_REFERENCES }) public class CartItemInput implements Serializable { private static final long serialVersionUID = 1L; @@ -24,6 +25,9 @@ public class CartItemInput implements Serializable { public static final String JSON_PROPERTY_ORDER_LINE_DETAILS = "orderLineDetails"; private OrderLineDetailsInput orderLineDetails; + public static final String JSON_PROPERTY_SUPPLIER_REFERENCES = "supplierReferences"; + private CartItemSupplierReferences supplierReferences; + public CartItemInput() { } @@ -77,6 +81,31 @@ public void setOrderLineDetails(OrderLineDetailsInput orderLineDetails) { this.orderLineDetails = orderLineDetails; } + public CartItemInput supplierReferences(CartItemSupplierReferences supplierReferences) { + + this.supplierReferences = supplierReferences; + return this; + } + + /** + * Get supplierReferences + * + * @return supplierReferences + **/ + + @JsonProperty(JSON_PROPERTY_SUPPLIER_REFERENCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public CartItemSupplierReferences getSupplierReferences() { + return supplierReferences; + } + + @JsonProperty(JSON_PROPERTY_SUPPLIER_REFERENCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSupplierReferences(CartItemSupplierReferences supplierReferences) { + this.supplierReferences = supplierReferences; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -87,12 +116,13 @@ public boolean equals(Object o) { } CartItemInput cartItemInput = (CartItemInput) o; return Objects.equals(this.invoiceData, cartItemInput.invoiceData) && - Objects.equals(this.orderLineDetails, cartItemInput.orderLineDetails); + Objects.equals(this.orderLineDetails, cartItemInput.orderLineDetails) && + Objects.equals(this.supplierReferences, cartItemInput.supplierReferences); } @Override public int hashCode() { - return Objects.hash(invoiceData, orderLineDetails); + return Objects.hash(invoiceData, orderLineDetails, supplierReferences); } @Override @@ -101,6 +131,7 @@ public String toString() { sb.append("class CartItemInput {\n"); sb.append(" invoiceData: ").append(toIndentedString(invoiceData)).append("\n"); sb.append(" orderLineDetails: ").append(toIndentedString(orderLineDetails)).append("\n"); + sb.append(" supplierReferences: ").append(toIndentedString(supplierReferences)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemPatch.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemPatch.java index 3ca734c..b9bf55b 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemPatch.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemPatch.java @@ -13,7 +13,8 @@ */ @JsonPropertyOrder({ CartItemPatch.JSON_PROPERTY_INVOICE_DATA, - CartItemPatch.JSON_PROPERTY_ORDER_LINE_DETAILS + CartItemPatch.JSON_PROPERTY_ORDER_LINE_DETAILS, + CartItemPatch.JSON_PROPERTY_SUPPLIER_REFERENCES }) public class CartItemPatch implements Serializable { private static final long serialVersionUID = 1L; @@ -24,6 +25,9 @@ public class CartItemPatch implements Serializable { public static final String JSON_PROPERTY_ORDER_LINE_DETAILS = "orderLineDetails"; private OrderLineDetailsPatch orderLineDetails; + public static final String JSON_PROPERTY_SUPPLIER_REFERENCES = "supplierReferences"; + private CartItemSupplierReferences supplierReferences; + public CartItemPatch() { } @@ -77,6 +81,31 @@ public void setOrderLineDetails(OrderLineDetailsPatch orderLineDetails) { this.orderLineDetails = orderLineDetails; } + public CartItemPatch supplierReferences(CartItemSupplierReferences supplierReferences) { + + this.supplierReferences = supplierReferences; + return this; + } + + /** + * Get supplierReferences + * + * @return supplierReferences + **/ + + @JsonProperty(JSON_PROPERTY_SUPPLIER_REFERENCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public CartItemSupplierReferences getSupplierReferences() { + return supplierReferences; + } + + @JsonProperty(JSON_PROPERTY_SUPPLIER_REFERENCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSupplierReferences(CartItemSupplierReferences supplierReferences) { + this.supplierReferences = supplierReferences; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -87,12 +116,13 @@ public boolean equals(Object o) { } CartItemPatch cartItemPatch = (CartItemPatch) o; return Objects.equals(this.invoiceData, cartItemPatch.invoiceData) && - Objects.equals(this.orderLineDetails, cartItemPatch.orderLineDetails); + Objects.equals(this.orderLineDetails, cartItemPatch.orderLineDetails) && + Objects.equals(this.supplierReferences, cartItemPatch.supplierReferences); } @Override public int hashCode() { - return Objects.hash(invoiceData, orderLineDetails); + return Objects.hash(invoiceData, orderLineDetails, supplierReferences); } @Override @@ -101,6 +131,7 @@ public String toString() { sb.append("class CartItemPatch {\n"); sb.append(" invoiceData: ").append(toIndentedString(invoiceData)).append("\n"); sb.append(" orderLineDetails: ").append(toIndentedString(orderLineDetails)).append("\n"); + sb.append(" supplierReferences: ").append(toIndentedString(supplierReferences)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemResult.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemResult.java index 6e5c985..91416e8 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemResult.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemResult.java @@ -13,7 +13,8 @@ */ @JsonPropertyOrder({ CartItemResult.JSON_PROPERTY_INVOICE_DATA, - CartItemResult.JSON_PROPERTY_ORDER_LINE_DETAILS + CartItemResult.JSON_PROPERTY_ORDER_LINE_DETAILS, + CartItemResult.JSON_PROPERTY_SUPPLIER_REFERENCES }) public class CartItemResult implements Serializable { private static final long serialVersionUID = 1L; @@ -24,6 +25,9 @@ public class CartItemResult implements Serializable { public static final String JSON_PROPERTY_ORDER_LINE_DETAILS = "orderLineDetails"; private OrderLineDetailsResult orderLineDetails; + public static final String JSON_PROPERTY_SUPPLIER_REFERENCES = "supplierReferences"; + private CartItemSupplierReferences supplierReferences; + public CartItemResult() { } @@ -77,6 +81,31 @@ public void setOrderLineDetails(OrderLineDetailsResult orderLineDetails) { this.orderLineDetails = orderLineDetails; } + public CartItemResult supplierReferences(CartItemSupplierReferences supplierReferences) { + + this.supplierReferences = supplierReferences; + return this; + } + + /** + * Get supplierReferences + * + * @return supplierReferences + **/ + + @JsonProperty(JSON_PROPERTY_SUPPLIER_REFERENCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public CartItemSupplierReferences getSupplierReferences() { + return supplierReferences; + } + + @JsonProperty(JSON_PROPERTY_SUPPLIER_REFERENCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSupplierReferences(CartItemSupplierReferences supplierReferences) { + this.supplierReferences = supplierReferences; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -87,12 +116,13 @@ public boolean equals(Object o) { } CartItemResult cartItemResult = (CartItemResult) o; return Objects.equals(this.invoiceData, cartItemResult.invoiceData) && - Objects.equals(this.orderLineDetails, cartItemResult.orderLineDetails); + Objects.equals(this.orderLineDetails, cartItemResult.orderLineDetails) && + Objects.equals(this.supplierReferences, cartItemResult.supplierReferences); } @Override public int hashCode() { - return Objects.hash(invoiceData, orderLineDetails); + return Objects.hash(invoiceData, orderLineDetails, supplierReferences); } @Override @@ -101,6 +131,7 @@ public String toString() { sb.append("class CartItemResult {\n"); sb.append(" invoiceData: ").append(toIndentedString(invoiceData)).append("\n"); sb.append(" orderLineDetails: ").append(toIndentedString(orderLineDetails)).append("\n"); + sb.append(" supplierReferences: ").append(toIndentedString(supplierReferences)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemSupplierReferences.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemSupplierReferences.java new file mode 100644 index 0000000..e3857a8 --- /dev/null +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/CartItemSupplierReferences.java @@ -0,0 +1,114 @@ +package com.payone.commerce.platform.lib.models; + +import java.io.Serializable; +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * This object contains references of the seller of the cart item. + */ +@JsonPropertyOrder({ + CartItemSupplierReferences.JSON_PROPERTY_SUPPLIER_ID, + CartItemSupplierReferences.JSON_PROPERTY_ORDER_REFERENCE +}) +public class CartItemSupplierReferences implements Serializable { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_SUPPLIER_ID = "supplierId"; + private String supplierId; + + public static final String JSON_PROPERTY_ORDER_REFERENCE = "orderReference"; + private String orderReference; + + public CartItemSupplierReferences() { + } + + public CartItemSupplierReferences supplierId(String supplierId) { + this.supplierId = supplierId; + return this; + } + + /** + * Unique identifier for the supplier. + * + * @return supplierId + */ + + @JsonProperty(JSON_PROPERTY_SUPPLIER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSupplierId() { + return supplierId; + } + + @JsonProperty(JSON_PROPERTY_SUPPLIER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSupplierId(String supplierId) { + this.supplierId = supplierId; + } + + public CartItemSupplierReferences orderReference(String orderReference) { + this.orderReference = orderReference; + return this; + } + + /** + * Reference of the order for the supplier. + * + * @return orderReference + */ + + @JsonProperty(JSON_PROPERTY_ORDER_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getOrderReference() { + return orderReference; + } + + @JsonProperty(JSON_PROPERTY_ORDER_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOrderReference(String orderReference) { + this.orderReference = orderReference; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CartItemSupplierReferences cartItemSupplierReferences = (CartItemSupplierReferences) o; + return Objects.equals(this.supplierId, cartItemSupplierReferences.supplierId) && + Objects.equals(this.orderReference, cartItemSupplierReferences.orderReference); + } + + @Override + public int hashCode() { + return Objects.hash(supplierId, orderReference); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CartItemSupplierReferences {\n"); + sb.append(" supplierId: ").append(toIndentedString(supplierId)).append("\n"); + sb.append(" orderReference: ").append(toIndentedString(orderReference)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/CreatePaymentResponse.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/CreatePaymentResponse.java index df70dab..eb6863f 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/CreatePaymentResponse.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/CreatePaymentResponse.java @@ -15,7 +15,8 @@ CreatePaymentResponse.JSON_PROPERTY_CREATION_OUTPUT, CreatePaymentResponse.JSON_PROPERTY_MERCHANT_ACTION, CreatePaymentResponse.JSON_PROPERTY_PAYMENT, - CreatePaymentResponse.JSON_PROPERTY_PAYMENT_EXECUTION_ID + CreatePaymentResponse.JSON_PROPERTY_PAYMENT_EXECUTION_ID, + CreatePaymentResponse.JSON_PROPERTY_FUND_SPLIT }) public class CreatePaymentResponse implements Serializable { private static final long serialVersionUID = 1L; @@ -32,6 +33,9 @@ public class CreatePaymentResponse implements Serializable { public static final String JSON_PROPERTY_PAYMENT_EXECUTION_ID = "paymentExecutionId"; private UUID paymentExecutionId; + public static final String JSON_PROPERTY_FUND_SPLIT = "fundSplit"; + private FundSplit fundSplit; + public CreatePaymentResponse() { } @@ -135,6 +139,31 @@ public void setPaymentExecutionId(UUID paymentExecutionId) { this.paymentExecutionId = paymentExecutionId; } + public CreatePaymentResponse fundSplit(FundSplit fundSplit) { + + this.fundSplit = fundSplit; + return this; + } + + /** + * Get fundSplit + * + * @return fundSplit + **/ + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FundSplit getFundSplit() { + return fundSplit; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplit(FundSplit fundSplit) { + this.fundSplit = fundSplit; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -147,12 +176,13 @@ public boolean equals(Object o) { return Objects.equals(this.creationOutput, createPaymentResponse.creationOutput) && Objects.equals(this.merchantAction, createPaymentResponse.merchantAction) && Objects.equals(this.payment, createPaymentResponse.payment) && - Objects.equals(this.paymentExecutionId, createPaymentResponse.paymentExecutionId); + Objects.equals(this.paymentExecutionId, createPaymentResponse.paymentExecutionId) && + Objects.equals(this.fundSplit, createPaymentResponse.fundSplit); } @Override public int hashCode() { - return Objects.hash(creationOutput, merchantAction, payment, paymentExecutionId); + return Objects.hash(creationOutput, merchantAction, payment, paymentExecutionId, fundSplit); } @Override @@ -163,6 +193,7 @@ public String toString() { sb.append(" merchantAction: ").append(toIndentedString(merchantAction)).append("\n"); sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); sb.append(" paymentExecutionId: ").append(toIndentedString(paymentExecutionId)).append("\n"); + sb.append(" fundSplit: ").append(toIndentedString(fundSplit)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/DeliverRequest.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/DeliverRequest.java index 5f43732..8904f6e 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/DeliverRequest.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/DeliverRequest.java @@ -25,7 +25,8 @@ DeliverRequest.JSON_PROPERTY_DELIVER_TYPE, DeliverRequest.JSON_PROPERTY_IS_FINAL, DeliverRequest.JSON_PROPERTY_CANCELLATION_REASON, - DeliverRequest.JSON_PROPERTY_DELIVER_ITEMS + DeliverRequest.JSON_PROPERTY_DELIVER_ITEMS, + DeliverRequest.JSON_PROPERTY_FUND_SPLIT }) public class DeliverRequest implements Serializable { private static final long serialVersionUID = 1L; @@ -42,6 +43,9 @@ public class DeliverRequest implements Serializable { public static final String JSON_PROPERTY_DELIVER_ITEMS = "deliverItems"; private List deliverItems; + public static final String JSON_PROPERTY_FUND_SPLIT = "fundSplit"; + private FundSplit fundSplit; + public DeliverRequest() { } @@ -156,6 +160,31 @@ public void setDeliverItems(List deliverItems) { this.deliverItems = deliverItems; } + public DeliverRequest fundSplit(FundSplit fundSplit) { + + this.fundSplit = fundSplit; + return this; + } + + /** + * Get fundSplit + * + * @return fundSplit + **/ + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FundSplit getFundSplit() { + return fundSplit; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplit(FundSplit fundSplit) { + this.fundSplit = fundSplit; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -168,12 +197,13 @@ public boolean equals(Object o) { return Objects.equals(this.deliverType, deliverRequest.deliverType) && Objects.equals(this.isFinal, deliverRequest.isFinal) && Objects.equals(this.cancellationReason, deliverRequest.cancellationReason) && - Objects.equals(this.deliverItems, deliverRequest.deliverItems); + Objects.equals(this.deliverItems, deliverRequest.deliverItems) && + Objects.equals(this.fundSplit, deliverRequest.fundSplit); } @Override public int hashCode() { - return Objects.hash(deliverType, isFinal, cancellationReason, deliverItems); + return Objects.hash(deliverType, isFinal, cancellationReason, deliverItems, fundSplit); } @Override @@ -184,6 +214,7 @@ public String toString() { sb.append(" isFinal: ").append(toIndentedString(isFinal)).append("\n"); sb.append(" cancellationReason: ").append(toIndentedString(cancellationReason)).append("\n"); sb.append(" deliverItems: ").append(toIndentedString(deliverItems)).append("\n"); + sb.append(" fundSplit: ").append(toIndentedString(fundSplit)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/FundDistribution.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/FundDistribution.java new file mode 100644 index 0000000..09795b1 --- /dev/null +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/FundDistribution.java @@ -0,0 +1,307 @@ +package com.payone.commerce.platform.lib.models; + +import java.io.Serializable; +import java.util.Objects; +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Instructions for distributing funds to multiple sellers or partners in a marketplace context. + */ +@JsonPropertyOrder({ + FundDistribution.JSON_PROPERTY_ID, + FundDistribution.JSON_PROPERTY_ACCOUNT_ID, + FundDistribution.JSON_PROPERTY_DESCRIPTION, + FundDistribution.JSON_PROPERTY_AMOUNT, + FundDistribution.JSON_PROPERTY_TYPE, + FundDistribution.JSON_PROPERTY_MERCHANT_REFERENCE, + FundDistribution.JSON_PROPERTY_MERCHANT_PARAMETERS +}) +public class FundDistribution implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * Classification or purpose of the fund distribution to the receiving account within a given order. + */ + public enum TypeEnum { + SELLER_REVENUE(String.valueOf("SELLER_REVENUE")), + + COMMISSION_FEE(String.valueOf("COMMISSION_FEE")), + + SHIPPING_COSTS(String.valueOf("SHIPPING_COSTS")), + + TAX(String.valueOf("TAX")), + + PLATFORM_FEE(String.valueOf("PLATFORM_FEE")), + + OTHER(String.valueOf("OTHER")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + private String accountId; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_AMOUNT = "amount"; + private Long amount; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public static final String JSON_PROPERTY_MERCHANT_REFERENCE = "merchantReference"; + private String merchantReference; + + public static final String JSON_PROPERTY_MERCHANT_PARAMETERS = "merchantParameters"; + private String merchantParameters; + + public FundDistribution() { + } + + public FundDistribution id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id + */ + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(UUID id) { + this.id = id; + } + + public FundDistribution accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Unique identifier of the beneficiary (seller/partner/sub-account) to receive funds (e.g., payout account ID). + * + * @return accountId + */ + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccountId() { + return accountId; + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public FundDistribution description(String description) { + this.description = description; + return this; + } + + /** + * Human-readable description for reconciliation. Appears on reports. + * + * @return description + */ + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDescription(String description) { + this.description = description; + } + + public FundDistribution amount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Amount in cents and always having 2 decimals, in the currency of the original transaction. + * + * @return amount + */ + + @JsonProperty(JSON_PROPERTY_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getAmount() { + return amount; + } + + @JsonProperty(JSON_PROPERTY_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAmount(Long amount) { + this.amount = amount; + } + + public FundDistribution type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Classification or purpose of the fund distribution to the receiving account within a given order. + * + * @return type + */ + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + } + + public FundDistribution merchantReference(String merchantReference) { + this.merchantReference = merchantReference; + return this; + } + + /** + * Unique reference of the part of the fund/payment to be distributed that is also returned for + * reporting and reconciliation purposes. + * + * @return merchantReference + */ + + @JsonProperty(JSON_PROPERTY_MERCHANT_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMerchantReference() { + return merchantReference; + } + + @JsonProperty(JSON_PROPERTY_MERCHANT_REFERENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMerchantReference(String merchantReference) { + this.merchantReference = merchantReference; + } + + public FundDistribution merchantParameters(String merchantParameters) { + this.merchantParameters = merchantParameters; + return this; + } + + /** + * It allows you to store additional parameters for the transaction in JSON format. + * This field must not contain any personal data. + * + * @return merchantParameters + */ + + @JsonProperty(JSON_PROPERTY_MERCHANT_PARAMETERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMerchantParameters() { + return merchantParameters; + } + + @JsonProperty(JSON_PROPERTY_MERCHANT_PARAMETERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMerchantParameters(String merchantParameters) { + this.merchantParameters = merchantParameters; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FundDistribution fundDistribution = (FundDistribution) o; + return Objects.equals(this.id, fundDistribution.id) && + Objects.equals(this.accountId, fundDistribution.accountId) && + Objects.equals(this.description, fundDistribution.description) && + Objects.equals(this.amount, fundDistribution.amount) && + Objects.equals(this.type, fundDistribution.type) && + Objects.equals(this.merchantReference, fundDistribution.merchantReference) && + Objects.equals(this.merchantParameters, fundDistribution.merchantParameters); + } + + @Override + public int hashCode() { + return Objects.hash(id, accountId, description, amount, type, merchantReference, merchantParameters); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FundDistribution {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" merchantReference: ").append(toIndentedString(merchantReference)).append("\n"); + sb.append(" merchantParameters: ").append(toIndentedString(merchantParameters)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/FundSplit.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/FundSplit.java new file mode 100644 index 0000000..9953fa9 --- /dev/null +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/FundSplit.java @@ -0,0 +1,154 @@ +package com.payone.commerce.platform.lib.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Instructions for distributing funds to multiple sellers or partners in a marketplace context. + */ +@JsonPropertyOrder({ + FundSplit.JSON_PROPERTY_ID, + FundSplit.JSON_PROPERTY_PAYMENT_EVENT_ID, + FundSplit.JSON_PROPERTY_FUND_DISTRIBUTIONS +}) +public class FundSplit implements Serializable { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_PAYMENT_EVENT_ID = "paymentEventId"; + private UUID paymentEventId; + + public static final String JSON_PROPERTY_FUND_DISTRIBUTIONS = "fundDistributions"; + private List fundDistributions; + + public FundSplit() { + } + + public FundSplit id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id + */ + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(UUID id) { + this.id = id; + } + + public FundSplit paymentEventId(UUID paymentEventId) { + this.paymentEventId = paymentEventId; + return this; + } + + /** + * Get paymentEventId + * + * @return paymentEventId + */ + + @JsonProperty(JSON_PROPERTY_PAYMENT_EVENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getPaymentEventId() { + return paymentEventId; + } + + @JsonProperty(JSON_PROPERTY_PAYMENT_EVENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPaymentEventId(UUID paymentEventId) { + this.paymentEventId = paymentEventId; + } + + public FundSplit fundDistributions(List fundDistributions) { + this.fundDistributions = fundDistributions; + return this; + } + + public FundSplit addFundDistributionsItem(FundDistribution fundDistributionsItem) { + if (this.fundDistributions == null) { + this.fundDistributions = new ArrayList<>(); + } + this.fundDistributions.add(fundDistributionsItem); + return this; + } + + /** + * Get fundDistributions + * + * @return fundDistributions + */ + + @JsonProperty(JSON_PROPERTY_FUND_DISTRIBUTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFundDistributions() { + return fundDistributions; + } + + @JsonProperty(JSON_PROPERTY_FUND_DISTRIBUTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundDistributions(List fundDistributions) { + this.fundDistributions = fundDistributions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FundSplit fundSplit = (FundSplit) o; + return Objects.equals(this.id, fundSplit.id) && + Objects.equals(this.paymentEventId, fundSplit.paymentEventId) && + Objects.equals(this.fundDistributions, fundSplit.fundDistributions); + } + + @Override + public int hashCode() { + return Objects.hash(id, paymentEventId, fundDistributions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FundSplit {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" paymentEventId: ").append(toIndentedString(paymentEventId)).append("\n"); + sb.append(" fundDistributions: ").append(toIndentedString(fundDistributions)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/MobilePaymentMethodSpecificInput.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/MobilePaymentMethodSpecificInput.java index e3edd75..2737552 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/MobilePaymentMethodSpecificInput.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/MobilePaymentMethodSpecificInput.java @@ -17,7 +17,8 @@ MobilePaymentMethodSpecificInput.JSON_PROPERTY_PUBLIC_KEY_HASH, MobilePaymentMethodSpecificInput.JSON_PROPERTY_EPHEMERAL_KEY, MobilePaymentMethodSpecificInput.JSON_PROPERTY_THREE_D_SECURE, - MobilePaymentMethodSpecificInput.JSON_PROPERTY_PAYMENT_PRODUCT302_SPECIFIC_INPUT + MobilePaymentMethodSpecificInput.JSON_PROPERTY_PAYMENT_PRODUCT302_SPECIFIC_INPUT, + MobilePaymentMethodSpecificInput.JSON_PROPERTY_PAYMENT_PRODUCT5002_SPECIFIC_INPUT }) public class MobilePaymentMethodSpecificInput implements Serializable { @@ -51,6 +52,10 @@ public class MobilePaymentMethodSpecificInput implements Serializable { private PaymentProduct302SpecificInput paymentProduct302SpecificInput; + public static final String JSON_PROPERTY_PAYMENT_PRODUCT5002_SPECIFIC_INPUT = "paymentProduct5002SpecificInput"; + + private PaymentProduct5002SpecificInput paymentProduct5002SpecificInput; + public MobilePaymentMethodSpecificInput() { } @@ -219,6 +224,30 @@ public void setPaymentProduct302SpecificInput(PaymentProduct302SpecificInput pay this.paymentProduct302SpecificInput = paymentProduct302SpecificInput; } + public MobilePaymentMethodSpecificInput paymentProduct5002SpecificInput( + PaymentProduct5002SpecificInput paymentProduct5002SpecificInput) { + this.paymentProduct5002SpecificInput = paymentProduct5002SpecificInput; + return this; + } + + /** + * Get paymentProduct5002SpecificInput + * + * @return paymentProduct5002SpecificInput + */ + + @JsonProperty(JSON_PROPERTY_PAYMENT_PRODUCT5002_SPECIFIC_INPUT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PaymentProduct5002SpecificInput getPaymentProduct5002SpecificInput() { + return paymentProduct5002SpecificInput; + } + + @JsonProperty(JSON_PROPERTY_PAYMENT_PRODUCT5002_SPECIFIC_INPUT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPaymentProduct5002SpecificInput(PaymentProduct5002SpecificInput paymentProduct5002SpecificInput) { + this.paymentProduct5002SpecificInput = paymentProduct5002SpecificInput; + } + /** * Return true if this MobilePaymentMethodSpecificInput object is equal to o. */ @@ -238,13 +267,15 @@ public boolean equals(Object o) { Objects.equals(this.ephemeralKey, mobilePaymentMethodSpecificInput.ephemeralKey) && Objects.equals(this.threeDSecure, mobilePaymentMethodSpecificInput.threeDSecure) && Objects.equals(this.paymentProduct302SpecificInput, - mobilePaymentMethodSpecificInput.paymentProduct302SpecificInput); + mobilePaymentMethodSpecificInput.paymentProduct302SpecificInput) && + Objects.equals(this.paymentProduct5002SpecificInput, + mobilePaymentMethodSpecificInput.paymentProduct5002SpecificInput); } @Override public int hashCode() { return Objects.hash(paymentProductId, authorizationMode, encryptedPaymentData, publicKeyHash, ephemeralKey, - threeDSecure, paymentProduct302SpecificInput); + threeDSecure, paymentProduct302SpecificInput, paymentProduct5002SpecificInput); } @Override @@ -259,6 +290,8 @@ public String toString() { sb.append(" threeDSecure: ").append(toIndentedString(threeDSecure)).append("\n"); sb.append(" paymentProduct302SpecificInput: ").append(toIndentedString(paymentProduct302SpecificInput)) .append("\n"); + sb.append(" paymentProduct5002SpecificInput: ").append(toIndentedString(paymentProduct5002SpecificInput)) + .append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/MobilePaymentNetwork.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/MobilePaymentNetwork.java new file mode 100644 index 0000000..ee537b4 --- /dev/null +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/MobilePaymentNetwork.java @@ -0,0 +1,54 @@ +package com.payone.commerce.platform.lib.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Network/Scheme of the card used for the payment. + * * MASTERCARD + * * VISA + * * AMEX + * * GIROCARD + * * DISCOVER (not supported yet) + * * JCB (not supported yet) + */ +public enum MobilePaymentNetwork { + + MASTERCARD("MASTERCARD"), + + VISA("VISA"), + + AMEX("AMEX"), + + GIROCARD("GIROCARD"), + + DISCOVER("DISCOVER"), + + JCB("JCB"); + + private String value; + + MobilePaymentNetwork(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static MobilePaymentNetwork fromValue(String value) { + for (MobilePaymentNetwork b : MobilePaymentNetwork.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderLineDetailsPatch.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderLineDetailsPatch.java index 4bfc906..9d1d297 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderLineDetailsPatch.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderLineDetailsPatch.java @@ -22,6 +22,7 @@ OrderLineDetailsPatch.JSON_PROPERTY_PRODUCT_TYPE, OrderLineDetailsPatch.JSON_PROPERTY_QUANTITY, OrderLineDetailsPatch.JSON_PROPERTY_TAX_AMOUNT, + OrderLineDetailsPatch.JSON_PROPERTY_TAX_AMOUNT_PER_UNIT, OrderLineDetailsPatch.JSON_PROPERTY_PRODUCT_URL, OrderLineDetailsPatch.JSON_PROPERTY_PRODUCT_IMAGE_URL, OrderLineDetailsPatch.JSON_PROPERTY_PRODUCT_CATEGORY_PATH, @@ -51,6 +52,9 @@ public class OrderLineDetailsPatch implements Serializable { public static final String JSON_PROPERTY_TAX_AMOUNT = "taxAmount"; private Long taxAmount; + public static final String JSON_PROPERTY_TAX_AMOUNT_PER_UNIT = "taxAmountPerUnit"; + private Boolean taxAmountPerUnit = false; + public static final String JSON_PROPERTY_PRODUCT_URL = "productUrl"; private String productUrl; @@ -256,6 +260,32 @@ public void setTaxAmount(Long taxAmount) { this.taxAmount = taxAmount; } + public OrderLineDetailsPatch taxAmountPerUnit(Boolean taxAmountPerUnit) { + + this.taxAmountPerUnit = taxAmountPerUnit; + return this; + } + + /** + * This field indicates if the taxAmount is to be interpreted as the tax amount + * per unit rather than for the entire line item. + * + * @return taxAmountPerUnit + **/ + + @JsonProperty(JSON_PROPERTY_TAX_AMOUNT_PER_UNIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getTaxAmountPerUnit() { + return taxAmountPerUnit; + } + + @JsonProperty(JSON_PROPERTY_TAX_AMOUNT_PER_UNIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTaxAmountPerUnit(Boolean taxAmountPerUnit) { + this.taxAmountPerUnit = taxAmountPerUnit; + } + public OrderLineDetailsPatch productUrl(String productUrl) { this.productUrl = productUrl; @@ -373,6 +403,7 @@ public boolean equals(Object o) { Objects.equals(this.productType, orderLineDetailsPatch.productType) && Objects.equals(this.quantity, orderLineDetailsPatch.quantity) && Objects.equals(this.taxAmount, orderLineDetailsPatch.taxAmount) && + Objects.equals(this.taxAmountPerUnit, orderLineDetailsPatch.taxAmountPerUnit) && Objects.equals(this.productUrl, orderLineDetailsPatch.productUrl) && Objects.equals(this.productImageUrl, orderLineDetailsPatch.productImageUrl) && Objects.equals(this.productCategoryPath, orderLineDetailsPatch.productCategoryPath) && @@ -381,8 +412,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(id, status, productCode, productPrice, productType, quantity, taxAmount, productUrl, - productImageUrl, productCategoryPath, merchantShopDeliveryReference); + return Objects.hash(id, status, productCode, productPrice, productType, quantity, taxAmount, taxAmountPerUnit, + productUrl, productImageUrl, productCategoryPath, merchantShopDeliveryReference); } @Override @@ -396,6 +427,7 @@ public String toString() { sb.append(" productType: ").append(toIndentedString(productType)).append("\n"); sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); sb.append(" taxAmount: ").append(toIndentedString(taxAmount)).append("\n"); + sb.append(" taxAmountPerUnit: ").append(toIndentedString(taxAmountPerUnit)).append("\n"); sb.append(" productUrl: ").append(toIndentedString(productUrl)).append("\n"); sb.append(" productImageUrl: ").append(toIndentedString(productImageUrl)).append("\n"); sb.append(" productCategoryPath: ").append(toIndentedString(productCategoryPath)).append("\n"); diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderLineDetailsResult.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderLineDetailsResult.java index e7a9139..8975b3e 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderLineDetailsResult.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderLineDetailsResult.java @@ -22,6 +22,7 @@ OrderLineDetailsResult.JSON_PROPERTY_PRODUCT_TYPE, OrderLineDetailsResult.JSON_PROPERTY_QUANTITY, OrderLineDetailsResult.JSON_PROPERTY_TAX_AMOUNT, + OrderLineDetailsResult.JSON_PROPERTY_TAX_AMOUNT_PER_UNIT, OrderLineDetailsResult.JSON_PROPERTY_PRODUCT_URL, OrderLineDetailsResult.JSON_PROPERTY_PRODUCT_IMAGE_URL, OrderLineDetailsResult.JSON_PROPERTY_PRODUCT_CATEGORY_PATH, @@ -51,6 +52,9 @@ public class OrderLineDetailsResult implements Serializable { public static final String JSON_PROPERTY_TAX_AMOUNT = "taxAmount"; private Long taxAmount; + public static final String JSON_PROPERTY_TAX_AMOUNT_PER_UNIT = "taxAmountPerUnit"; + private Boolean taxAmountPerUnit = false; + public static final String JSON_PROPERTY_PRODUCT_URL = "productUrl"; private String productUrl; @@ -256,6 +260,32 @@ public void setTaxAmount(Long taxAmount) { this.taxAmount = taxAmount; } + public OrderLineDetailsResult taxAmountPerUnit(Boolean taxAmountPerUnit) { + + this.taxAmountPerUnit = taxAmountPerUnit; + return this; + } + + /** + * This field indicates if the taxAmount is to be interpreted as the tax amount + * per unit rather than for the entire line item. + * + * @return taxAmountPerUnit + **/ + + @JsonProperty(JSON_PROPERTY_TAX_AMOUNT_PER_UNIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getTaxAmountPerUnit() { + return taxAmountPerUnit; + } + + @JsonProperty(JSON_PROPERTY_TAX_AMOUNT_PER_UNIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTaxAmountPerUnit(Boolean taxAmountPerUnit) { + this.taxAmountPerUnit = taxAmountPerUnit; + } + public OrderLineDetailsResult productUrl(String productUrl) { this.productUrl = productUrl; @@ -373,6 +403,7 @@ public boolean equals(Object o) { Objects.equals(this.productType, orderLineDetailsResult.productType) && Objects.equals(this.quantity, orderLineDetailsResult.quantity) && Objects.equals(this.taxAmount, orderLineDetailsResult.taxAmount) && + Objects.equals(this.taxAmountPerUnit, orderLineDetailsResult.taxAmountPerUnit) && Objects.equals(this.productUrl, orderLineDetailsResult.productUrl) && Objects.equals(this.productImageUrl, orderLineDetailsResult.productImageUrl) && Objects.equals(this.productCategoryPath, orderLineDetailsResult.productCategoryPath) && @@ -381,8 +412,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(id, status, productCode, productPrice, productType, quantity, taxAmount, productUrl, - productImageUrl, productCategoryPath, merchantShopDeliveryReference); + return Objects.hash(id, status, productCode, productPrice, productType, quantity, taxAmount, taxAmountPerUnit, + productUrl, productImageUrl, productCategoryPath, merchantShopDeliveryReference); } @Override @@ -396,6 +427,7 @@ public String toString() { sb.append(" productType: ").append(toIndentedString(productType)).append("\n"); sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); sb.append(" taxAmount: ").append(toIndentedString(taxAmount)).append("\n"); + sb.append(" taxAmountPerUnit: ").append(toIndentedString(taxAmountPerUnit)).append("\n"); sb.append(" productUrl: ").append(toIndentedString(productUrl)).append("\n"); sb.append(" productImageUrl: ").append(toIndentedString(productImageUrl)).append("\n"); sb.append(" productCategoryPath: ").append(toIndentedString(productCategoryPath)).append("\n"); diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderRequest.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderRequest.java index daa91c4..e6daf97 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderRequest.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/OrderRequest.java @@ -24,7 +24,8 @@ OrderRequest.JSON_PROPERTY_ORDER_TYPE, OrderRequest.JSON_PROPERTY_ORDER_REFERENCES, OrderRequest.JSON_PROPERTY_ITEMS, - OrderRequest.JSON_PROPERTY_PAYMENT_METHOD_SPECIFIC_INPUT + OrderRequest.JSON_PROPERTY_PAYMENT_METHOD_SPECIFIC_INPUT, + OrderRequest.JSON_PROPERTY_FUND_SPLIT }) public class OrderRequest implements Serializable { private static final long serialVersionUID = 1L; @@ -41,6 +42,9 @@ public class OrderRequest implements Serializable { public static final String JSON_PROPERTY_PAYMENT_METHOD_SPECIFIC_INPUT = "paymentMethodSpecificInput"; private PaymentMethodSpecificInput paymentMethodSpecificInput; + public static final String JSON_PROPERTY_FUND_SPLIT = "fundSplit"; + private FundSplit fundSplit; + public OrderRequest() { } @@ -152,6 +156,31 @@ public void setPaymentMethodSpecificInput(PaymentMethodSpecificInput paymentMeth this.paymentMethodSpecificInput = paymentMethodSpecificInput; } + public OrderRequest fundSplit(FundSplit fundSplit) { + + this.fundSplit = fundSplit; + return this; + } + + /** + * Get fundSplit + * + * @return fundSplit + **/ + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FundSplit getFundSplit() { + return fundSplit; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplit(FundSplit fundSplit) { + this.fundSplit = fundSplit; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -164,12 +193,13 @@ public boolean equals(Object o) { return Objects.equals(this.orderType, orderRequest.orderType) && Objects.equals(this.orderReferences, orderRequest.orderReferences) && Objects.equals(this.items, orderRequest.items) && - Objects.equals(this.paymentMethodSpecificInput, orderRequest.paymentMethodSpecificInput); + Objects.equals(this.paymentMethodSpecificInput, orderRequest.paymentMethodSpecificInput) && + Objects.equals(this.fundSplit, orderRequest.fundSplit); } @Override public int hashCode() { - return Objects.hash(orderType, orderReferences, items, paymentMethodSpecificInput); + return Objects.hash(orderType, orderReferences, items, paymentMethodSpecificInput, fundSplit); } @Override @@ -180,6 +210,7 @@ public String toString() { sb.append(" orderReferences: ").append(toIndentedString(orderReferences)).append("\n"); sb.append(" items: ").append(toIndentedString(items)).append("\n"); sb.append(" paymentMethodSpecificInput: ").append(toIndentedString(paymentMethodSpecificInput)).append("\n"); + sb.append(" fundSplit: ").append(toIndentedString(fundSplit)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/PatchCommerceCaseRequest.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/PatchCommerceCaseRequest.java new file mode 100644 index 0000000..97dbcef --- /dev/null +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/PatchCommerceCaseRequest.java @@ -0,0 +1,83 @@ +package com.payone.commerce.platform.lib.models; + +import java.io.Serializable; +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Update the customer data of the given Commerce Case + */ +@JsonPropertyOrder({ + PatchCommerceCaseRequest.JSON_PROPERTY_CUSTOMER +}) +public class PatchCommerceCaseRequest implements Serializable { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_CUSTOMER = "customer"; + private Customer customer; + + public PatchCommerceCaseRequest() { + } + + public PatchCommerceCaseRequest customer(Customer customer) { + this.customer = customer; + return this; + } + + /** + * Get customer + * + * @return customer + */ + @JsonProperty(JSON_PROPERTY_CUSTOMER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Customer getCustomer() { + return customer; + } + + @JsonProperty(JSON_PROPERTY_CUSTOMER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCustomer(Customer customer) { + this.customer = customer; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchCommerceCaseRequest patchCommerceCaseRequest = (PatchCommerceCaseRequest) o; + return Objects.equals(this.customer, patchCommerceCaseRequest.customer); + } + + @Override + public int hashCode() { + return Objects.hash(customer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchCommerceCaseRequest {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/PausePaymentRequest.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/PausePaymentRequest.java index 747b9aa..24c3dce 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/PausePaymentRequest.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/PausePaymentRequest.java @@ -1,51 +1,19 @@ package com.payone.commerce.platform.lib.models; import java.io.Serializable; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * Request to refresh the payment status of a specific payment. + * Request to pause a payment for a specific payment method. */ -@JsonPropertyOrder({ - PausePaymentRequest.JSON_PROPERTY_REFRESH_TYPE -}) +@JsonPropertyOrder({}) public class PausePaymentRequest implements Serializable { private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_REFRESH_TYPE = "refreshType"; - - private RefreshType refreshType; - public PausePaymentRequest() { } - public PausePaymentRequest refreshType(RefreshType refreshType) { - this.refreshType = refreshType; - return this; - } - - /** - * Get refreshType - * - * @return refreshType - */ - - @JsonProperty(JSON_PROPERTY_REFRESH_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public RefreshType getRefreshType() { - return refreshType; - } - - @JsonProperty(JSON_PROPERTY_REFRESH_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setRefreshType(RefreshType refreshType) { - this.refreshType = refreshType; - } - /** * Return true if this PausePaymentRequest object is equal to o. */ @@ -57,33 +25,19 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - PausePaymentRequest refreshPaymentRequest = (PausePaymentRequest) o; - return Objects.equals(this.refreshType, refreshPaymentRequest.refreshType); + return true; } @Override public int hashCode() { - return Objects.hash(refreshType); + return getClass().hashCode(); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PausePaymentRequest {\n"); - sb.append(" refreshType: ").append(toIndentedString(refreshType)).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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentEvent.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentEvent.java index 67c8f81..21536bc 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentEvent.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentEvent.java @@ -1,7 +1,9 @@ package com.payone.commerce.platform.lib.models; import java.io.Serializable; +import java.time.OffsetDateTime; import java.util.Objects; +import java.util.UUID; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -11,6 +13,8 @@ * Detailed information regarding an occurred payment event. */ @JsonPropertyOrder({ + PaymentEvent.JSON_PROPERTY_PAYMENT_EVENT_ID, + PaymentEvent.JSON_PROPERTY_CREATION_DATE_TIME, PaymentEvent.JSON_PROPERTY_TYPE, PaymentEvent.JSON_PROPERTY_AMOUNT_OF_MONEY, PaymentEvent.JSON_PROPERTY_PAYMENT_STATUS, @@ -21,6 +25,15 @@ public class PaymentEvent implements Serializable { private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_PAYMENT_EVENT_ID = "paymentEventId"; + + private UUID paymentEventId; + + public static final String JSON_PROPERTY_CREATION_DATE_TIME = "creationDateTime"; + + private OffsetDateTime creationDateTime; + public static final String JSON_PROPERTY_TYPE = "type"; private PaymentType type; @@ -48,6 +61,31 @@ public class PaymentEvent implements Serializable { public PaymentEvent() { } + /** + * Unique identifier of the payment event. + * + * @return paymentEventId + */ + + @JsonProperty(JSON_PROPERTY_PAYMENT_EVENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getPaymentEventId() { + return paymentEventId; + } + + /** + * The date and time of the payment event. Format: YYYY-MM-DD'T'HH:mm:ss'Z' or + * YYYY-MM-DD'T'HH:mm:ss+XX:XX or YYYY-MM-DD'T'HH:mm:ss-XX:XX + * + * @return creationDateTime + */ + + @JsonProperty(JSON_PROPERTY_CREATION_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreationDateTime() { + return creationDateTime; + } + public PaymentEvent type(PaymentType type) { this.type = type; return this; @@ -200,7 +238,9 @@ public boolean equals(Object o) { return false; } PaymentEvent paymentEvent = (PaymentEvent) o; - return Objects.equals(this.type, paymentEvent.type) && + return Objects.equals(this.paymentEventId, paymentEvent.paymentEventId) && + Objects.equals(this.creationDateTime, paymentEvent.creationDateTime) && + Objects.equals(this.type, paymentEvent.type) && Objects.equals(this.amountOfMoney, paymentEvent.amountOfMoney) && Objects.equals(this.paymentStatus, paymentEvent.paymentStatus) && Objects.equals(this.cancellationReason, paymentEvent.cancellationReason) && @@ -210,13 +250,15 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(type, amountOfMoney, paymentStatus, cancellationReason, returnReason, paymentInstructions); + return Objects.hash(paymentEventId, creationDateTime, type, amountOfMoney, paymentStatus, cancellationReason, returnReason, paymentInstructions); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PaymentEvent {\n"); + sb.append(" paymentEventId: ").append(toIndentedString(paymentEventId)).append("\n"); + sb.append(" creationDateTime: ").append(toIndentedString(creationDateTime)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" amountOfMoney: ").append(toIndentedString(amountOfMoney)).append("\n"); sb.append(" paymentStatus: ").append(toIndentedString(paymentStatus)).append("\n"); diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentExecution.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentExecution.java index e4cdb5f..1317b1b 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentExecution.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentExecution.java @@ -28,7 +28,8 @@ PaymentExecution.JSON_PROPERTY_PREVIOUS_PAYMENT, PaymentExecution.JSON_PROPERTY_CREATION_DATE_TIME, PaymentExecution.JSON_PROPERTY_LAST_UPDATED, - PaymentExecution.JSON_PROPERTY_EVENTS + PaymentExecution.JSON_PROPERTY_EVENTS, + PaymentExecution.JSON_PROPERTY_FUND_SPLITS }) public class PaymentExecution implements Serializable { @@ -90,6 +91,10 @@ public class PaymentExecution implements Serializable { private List events = new ArrayList<>(); + public static final String JSON_PROPERTY_FUND_SPLITS = "fundSplits"; + + private List fundSplits; + public PaymentExecution() { } @@ -444,6 +449,37 @@ public void setEvents(List events) { this.events = events; } + public PaymentExecution fundSplits(List fundSplits) { + this.fundSplits = fundSplits; + return this; + } + + public PaymentExecution addFundSplitsItem(FundSplit fundSplitsItem) { + if (this.fundSplits == null) { + this.fundSplits = new ArrayList<>(); + } + this.fundSplits.add(fundSplitsItem); + return this; + } + + /** + * List of fund splits associated with this payment execution. + * + * @return fundSplits + */ + + @JsonProperty(JSON_PROPERTY_FUND_SPLITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFundSplits() { + return fundSplits; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplits(List fundSplits) { + this.fundSplits = fundSplits; + } + /** * Return true if this PaymentExecution object is equal to o. */ @@ -472,7 +508,8 @@ public boolean equals(Object o) { Objects.equals(this.previousPayment, paymentExecution.previousPayment) && Objects.equals(this.creationDateTime, paymentExecution.creationDateTime) && Objects.equals(this.lastUpdated, paymentExecution.lastUpdated) && - Objects.equals(this.events, paymentExecution.events); + Objects.equals(this.events, paymentExecution.events) && + Objects.equals(this.fundSplits, paymentExecution.fundSplits); } @Override @@ -480,7 +517,7 @@ public int hashCode() { return Objects.hash(paymentExecutionId, paymentId, cardPaymentMethodSpecificInput, mobilePaymentMethodSpecificInput, redirectPaymentMethodSpecificInput, sepaDirectDebitPaymentMethodSpecificInput, financingPaymentMethodSpecificInput, bankPayoutMethodSpecificInput, paymentChannel, references, previousPayment, - creationDateTime, lastUpdated, events); + creationDateTime, lastUpdated, events, fundSplits); } @Override @@ -507,6 +544,7 @@ public String toString() { sb.append(" creationDateTime: ").append(toIndentedString(creationDateTime)).append("\n"); sb.append(" lastUpdated: ").append(toIndentedString(lastUpdated)).append("\n"); sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" fundSplits: ").append(toIndentedString(fundSplits)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentExecutionSpecificInput.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentExecutionSpecificInput.java index e682290..8407b20 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentExecutionSpecificInput.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentExecutionSpecificInput.java @@ -22,7 +22,8 @@ @JsonPropertyOrder({ PaymentExecutionSpecificInput.JSON_PROPERTY_AMOUNT_OF_MONEY, PaymentExecutionSpecificInput.JSON_PROPERTY_SHOPPING_CART, - PaymentExecutionSpecificInput.JSON_PROPERTY_PAYMENT_REFERENCES + PaymentExecutionSpecificInput.JSON_PROPERTY_PAYMENT_REFERENCES, + PaymentExecutionSpecificInput.JSON_PROPERTY_FUND_SPLIT }) public class PaymentExecutionSpecificInput implements Serializable { private static final long serialVersionUID = 1L; @@ -36,6 +37,9 @@ public class PaymentExecutionSpecificInput implements Serializable { public static final String JSON_PROPERTY_PAYMENT_REFERENCES = "paymentReferences"; private References paymentReferences; + public static final String JSON_PROPERTY_FUND_SPLIT = "fundSplit"; + private FundSplit fundSplit; + public PaymentExecutionSpecificInput() { } @@ -114,6 +118,31 @@ public void setPaymentReferences(References paymentReferences) { this.paymentReferences = paymentReferences; } + public PaymentExecutionSpecificInput fundSplit(FundSplit fundSplit) { + + this.fundSplit = fundSplit; + return this; + } + + /** + * Get fundSplit + * + * @return fundSplit + **/ + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FundSplit getFundSplit() { + return fundSplit; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplit(FundSplit fundSplit) { + this.fundSplit = fundSplit; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -125,12 +154,13 @@ public boolean equals(Object o) { PaymentExecutionSpecificInput paymentExecutionSpecificInput = (PaymentExecutionSpecificInput) o; return Objects.equals(this.amountOfMoney, paymentExecutionSpecificInput.amountOfMoney) && Objects.equals(this.shoppingCart, paymentExecutionSpecificInput.shoppingCart) && - Objects.equals(this.paymentReferences, paymentExecutionSpecificInput.paymentReferences); + Objects.equals(this.paymentReferences, paymentExecutionSpecificInput.paymentReferences) && + Objects.equals(this.fundSplit, paymentExecutionSpecificInput.fundSplit); } @Override public int hashCode() { - return Objects.hash(amountOfMoney, shoppingCart, paymentReferences); + return Objects.hash(amountOfMoney, shoppingCart, paymentReferences, fundSplit); } @Override @@ -140,6 +170,7 @@ public String toString() { sb.append(" amountOfMoney: ").append(toIndentedString(amountOfMoney)).append("\n"); sb.append(" shoppingCart: ").append(toIndentedString(shoppingCart)).append("\n"); sb.append(" paymentReferences: ").append(toIndentedString(paymentReferences)).append("\n"); + sb.append(" fundSplit: ").append(toIndentedString(fundSplit)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentInformationResponse.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentInformationResponse.java index 66b797d..25febad 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentInformationResponse.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentInformationResponse.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Objects; import java.util.UUID; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentProduct302SpecificInput.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentProduct302SpecificInput.java index 843231d..0e44f1a 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentProduct302SpecificInput.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentProduct302SpecificInput.java @@ -65,53 +65,9 @@ public static IntegrationTypeEnum fromValue(String value) { private IntegrationTypeEnum integrationType; - /** - * Network/Scheme of the card used for the payment. * MASTERCARD * VISA * AMEX * - * GIROCARD * DISCOVER (not supported yet) * JCB (not supported yet) - */ - public enum NetworkEnum { - MASTERCARD(String.valueOf("MASTERCARD")), - - VISA(String.valueOf("VISA")), - - AMEX(String.valueOf("AMEX")), - - GIROCARD(String.valueOf("GIROCARD")), - - DISCOVER(String.valueOf("DISCOVER")), - - JCB(String.valueOf("JCB")); - - private String value; - - NetworkEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NetworkEnum fromValue(String value) { - for (NetworkEnum b : NetworkEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - } - public static final String JSON_PROPERTY_NETWORK = "network"; - private NetworkEnum network; + private MobilePaymentNetwork network; public static final String JSON_PROPERTY_TOKEN = "token"; @@ -153,7 +109,7 @@ public void setIntegrationType(IntegrationTypeEnum integrationType) { this.integrationType = integrationType; } - public PaymentProduct302SpecificInput network(NetworkEnum network) { + public PaymentProduct302SpecificInput network(MobilePaymentNetwork network) { this.network = network; return this; } @@ -167,13 +123,13 @@ public PaymentProduct302SpecificInput network(NetworkEnum network) { @JsonProperty(JSON_PROPERTY_NETWORK) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public NetworkEnum getNetwork() { + public MobilePaymentNetwork getNetwork() { return network; } @JsonProperty(JSON_PROPERTY_NETWORK) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNetwork(NetworkEnum network) { + public void setNetwork(MobilePaymentNetwork network) { this.network = network; } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentProduct5002SpecificInput.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentProduct5002SpecificInput.java new file mode 100644 index 0000000..3489b29 --- /dev/null +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/PaymentProduct5002SpecificInput.java @@ -0,0 +1,145 @@ +package com.payone.commerce.platform.lib.models; + +import java.io.Serializable; +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Object containing additional Information needed for Click To Pay processing. + */ +@JsonPropertyOrder({ + PaymentProduct5002SpecificInput.JSON_PROPERTY_NETWORK, + PaymentProduct5002SpecificInput.JSON_PROPERTY_PAYMENT_CHECKOUT_DATA, + PaymentProduct5002SpecificInput.JSON_PROPERTY_SRC_DPA_ID +}) +public class PaymentProduct5002SpecificInput implements Serializable { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NETWORK = "network"; + private MobilePaymentNetwork network; + + public static final String JSON_PROPERTY_PAYMENT_CHECKOUT_DATA = "paymentCheckoutData"; + private String paymentCheckoutData; + + public static final String JSON_PROPERTY_SRC_DPA_ID = "srcDpaId"; + private String srcDpaId; + + public PaymentProduct5002SpecificInput() { + } + + public PaymentProduct5002SpecificInput network(MobilePaymentNetwork network) { + this.network = network; + return this; + } + + /** + * Get network + * + * @return network + */ + + @JsonProperty(JSON_PROPERTY_NETWORK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MobilePaymentNetwork getNetwork() { + return network; + } + + @JsonProperty(JSON_PROPERTY_NETWORK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNetwork(MobilePaymentNetwork network) { + this.network = network; + } + + public PaymentProduct5002SpecificInput paymentCheckoutData(String paymentCheckoutData) { + this.paymentCheckoutData = paymentCheckoutData; + return this; + } + + /** + * JWS Token Value (checkoutResponseSignature) as received in the Checkout Response on Client Side, + * Base64URL encoded. + * + * @return paymentCheckoutData + */ + + @JsonProperty(JSON_PROPERTY_PAYMENT_CHECKOUT_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPaymentCheckoutData() { + return paymentCheckoutData; + } + + @JsonProperty(JSON_PROPERTY_PAYMENT_CHECKOUT_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPaymentCheckoutData(String paymentCheckoutData) { + this.paymentCheckoutData = paymentCheckoutData; + } + + public PaymentProduct5002SpecificInput srcDpaId(String srcDpaId) { + this.srcDpaId = srcDpaId; + return this; + } + + /** + * DPA Identifier provided by PAYONE during client side initialization for the corresponding card + * type selected by the end consumer in the Click to Pay flow. + * + * @return srcDpaId + */ + + @JsonProperty(JSON_PROPERTY_SRC_DPA_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSrcDpaId() { + return srcDpaId; + } + + @JsonProperty(JSON_PROPERTY_SRC_DPA_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSrcDpaId(String srcDpaId) { + this.srcDpaId = srcDpaId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentProduct5002SpecificInput paymentProduct5002SpecificInput = (PaymentProduct5002SpecificInput) o; + return Objects.equals(this.network, paymentProduct5002SpecificInput.network) && + Objects.equals(this.paymentCheckoutData, paymentProduct5002SpecificInput.paymentCheckoutData) && + Objects.equals(this.srcDpaId, paymentProduct5002SpecificInput.srcDpaId); + } + + @Override + public int hashCode() { + return Objects.hash(network, paymentCheckoutData, srcDpaId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentProduct5002SpecificInput {\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" paymentCheckoutData: ").append(toIndentedString(paymentCheckoutData)).append("\n"); + sb.append(" srcDpaId: ").append(toIndentedString(srcDpaId)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/RefundPaymentResponse.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/RefundPaymentResponse.java index 360597d..b07e40a 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/RefundPaymentResponse.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/RefundPaymentResponse.java @@ -16,7 +16,8 @@ RefundPaymentResponse.JSON_PROPERTY_REFUND_OUTPUT, RefundPaymentResponse.JSON_PROPERTY_STATUS, RefundPaymentResponse.JSON_PROPERTY_STATUS_OUTPUT, - RefundPaymentResponse.JSON_PROPERTY_ID + RefundPaymentResponse.JSON_PROPERTY_ID, + RefundPaymentResponse.JSON_PROPERTY_FUND_SPLIT }) public class RefundPaymentResponse implements Serializable { private static final long serialVersionUID = 1L; @@ -33,6 +34,9 @@ public class RefundPaymentResponse implements Serializable { public static final String JSON_PROPERTY_ID = "id"; private String id; + public static final String JSON_PROPERTY_FUND_SPLIT = "fundSplit"; + private FundSplit fundSplit; + public RefundPaymentResponse() { } @@ -136,6 +140,31 @@ public void setId(String id) { this.id = id; } + public RefundPaymentResponse fundSplit(FundSplit fundSplit) { + + this.fundSplit = fundSplit; + return this; + } + + /** + * Get fundSplit + * + * @return fundSplit + **/ + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FundSplit getFundSplit() { + return fundSplit; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplit(FundSplit fundSplit) { + this.fundSplit = fundSplit; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -148,12 +177,13 @@ public boolean equals(Object o) { return Objects.equals(this.refundOutput, refundPaymentResponse.refundOutput) && Objects.equals(this.status, refundPaymentResponse.status) && Objects.equals(this.statusOutput, refundPaymentResponse.statusOutput) && - Objects.equals(this.id, refundPaymentResponse.id); + Objects.equals(this.id, refundPaymentResponse.id) && + Objects.equals(this.fundSplit, refundPaymentResponse.fundSplit); } @Override public int hashCode() { - return Objects.hash(refundOutput, status, statusOutput, id); + return Objects.hash(refundOutput, status, statusOutput, id, fundSplit); } @Override @@ -164,6 +194,7 @@ public String toString() { sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" statusOutput: ").append(toIndentedString(statusOutput)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" fundSplit: ").append(toIndentedString(fundSplit)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/RefundRequest.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/RefundRequest.java index 766adbc..2e9eea4 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/RefundRequest.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/RefundRequest.java @@ -16,7 +16,8 @@ @JsonPropertyOrder({ RefundRequest.JSON_PROPERTY_AMOUNT_OF_MONEY, RefundRequest.JSON_PROPERTY_REFERENCES, - RefundRequest.JSON_PROPERTY_RETURN + RefundRequest.JSON_PROPERTY_RETURN, + RefundRequest.JSON_PROPERTY_FUND_SPLIT }) public class RefundRequest implements Serializable { private static final long serialVersionUID = 1L; @@ -30,6 +31,9 @@ public class RefundRequest implements Serializable { public static final String JSON_PROPERTY_RETURN = "return"; private ReturnInformation _return; + public static final String JSON_PROPERTY_FUND_SPLIT = "fundSplit"; + private FundSplit fundSplit; + public RefundRequest() { } @@ -108,6 +112,31 @@ public void setReturn(ReturnInformation _return) { this._return = _return; } + public RefundRequest fundSplit(FundSplit fundSplit) { + + this.fundSplit = fundSplit; + return this; + } + + /** + * Get fundSplit + * + * @return fundSplit + **/ + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FundSplit getFundSplit() { + return fundSplit; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplit(FundSplit fundSplit) { + this.fundSplit = fundSplit; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -119,12 +148,13 @@ public boolean equals(Object o) { RefundRequest refundRequest = (RefundRequest) o; return Objects.equals(this.amountOfMoney, refundRequest.amountOfMoney) && Objects.equals(this.references, refundRequest.references) && - Objects.equals(this._return, refundRequest._return); + Objects.equals(this._return, refundRequest._return) && + Objects.equals(this.fundSplit, refundRequest.fundSplit); } @Override public int hashCode() { - return Objects.hash(amountOfMoney, references, _return); + return Objects.hash(amountOfMoney, references, _return, fundSplit); } @Override @@ -134,6 +164,7 @@ public String toString() { sb.append(" amountOfMoney: ").append(toIndentedString(amountOfMoney)).append("\n"); sb.append(" references: ").append(toIndentedString(references)).append("\n"); sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append(" fundSplit: ").append(toIndentedString(fundSplit)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/models/ReturnRequest.java b/lib/src/main/java/com/payone/commerce/platform/lib/models/ReturnRequest.java index 6969b9d..7dfdc07 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/models/ReturnRequest.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/models/ReturnRequest.java @@ -21,7 +21,8 @@ @JsonPropertyOrder({ ReturnRequest.JSON_PROPERTY_RETURN_TYPE, ReturnRequest.JSON_PROPERTY_RETURN_REASON, - ReturnRequest.JSON_PROPERTY_RETURN_ITEMS + ReturnRequest.JSON_PROPERTY_RETURN_ITEMS, + ReturnRequest.JSON_PROPERTY_FUND_SPLIT }) public class ReturnRequest implements Serializable { private static final long serialVersionUID = 1L; @@ -35,6 +36,9 @@ public class ReturnRequest implements Serializable { public static final String JSON_PROPERTY_RETURN_ITEMS = "returnItems"; private List returnItems; + public static final String JSON_PROPERTY_FUND_SPLIT = "fundSplit"; + private FundSplit fundSplit; + public ReturnRequest() { } @@ -121,6 +125,31 @@ public void setReturnItems(List returnItems) { this.returnItems = returnItems; } + public ReturnRequest fundSplit(FundSplit fundSplit) { + + this.fundSplit = fundSplit; + return this; + } + + /** + * Get fundSplit + * + * @return fundSplit + **/ + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FundSplit getFundSplit() { + return fundSplit; + } + + @JsonProperty(JSON_PROPERTY_FUND_SPLIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFundSplit(FundSplit fundSplit) { + this.fundSplit = fundSplit; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -132,12 +161,13 @@ public boolean equals(Object o) { ReturnRequest returnRequest = (ReturnRequest) o; return Objects.equals(this.returnType, returnRequest.returnType) && Objects.equals(this.returnReason, returnRequest.returnReason) && - Objects.equals(this.returnItems, returnRequest.returnItems); + Objects.equals(this.returnItems, returnRequest.returnItems) && + Objects.equals(this.fundSplit, returnRequest.fundSplit); } @Override public int hashCode() { - return Objects.hash(returnType, returnReason, returnItems); + return Objects.hash(returnType, returnReason, returnItems, fundSplit); } @Override @@ -147,6 +177,7 @@ public String toString() { sb.append(" returnType: ").append(toIndentedString(returnType)).append("\n"); sb.append(" returnReason: ").append(toIndentedString(returnReason)).append("\n"); sb.append(" returnItems: ").append(toIndentedString(returnItems)).append("\n"); + sb.append(" fundSplit: ").append(toIndentedString(fundSplit)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/transformer/ApplePayTransformer.java b/lib/src/main/java/com/payone/commerce/platform/lib/transformer/ApplePayTransformer.java index c859336..388ffe0 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/transformer/ApplePayTransformer.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/transformer/ApplePayTransformer.java @@ -6,7 +6,7 @@ import com.payone.commerce.platform.lib.models.PaymentProduct302SpecificInput; import com.payone.commerce.platform.lib.models.PaymentProductId; import com.payone.commerce.platform.lib.models.ApplePaymentDataTokenInformation.VersionEnum; -import com.payone.commerce.platform.lib.models.PaymentProduct302SpecificInput.NetworkEnum; +import com.payone.commerce.platform.lib.models.MobilePaymentNetwork; import com.payone.commerce.platform.lib.models.applepay.ApplePayPayment; public class ApplePayTransformer { @@ -42,7 +42,7 @@ static MobilePaymentMethodSpecificInput transformApplePayPaymentToMobilePaymentM PaymentProduct302SpecificInput paymentProduct302SpecificInput = new PaymentProduct302SpecificInput(); ApplePaymentDataTokenInformation applePaymentDataTokenInformation = new ApplePaymentDataTokenInformation(); if (network != null) { - paymentProduct302SpecificInput.setNetwork(NetworkEnum.fromValue(network.toUpperCase())); + paymentProduct302SpecificInput.setNetwork(MobilePaymentNetwork.fromValue(network.toUpperCase())); } if (version != null) { applePaymentDataTokenInformation.setVersion(VersionEnum.fromValue(version)); diff --git a/lib/src/main/java/com/payone/commerce/platform/lib/utils/ServerMetaInfo.java b/lib/src/main/java/com/payone/commerce/platform/lib/utils/ServerMetaInfo.java index d045c40..bf17d3e 100644 --- a/lib/src/main/java/com/payone/commerce/platform/lib/utils/ServerMetaInfo.java +++ b/lib/src/main/java/com/payone/commerce/platform/lib/utils/ServerMetaInfo.java @@ -18,7 +18,7 @@ public static ServerMetaInfo withDefaults(String integrator) { return new ServerMetaInfo() .platformIdentifier(String.format("%s, java version is: %s", System.getProperty("os.name"), System.getProperty("java.version"))) - .sdkIdentifier("JavaServerSDK/v1.6.0") + .sdkIdentifier("JavaServerSDK/v1.7.0") .sdkCreator("PAYONE GmbH") .integrator(integrator); } diff --git a/lib/src/test/java/com/payone/commerce/platform/lib/endpoints/CommerceCaseApiClientTest.java b/lib/src/test/java/com/payone/commerce/platform/lib/endpoints/CommerceCaseApiClientTest.java index cc3247d..b3d427b 100644 --- a/lib/src/test/java/com/payone/commerce/platform/lib/endpoints/CommerceCaseApiClientTest.java +++ b/lib/src/test/java/com/payone/commerce/platform/lib/endpoints/CommerceCaseApiClientTest.java @@ -23,7 +23,7 @@ import com.payone.commerce.platform.lib.models.CommerceCaseResponse; import com.payone.commerce.platform.lib.models.CreateCommerceCaseRequest; import com.payone.commerce.platform.lib.models.CreateCommerceCaseResponse; -import com.payone.commerce.platform.lib.models.Customer; +import com.payone.commerce.platform.lib.models.PatchCommerceCaseRequest; import com.payone.commerce.platform.lib.testutils.ApiResponseMocks; import com.payone.commerce.platform.lib.testutils.TestConfig; @@ -280,7 +280,7 @@ void updateCommerceCaseRequestSuccessful() throws InvalidKeyException, IOExcepti doReturn(response).when(commerceCaseApiClient).getResponse(any()); when(commerceCaseApiClient.getResponse(any())).thenReturn(response); - Customer payload = new Customer(); + PatchCommerceCaseRequest payload = new PatchCommerceCaseRequest(); assertDoesNotThrow(() -> commerceCaseApiClient.updateCommerceCaseRequest("1", "3", payload)); @@ -297,7 +297,7 @@ void updateCommerceCaseRequestUnsuccessful() throws InvalidKeyException, IOExcep doReturn(response).when(commerceCaseApiClient).getResponse(any()); ApiErrorResponseException e = assertThrows(ApiErrorResponseException.class, () -> { - Customer payload = new Customer(); + PatchCommerceCaseRequest payload = new PatchCommerceCaseRequest(); commerceCaseApiClient.updateCommerceCaseRequest("1", "3", payload); }); int s = e.getErrors().get(0).getHttpStatusCode(); @@ -315,7 +315,7 @@ void updateCommerceCaseRequestUnsuccessful500() throws InvalidKeyException, IOEx doReturn(response).when(commerceCaseApiClient).getResponse(any()); ApiResponseRetrievalException e = assertThrows(ApiResponseRetrievalException.class, () -> { - Customer payload = new Customer(); + PatchCommerceCaseRequest payload = new PatchCommerceCaseRequest(); commerceCaseApiClient.updateCommerceCaseRequest("1", "3", payload); }); int code = e.getStatusCode(); @@ -333,14 +333,14 @@ void updateCommerceCaseRequestNullParams() throws InvalidKeyException { String m; e = assertThrows(IllegalArgumentException.class, () -> { - Customer payload = new Customer(); + PatchCommerceCaseRequest payload = new PatchCommerceCaseRequest(); commerceCaseApiClient.updateCommerceCaseRequest(null, "2", payload); }); m = e.getMessage(); assertEquals("Merchant ID is required", m); e = assertThrows(IllegalArgumentException.class, () -> { - Customer payload = new Customer(); + PatchCommerceCaseRequest payload = new PatchCommerceCaseRequest(); commerceCaseApiClient.updateCommerceCaseRequest("1", null, payload); }); m = e.getMessage(); diff --git a/lib/src/test/java/com/payone/commerce/platform/lib/transformer/ApplePayTransformerTest.java b/lib/src/test/java/com/payone/commerce/platform/lib/transformer/ApplePayTransformerTest.java index c364974..67d7569 100644 --- a/lib/src/test/java/com/payone/commerce/platform/lib/transformer/ApplePayTransformerTest.java +++ b/lib/src/test/java/com/payone/commerce/platform/lib/transformer/ApplePayTransformerTest.java @@ -5,6 +5,7 @@ import com.payone.commerce.platform.lib.models.ApplePaymentDataTokenHeaderInformation; import com.payone.commerce.platform.lib.models.ApplePaymentDataTokenInformation; import com.payone.commerce.platform.lib.models.MobilePaymentMethodSpecificInput; +import com.payone.commerce.platform.lib.models.MobilePaymentNetwork; import com.payone.commerce.platform.lib.models.PaymentProduct302SpecificInput; import com.payone.commerce.platform.lib.models.PaymentProductId; import com.payone.commerce.platform.lib.models.applepay.ApplePayPayment; @@ -64,7 +65,7 @@ void testApplePayPaymentToMobilePaymentMethodSpecificInput() { .ephemeralKey(null) .paymentProduct302SpecificInput( new PaymentProduct302SpecificInput() - .network(PaymentProduct302SpecificInput.NetworkEnum.MASTERCARD) + .network(MobilePaymentNetwork.MASTERCARD) .token( new ApplePaymentDataTokenInformation() .signature(null) diff --git a/package-lock.json b/package-lock.json index 9c84582..fec5124 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pcp-serversdk-java", - "version": "1.6.0", + "version": "1.7.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pcp-serversdk-java", - "version": "1.6.0", + "version": "1.7.0", "devDependencies": { "@commitlint/cli": "19.4.0", "@commitlint/config-conventional": "19.2.2", diff --git a/package.json b/package.json index 7a916fd..65b2f61 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pcp-serversdk-java", - "version": "1.6.0", + "version": "1.7.0", "type": "commonjs", "scripts": { "changelog": "conventional-changelog -i CHANGELOG.md -s --config ./changelog.config.js" diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..9b561b2 --- /dev/null +++ b/test.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Run the lib tests, optionally targeting a specific Java version. +# Usage: +# ./test.sh # uses the current JAVA_HOME / default toolchain + + +./gradlew :lib:test