diff --git a/api-definition.yaml b/api-definition.yaml index 72f9579..15b5350 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: @@ -4830,4 +4981,4 @@ components: enum: - first - subsequent - x-enum-to-string: false + x-enum-to-string: false \ No newline at end of file diff --git a/example/main.py b/example/main.py index 722666d..26eed0d 100644 --- a/example/main.py +++ b/example/main.py @@ -478,7 +478,7 @@ async def run_create_payment_information(): create_request = PaymentInformationRequest( amountOfMoney=AmountOfMoney(amount=1000, currencyCode="EUR"), - type=PaymentType.Sale, + type=PaymentType.SALE, paymentChannel=PaymentChannel.ECOMMERCE, paymentProductId=771, merchantReference="p-" + UNIQUE_MERCHANT_REFERENCE, diff --git a/pcp_serversdk_python/endpoints/CommerceCaseApiClient.py b/pcp_serversdk_python/endpoints/CommerceCaseApiClient.py index 8065ee6..980158e 100644 --- a/pcp_serversdk_python/endpoints/CommerceCaseApiClient.py +++ b/pcp_serversdk_python/endpoints/CommerceCaseApiClient.py @@ -9,7 +9,7 @@ CommerceCaseResponse, CreateCommerceCaseRequest, CreateCommerceCaseResponse, - Customer, + PatchCommerceCaseRequest, ) from ..queries import GetCommerceCasesQuery from .BaseApiClient import ( @@ -67,7 +67,7 @@ async def get_commerce_cases_request( return await self.make_api_call_with_type(req, list[CommerceCaseResponse]) async def update_commerce_case_request( - self, merchant_id: str, commerce_case_id: str, payload: Customer + self, merchant_id: str, commerce_case_id: str, payload: PatchCommerceCaseRequest ): self._validate_inputs(merchant_id, commerce_case_id) @@ -80,7 +80,7 @@ async def update_commerce_case_request( "PATCH", url, headers={"Content-Type": self.CONTENT_TYPE}, - data=json.dumps({"customer": asdict(payload)}), + data=json.dumps(asdict(payload)), ) return await self.make_api_call(req) diff --git a/pcp_serversdk_python/models/ActionType.py b/pcp_serversdk_python/models/ActionType.py index 5e7d462..e36f8d6 100644 --- a/pcp_serversdk_python/models/ActionType.py +++ b/pcp_serversdk_python/models/ActionType.py @@ -1,7 +1,7 @@ from enum import Enum -class ActionType(Enum): +class ActionType(str, Enum): """Action merchants needs to take in the online payment process.""" REDIRECT = "REDIRECT" # The customer needs to be redirected using the details found in redirectData diff --git a/pcp_serversdk_python/models/AllowedPaymentActions.py b/pcp_serversdk_python/models/AllowedPaymentActions.py index 094760c..ae58b96 100644 --- a/pcp_serversdk_python/models/AllowedPaymentActions.py +++ b/pcp_serversdk_python/models/AllowedPaymentActions.py @@ -2,5 +2,5 @@ class AllowedPaymentActions(str, Enum): - OrderManagement = "ORDER_MANAGEMENT" - PaymentExecution = "PAYMENT_EXECUTION" + ORDER_MANAGEMENT = "ORDER_MANAGEMENT" + PAYMENT_EXECUTION = "PAYMENT_EXECUTION" diff --git a/pcp_serversdk_python/models/AvsResult.py b/pcp_serversdk_python/models/AvsResult.py index 0b9f628..60567b7 100644 --- a/pcp_serversdk_python/models/AvsResult.py +++ b/pcp_serversdk_python/models/AvsResult.py @@ -1,7 +1,7 @@ from enum import Enum -class AvsResult(Enum): +class AvsResult(str, Enum): """Result of the Address Verification Service checks.""" A = "A" # Address (Street) matches, Zip does not diff --git a/pcp_serversdk_python/models/CapturePaymentRequest.py b/pcp_serversdk_python/models/CapturePaymentRequest.py index ad8f5d5..a043a3a 100644 --- a/pcp_serversdk_python/models/CapturePaymentRequest.py +++ b/pcp_serversdk_python/models/CapturePaymentRequest.py @@ -3,6 +3,7 @@ from .CancellationReason import CancellationReason from .DeliveryInformation import DeliveryInformation +from .FundSplit import FundSplit from .PaymentReferences import PaymentReferences @@ -13,3 +14,4 @@ class CapturePaymentRequest: cancellationReason: Optional[CancellationReason] = None references: Optional[PaymentReferences] = None delivery: Optional[DeliveryInformation] = None + fundSplit: Optional[FundSplit] = None diff --git a/pcp_serversdk_python/models/CapturePaymentResponse.py b/pcp_serversdk_python/models/CapturePaymentResponse.py index 02f9943..f1b3e7d 100644 --- a/pcp_serversdk_python/models/CapturePaymentResponse.py +++ b/pcp_serversdk_python/models/CapturePaymentResponse.py @@ -2,6 +2,7 @@ from typing import Optional from .CaptureOutput import CaptureOutput +from .FundSplit import FundSplit from .PaymentStatusOutput import PaymentStatusOutput from .StatusValue import StatusValue @@ -12,3 +13,4 @@ class CapturePaymentResponse: status: Optional[StatusValue] = None statusOutput: Optional[PaymentStatusOutput] = None id: Optional[str] = None + fundSplit: Optional[FundSplit] = None diff --git a/pcp_serversdk_python/models/CartItemInput.py b/pcp_serversdk_python/models/CartItemInput.py index dc656b8..b04a0fa 100644 --- a/pcp_serversdk_python/models/CartItemInput.py +++ b/pcp_serversdk_python/models/CartItemInput.py @@ -2,6 +2,7 @@ from typing import Optional from .CartItemInvoiceData import CartItemInvoiceData +from .CartItemSupplierReferences import CartItemSupplierReferences from .OrderLineDetailsInput import OrderLineDetailsInput @@ -9,3 +10,4 @@ class CartItemInput: invoiceData: Optional[CartItemInvoiceData] = None orderLineDetails: Optional[OrderLineDetailsInput] = None + supplierReferences: Optional[CartItemSupplierReferences] = None diff --git a/pcp_serversdk_python/models/CartItemPatch.py b/pcp_serversdk_python/models/CartItemPatch.py index dac381c..2b05103 100644 --- a/pcp_serversdk_python/models/CartItemPatch.py +++ b/pcp_serversdk_python/models/CartItemPatch.py @@ -2,6 +2,7 @@ from typing import Optional from .CartItemInvoiceData import CartItemInvoiceData +from .CartItemSupplierReferences import CartItemSupplierReferences from .OrderLineDetailsPatch import OrderLineDetailsPatch @@ -9,3 +10,4 @@ class CartItemPatch: invoiceData: Optional[CartItemInvoiceData] = None orderLineDetails: Optional[OrderLineDetailsPatch] = None + supplierReferences: Optional[CartItemSupplierReferences] = None diff --git a/pcp_serversdk_python/models/CartItemResult.py b/pcp_serversdk_python/models/CartItemResult.py index e851629..6f05d6e 100644 --- a/pcp_serversdk_python/models/CartItemResult.py +++ b/pcp_serversdk_python/models/CartItemResult.py @@ -2,6 +2,7 @@ from typing import Optional from .CartItemInvoiceData import CartItemInvoiceData +from .CartItemSupplierReferences import CartItemSupplierReferences from .OrderLineDetailsResult import OrderLineDetailsResult @@ -9,3 +10,4 @@ class CartItemResult: invoiceData: Optional[CartItemInvoiceData] = None orderLineDetails: Optional[OrderLineDetailsResult] = None + supplierReferences: Optional[CartItemSupplierReferences] = None diff --git a/pcp_serversdk_python/models/CartItemSupplierReferences.py b/pcp_serversdk_python/models/CartItemSupplierReferences.py new file mode 100644 index 0000000..a05dd7d --- /dev/null +++ b/pcp_serversdk_python/models/CartItemSupplierReferences.py @@ -0,0 +1,13 @@ +from dataclasses import dataclass +from typing import Optional + + +@dataclass(kw_only=True) +class CartItemSupplierReferences: + """References of the seller of a cart item.""" + + supplierId: Optional[str] = None + """Identifier of the supplier/seller. Maximum length: 64 characters.""" + + orderReference: Optional[str] = None + """Order reference of the supplier/seller. Maximum length: 64 characters.""" diff --git a/pcp_serversdk_python/models/CreatePaymentResponse.py b/pcp_serversdk_python/models/CreatePaymentResponse.py index 24d2892..474dd4a 100644 --- a/pcp_serversdk_python/models/CreatePaymentResponse.py +++ b/pcp_serversdk_python/models/CreatePaymentResponse.py @@ -1,6 +1,7 @@ from dataclasses import dataclass from typing import Optional +from .FundSplit import FundSplit from .MerchantAction import MerchantAction from .PaymentCreationOutput import PaymentCreationOutput from .PaymentResponse import PaymentResponse @@ -12,3 +13,4 @@ class CreatePaymentResponse: merchantAction: Optional[MerchantAction] = None payment: Optional[PaymentResponse] = None paymentExecutionId: Optional[str] = None + fundSplit: Optional[FundSplit] = None diff --git a/pcp_serversdk_python/models/DeliverRequest.py b/pcp_serversdk_python/models/DeliverRequest.py index ebc4966..201ce5a 100644 --- a/pcp_serversdk_python/models/DeliverRequest.py +++ b/pcp_serversdk_python/models/DeliverRequest.py @@ -4,6 +4,7 @@ from .CancellationReason import CancellationReason from .DeliverItem import DeliverItem from .DeliverType import DeliverType +from .FundSplit import FundSplit @dataclass(kw_only=True) @@ -12,3 +13,4 @@ class DeliverRequest: isFinal: bool = False cancellationReason: Optional[CancellationReason] = None deliverItems: Optional[list[DeliverItem]] = None + fundSplit: Optional[FundSplit] = None diff --git a/pcp_serversdk_python/models/FundDistribution.py b/pcp_serversdk_python/models/FundDistribution.py new file mode 100644 index 0000000..9c4a89b --- /dev/null +++ b/pcp_serversdk_python/models/FundDistribution.py @@ -0,0 +1,36 @@ +from dataclasses import dataclass +from typing import Optional + +from .FundDistributionType import FundDistributionType + + +@dataclass(kw_only=True) +class FundDistribution: + """Instructions for distributing funds to multiple sellers/partners in a marketplace context.""" + + accountId: str + """Unique identifier of the beneficiary (seller/partner/sub-account) to receive funds.""" + + amount: int + """Amount in cents and always having 2 decimals, in the currency of the original transaction.""" + + type: FundDistributionType + """Classification or purpose of the fund distribution to the receiving account within a given order. + - `SELLER_REVENUE` + - `COMMISSION_FEE` + - `SHIPPING_COSTS` + - `TAX` + - `PLATFORM_FEE` + - `OTHER`""" + + id: Optional[str] = None + """Unique identifier of the fund distribution entry. Read-only UUID.""" + + description: Optional[str] = None + """Human-readable description for reconciliation. Appears on reports.""" + + merchantReference: Optional[str] = None + """Unique reference of the part of the fund/payment to be distributed.""" + + merchantParameters: Optional[str] = None + """Additional parameters for the transaction in JSON format.""" diff --git a/pcp_serversdk_python/models/FundDistributionType.py b/pcp_serversdk_python/models/FundDistributionType.py new file mode 100644 index 0000000..16b6abb --- /dev/null +++ b/pcp_serversdk_python/models/FundDistributionType.py @@ -0,0 +1,10 @@ +from enum import Enum + + +class FundDistributionType(str, Enum): + SELLER_REVENUE = "SELLER_REVENUE" + COMMISSION_FEE = "COMMISSION_FEE" + SHIPPING_COSTS = "SHIPPING_COSTS" + TAX = "TAX" + PLATFORM_FEE = "PLATFORM_FEE" + OTHER = "OTHER" diff --git a/pcp_serversdk_python/models/FundSplit.py b/pcp_serversdk_python/models/FundSplit.py new file mode 100644 index 0000000..ab8c35b --- /dev/null +++ b/pcp_serversdk_python/models/FundSplit.py @@ -0,0 +1,18 @@ +from dataclasses import dataclass +from typing import Optional + +from .FundDistribution import FundDistribution + + +@dataclass(kw_only=True) +class FundSplit: + """Instructions for distributing funds in a marketplace context.""" + + id: Optional[str] = None + """Unique identifier of the fund split. Read-only UUID.""" + + paymentEventId: Optional[str] = None + """Unique identifier of the payment event. Read-only UUID.""" + + fundDistributions: Optional[list[FundDistribution]] = None + """List of fund distribution instructions.""" diff --git a/pcp_serversdk_python/models/MobilePaymentMethodSpecificInput.py b/pcp_serversdk_python/models/MobilePaymentMethodSpecificInput.py index d375a38..8dff55c 100644 --- a/pcp_serversdk_python/models/MobilePaymentMethodSpecificInput.py +++ b/pcp_serversdk_python/models/MobilePaymentMethodSpecificInput.py @@ -4,6 +4,7 @@ from .AuthorizationMode import AuthorizationMode from .MobilePaymentThreeDSecure import MobilePaymentThreeDSecure from .PaymentProduct302SpecificInput import PaymentProduct302SpecificInput +from .PaymentProduct5002SpecificInput import PaymentProduct5002SpecificInput @dataclass(kw_only=True) @@ -33,3 +34,6 @@ class MobilePaymentMethodSpecificInput: paymentProduct302SpecificInput: Optional[PaymentProduct302SpecificInput] = None """Specific input for payment product 302.""" + + paymentProduct5002SpecificInput: Optional[PaymentProduct5002SpecificInput] = None + """Specific input for payment product 5002 (Click To Pay).""" diff --git a/pcp_serversdk_python/models/Network.py b/pcp_serversdk_python/models/MobilePaymentNetwork.py similarity index 80% rename from pcp_serversdk_python/models/Network.py rename to pcp_serversdk_python/models/MobilePaymentNetwork.py index bd00fdc..153bfbe 100644 --- a/pcp_serversdk_python/models/Network.py +++ b/pcp_serversdk_python/models/MobilePaymentNetwork.py @@ -1,7 +1,7 @@ from enum import Enum -class Network(str, Enum): +class MobilePaymentNetwork(str, Enum): MASTERCARD = "MASTERCARD" VISA = "VISA" AMEX = "AMEX" diff --git a/pcp_serversdk_python/models/OrderRequest.py b/pcp_serversdk_python/models/OrderRequest.py index b438562..6333177 100644 --- a/pcp_serversdk_python/models/OrderRequest.py +++ b/pcp_serversdk_python/models/OrderRequest.py @@ -1,6 +1,7 @@ from dataclasses import dataclass from typing import Optional +from .FundSplit import FundSplit from .OrderItem import OrderItem from .OrderType import OrderType from .PaymentMethodSpecificInput import PaymentMethodSpecificInput @@ -13,3 +14,4 @@ class OrderRequest: orderReferences: Optional[References] = None items: Optional[list[OrderItem]] = None paymentMethodSpecificInput: Optional[PaymentMethodSpecificInput] = None + fundSplit: Optional[FundSplit] = None diff --git a/pcp_serversdk_python/models/OrderType.py b/pcp_serversdk_python/models/OrderType.py index 1304c31..24cd57b 100644 --- a/pcp_serversdk_python/models/OrderType.py +++ b/pcp_serversdk_python/models/OrderType.py @@ -2,5 +2,5 @@ class OrderType(str, Enum): - Full = "FULL" - Partial = "PARTIAL" + FULL = "FULL" + PARTIAL = "PARTIAL" diff --git a/pcp_serversdk_python/models/PausePaymentRequest.py b/pcp_serversdk_python/models/PausePaymentRequest.py index 2841300..39a278a 100644 --- a/pcp_serversdk_python/models/PausePaymentRequest.py +++ b/pcp_serversdk_python/models/PausePaymentRequest.py @@ -1,11 +1,6 @@ from dataclasses import dataclass -from .RefreshType import RefreshType - @dataclass(kw_only=True) class PausePaymentRequest: - """Request to refresh the payment status of a specific payment.""" - - refreshType: RefreshType - """Type of refresh action to be performed.""" + """Request to pause a payment for a specific payment method.""" diff --git a/pcp_serversdk_python/models/PaymentEvent.py b/pcp_serversdk_python/models/PaymentEvent.py index 5196e94..4c2770d 100644 --- a/pcp_serversdk_python/models/PaymentEvent.py +++ b/pcp_serversdk_python/models/PaymentEvent.py @@ -12,6 +12,12 @@ class PaymentEvent: """Detailed information regarding an occurred payment event.""" + paymentEventId: Optional[str] = None + """Unique identifier of the payment event. Read-only UUID.""" + + creationDateTime: Optional[str] = None + """The date and time when the payment event was created. Read-only.""" + type: Optional[PaymentType] = None """Type of payment event.""" diff --git a/pcp_serversdk_python/models/PaymentExecution.py b/pcp_serversdk_python/models/PaymentExecution.py index 57ad283..28ec465 100644 --- a/pcp_serversdk_python/models/PaymentExecution.py +++ b/pcp_serversdk_python/models/PaymentExecution.py @@ -4,6 +4,7 @@ from .BankPayoutMethodSpecificInput import BankPayoutMethodSpecificInput from .CardPaymentMethodSpecificInput import CardPaymentMethodSpecificInput from .FinancingPaymentMethodSpecificInput import FinancingPaymentMethodSpecificInput +from .FundSplit import FundSplit from .MobilePaymentMethodSpecificInput import MobilePaymentMethodSpecificInput from .PaymentChannel import PaymentChannel from .PaymentEvent import PaymentEvent @@ -49,3 +50,6 @@ class PaymentExecution: events: Optional[list[PaymentEvent]] = None """List of payment events associated with this payment execution.""" + + fundSplits: Optional[list[FundSplit]] = None + """List of fund splits associated with this payment execution.""" diff --git a/pcp_serversdk_python/models/PaymentExecutionSpecificInput.py b/pcp_serversdk_python/models/PaymentExecutionSpecificInput.py index 4867258..a71b794 100644 --- a/pcp_serversdk_python/models/PaymentExecutionSpecificInput.py +++ b/pcp_serversdk_python/models/PaymentExecutionSpecificInput.py @@ -2,6 +2,7 @@ from typing import Optional from .AmountOfMoney import AmountOfMoney +from .FundSplit import FundSplit from .References import References from .ShoppingCartInput import ShoppingCartInput @@ -11,3 +12,4 @@ class PaymentExecutionSpecificInput: amountOfMoney: Optional[AmountOfMoney] = None shoppingCart: Optional[ShoppingCartInput] = None paymentReferences: References + fundSplit: Optional[FundSplit] = None diff --git a/pcp_serversdk_python/models/PaymentProduct302SpecificInput.py b/pcp_serversdk_python/models/PaymentProduct302SpecificInput.py index e29a16d..9de423a 100644 --- a/pcp_serversdk_python/models/PaymentProduct302SpecificInput.py +++ b/pcp_serversdk_python/models/PaymentProduct302SpecificInput.py @@ -1,18 +1,16 @@ from dataclasses import dataclass -from enum import Enum, auto +from enum import Enum from typing import Optional from .ApplePaymentDataTokenInformation import ApplePaymentDataTokenInformation -from .Network import Network +from .MobilePaymentNetwork import MobilePaymentNetwork -class IntegrationType(Enum): +class IntegrationType(str, Enum): """Type of Apple Pay integration.""" - MERCHANT_CERTIFICATE = ( - auto() - ) # using your own certificate (paid Apple Pay account needed) - MASS_ENABLEMENT = auto() # using PAYONE certificate + MERCHANT_CERTIFICATE = "MERCHANT_CERTIFICATE" # using your own certificate (paid Apple Pay account needed) + MASS_ENABLEMENT = "MASS_ENABLEMENT" # using PAYONE certificate @dataclass(kw_only=True) @@ -24,7 +22,7 @@ class PaymentProduct302SpecificInput: - `MERCHANT_CERTIFICATE`: using your own certificate (paid Apple Pay account needed). - `MASS_ENABLEMENT`: using PAYONE certificate.""" - network: Optional[Network] = None + network: Optional[MobilePaymentNetwork] = None """Network/Scheme of the card used for the payment. - `MASTERCARD` - `VISA` diff --git a/pcp_serversdk_python/models/PaymentProduct5002SpecificInput.py b/pcp_serversdk_python/models/PaymentProduct5002SpecificInput.py new file mode 100644 index 0000000..defc077 --- /dev/null +++ b/pcp_serversdk_python/models/PaymentProduct5002SpecificInput.py @@ -0,0 +1,18 @@ +from dataclasses import dataclass +from typing import Optional + +from .MobilePaymentNetwork import MobilePaymentNetwork + + +@dataclass(kw_only=True) +class PaymentProduct5002SpecificInput: + """Object containing specific input details for Click To Pay payment transactions.""" + + network: Optional[MobilePaymentNetwork] = None + """Network/Scheme of the card used for the payment.""" + + paymentCheckoutData: Optional[str] = None + """The payment checkout data for Click To Pay.""" + + srcDpaId: Optional[str] = None + """The SRC DPA ID. Maximum length: 64 characters.""" diff --git a/pcp_serversdk_python/models/PaymentType.py b/pcp_serversdk_python/models/PaymentType.py index 474d33f..3cf5783 100644 --- a/pcp_serversdk_python/models/PaymentType.py +++ b/pcp_serversdk_python/models/PaymentType.py @@ -2,12 +2,12 @@ class PaymentType(str, Enum): - Sale = "SALE" - Reservation = "RESERVATION" - Capture = "CAPTURE" - Refund = "REFUND" - Reversal = "REVERSAL" - Chargeback = "CHARGEBACK" - ChargebackReversal = "CHARGEBACK_REVERSAL" - CreditNote = "CREDIT_NOTE" - DebitNote = "DEBIT_NOTE" + SALE = "SALE" + RESERVATION = "RESERVATION" + CAPTURE = "CAPTURE" + REFUND = "REFUND" + REVERSAL = "REVERSAL" + CHARGEBACK = "CHARGEBACK" + CHARGEBACK_REVERSAL = "CHARGEBACK_REVERSAL" + CREDIT_NOTE = "CREDIT_NOTE" + DEBIT_NOTE = "DEBIT_NOTE" diff --git a/pcp_serversdk_python/models/RecurringPaymentSequenceIndicator.py b/pcp_serversdk_python/models/RecurringPaymentSequenceIndicator.py index ec6e79d..f8ec615 100644 --- a/pcp_serversdk_python/models/RecurringPaymentSequenceIndicator.py +++ b/pcp_serversdk_python/models/RecurringPaymentSequenceIndicator.py @@ -1,7 +1,7 @@ from enum import Enum -class RecurringPaymentSequenceIndicator(Enum): +class RecurringPaymentSequenceIndicator(str, Enum): """Enum for recurring payment sequence indicator values.\n Note: For any first of a recurring the system will automatically create a token as you will need to use a token for any subsequent recurring transactions. In case a diff --git a/pcp_serversdk_python/models/RedirectPaymentMethodSpecificInput.py b/pcp_serversdk_python/models/RedirectPaymentMethodSpecificInput.py index 7d00299..cf466c6 100644 --- a/pcp_serversdk_python/models/RedirectPaymentMethodSpecificInput.py +++ b/pcp_serversdk_python/models/RedirectPaymentMethodSpecificInput.py @@ -14,7 +14,6 @@ class RedirectPaymentMethodSpecificInput: reportingToken: Optional[str] = None tokenize: Optional[bool] = None paymentProductId: Optional[int] = None - javaScriptSdkFlow: Optional[bool] = False paymentProduct840SpecificInput: Optional[RedirectPaymentProduct840SpecificInput] = ( None ) diff --git a/pcp_serversdk_python/models/RedirectPaymentMethodSpecificOutput.py b/pcp_serversdk_python/models/RedirectPaymentMethodSpecificOutput.py index a45d9fa..5a35a97 100644 --- a/pcp_serversdk_python/models/RedirectPaymentMethodSpecificOutput.py +++ b/pcp_serversdk_python/models/RedirectPaymentMethodSpecificOutput.py @@ -7,7 +7,6 @@ @dataclass(kw_only=True) class RedirectPaymentMethodSpecificOutput: paymentProductId: Optional[int] = None - javaScriptSdkFlow: Optional[bool] = False paymentProduct840SpecificOutput: Optional[PaymentProduct840SpecificOutput] = None paymentProcessingToken: Optional[str] = None reportingToken: Optional[str] = None diff --git a/pcp_serversdk_python/models/RefundPaymentResponse.py b/pcp_serversdk_python/models/RefundPaymentResponse.py index a0275d9..8d62908 100644 --- a/pcp_serversdk_python/models/RefundPaymentResponse.py +++ b/pcp_serversdk_python/models/RefundPaymentResponse.py @@ -1,6 +1,7 @@ from dataclasses import dataclass from typing import Optional +from .FundSplit import FundSplit from .PaymentStatusOutput import PaymentStatusOutput from .RefundOutput import RefundOutput from .StatusValue import StatusValue @@ -12,3 +13,4 @@ class RefundPaymentResponse: status: Optional[StatusValue] = None statusOutput: Optional[PaymentStatusOutput] = None id: Optional[str] = None + fundSplit: Optional[FundSplit] = None diff --git a/pcp_serversdk_python/models/RefundRequest.py b/pcp_serversdk_python/models/RefundRequest.py index 9a3d5be..00de25b 100644 --- a/pcp_serversdk_python/models/RefundRequest.py +++ b/pcp_serversdk_python/models/RefundRequest.py @@ -1,6 +1,7 @@ from dataclasses import dataclass, field from typing import Optional +from .FundSplit import FundSplit from .PaymentReferences import PaymentReferences from .PositiveAmountOfMoney import PositiveAmountOfMoney from .ReturnInformation import ReturnInformation @@ -14,6 +15,7 @@ class RefundRequest: return_info: Optional[ReturnInformation] = field( default=None, metadata={"name": "return"} ) + fundSplit: Optional[FundSplit] = None # To adhere to the PAYONE API Schema, we need to use the name "return" externally. # However, to avoid conflicts with Python's reserved keyword "return", @@ -27,5 +29,6 @@ def to_dict(self): "amountOfMoney": self.amountOfMoney, "references": self.references, "return": self.return_info, + "fundSplit": self.fundSplit, } return result diff --git a/pcp_serversdk_python/models/ReturnRequest.py b/pcp_serversdk_python/models/ReturnRequest.py index a052dfb..81a4913 100644 --- a/pcp_serversdk_python/models/ReturnRequest.py +++ b/pcp_serversdk_python/models/ReturnRequest.py @@ -1,6 +1,7 @@ from dataclasses import dataclass from typing import Optional +from .FundSplit import FundSplit from .ReturnItem import ReturnItem from .ReturnType import ReturnType @@ -10,3 +11,4 @@ class ReturnRequest: returnType: Optional[ReturnType] = None returnReason: Optional[str] = None returnItems: Optional[list[ReturnItem]] = None + fundSplit: Optional[FundSplit] = None diff --git a/pcp_serversdk_python/models/ReturnType.py b/pcp_serversdk_python/models/ReturnType.py index f28ee88..f2d6e48 100644 --- a/pcp_serversdk_python/models/ReturnType.py +++ b/pcp_serversdk_python/models/ReturnType.py @@ -2,5 +2,5 @@ class ReturnType(str, Enum): - Full = "FULL" - Partial = "PARTIAL" + FULL = "FULL" + PARTIAL = "PARTIAL" diff --git a/pcp_serversdk_python/models/StatusCategoryValue.py b/pcp_serversdk_python/models/StatusCategoryValue.py index d942748..492d4ff 100644 --- a/pcp_serversdk_python/models/StatusCategoryValue.py +++ b/pcp_serversdk_python/models/StatusCategoryValue.py @@ -2,11 +2,11 @@ class StatusCategoryValue(str, Enum): - Created = "CREATED" - Unsuccessful = "UNSUCCESSFUL" - PendingPayment = "PENDING_PAYMENT" - PendingMerchant = "PENDING_MERCHANT" - PendingConnectOr3RdParty = "PENDING_CONNECT_OR_3RD_PARTY" - Completed = "COMPLETED" - Reversed = "REVERSED" - Refunded = "REFUNDED" + CREATED = "CREATED" + UNSUCCESSFUL = "UNSUCCESSFUL" + PENDING_PAYMENT = "PENDING_PAYMENT" + PENDING_MERCHANT = "PENDING_MERCHANT" + PENDING_CONNECT_OR_3RD_PARTY = "PENDING_CONNECT_OR_3RD_PARTY" + COMPLETED = "COMPLETED" + REVERSED = "REVERSED" + REFUNDED = "REFUNDED" diff --git a/pcp_serversdk_python/models/ThreeDSecureResults.py b/pcp_serversdk_python/models/ThreeDSecureResults.py index 2cc2dff..d34ce8d 100644 --- a/pcp_serversdk_python/models/ThreeDSecureResults.py +++ b/pcp_serversdk_python/models/ThreeDSecureResults.py @@ -7,5 +7,5 @@ @dataclass(kw_only=True) class ThreeDSecureResults: version: Optional[str] = None - scheme_eci: Optional[str] = None - applied_exemption: Optional[AppliedExemption] = None + schemeEci: Optional[str] = None + appliedExemption: Optional[AppliedExemption] = None diff --git a/pcp_serversdk_python/models/__init__.py b/pcp_serversdk_python/models/__init__.py index 67eb360..5fbc280 100644 --- a/pcp_serversdk_python/models/__init__.py +++ b/pcp_serversdk_python/models/__init__.py @@ -10,6 +10,7 @@ from .ApplePaymentDataTokenInformation import ApplePaymentDataTokenInformation from .ApplePaymentTokenVersion import ApplePaymentTokenVersion from .AppliedExemption import AppliedExemption +from .AuthenticationToken import AuthenticationToken from .AuthorizationMode import AuthorizationMode from .BankAccountInformation import BankAccountInformation from .BankPayoutMethodSpecificInput import BankPayoutMethodSpecificInput @@ -36,6 +37,7 @@ from .CartItemPatch import CartItemPatch from .CartItemResult import CartItemResult from .CartItemStatus import CartItemStatus +from .CartItemSupplierReferences import CartItemSupplierReferences from .CheckoutReferences import CheckoutReferences from .CheckoutResponse import CheckoutResponse from .CheckoutsResponse import CheckoutsResponse @@ -44,11 +46,11 @@ from .CompleteFinancingPaymentMethodSpecificInput import ( CompleteFinancingPaymentMethodSpecificInput, ) +from .CompleteOrderRequest import CompleteOrderRequest +from .CompletePaymentMethodSpecificInput import CompletePaymentMethodSpecificInput from .CompletePaymentProduct840SpecificInput import ( CompletePaymentProduct840SpecificInput, ) -from .CompleteOrderRequest import CompleteOrderRequest -from .CompletePaymentMethodSpecificInput import CompletePaymentMethodSpecificInput from .CompletePaymentRequest import CompletePaymentRequest from .CompletePaymentResponse import CompletePaymentResponse from .CompleteRedirectPaymentMethodSpecificInput import ( @@ -72,6 +74,9 @@ from .ExtendedCheckoutStatus import ExtendedCheckoutStatus from .FinancingPaymentMethodSpecificInput import FinancingPaymentMethodSpecificInput from .FinancingPaymentMethodSpecificOutput import FinancingPaymentMethodSpecificOutput +from .FundDistribution import FundDistribution +from .FundDistributionType import FundDistributionType +from .FundSplit import FundSplit from .Gender import Gender from .InstallmentOption import InstallmentOption from .LinkInformation import LinkInformation @@ -79,8 +84,8 @@ from .MerchantAction import MerchantAction from .MobilePaymentMethodSpecificInput import MobilePaymentMethodSpecificInput from .MobilePaymentMethodSpecificOutput import MobilePaymentMethodSpecificOutput +from .MobilePaymentNetwork import MobilePaymentNetwork from .MobilePaymentThreeDSecure import MobilePaymentThreeDSecure -from .Network import Network from .Order import Order from .OrderItem import OrderItem from .OrderLineDetailsInput import OrderLineDetailsInput @@ -114,6 +119,7 @@ from .PaymentProduct3391SpecificInput import PaymentProduct3391SpecificInput from .PaymentProduct3391SpecificOutput import PaymentProduct3391SpecificOutput from .PaymentProduct3392SpecificInput import PaymentProduct3392SpecificInput +from .PaymentProduct5002SpecificInput import PaymentProduct5002SpecificInput from .PaymentReferences import PaymentReferences from .PaymentResponse import PaymentResponse from .PaymentStatus import PaymentStatus @@ -182,6 +188,7 @@ "ApplePaymentDataTokenInformation", "ApplePaymentTokenVersion", "AppliedExemption", + "AuthenticationToken", "AuthorizationMode", "BankAccountInformation", "BankPayoutMethodSpecificInput", @@ -208,6 +215,7 @@ "CartItemPatch", "CartItemResult", "CartItemStatus", + "CartItemSupplierReferences", "CheckoutReferences", "CheckoutResponse", "CheckoutsResponse", @@ -238,6 +246,9 @@ "ExtendedCheckoutStatus", "FinancingPaymentMethodSpecificInput", "FinancingPaymentMethodSpecificOutput", + "FundDistribution", + "FundDistributionType", + "FundSplit", "Gender", "InstallmentOption", "LinkInformation", @@ -245,8 +256,8 @@ "MerchantAction", "MobilePaymentMethodSpecificInput", "MobilePaymentMethodSpecificOutput", + "MobilePaymentNetwork", "MobilePaymentThreeDSecure", - "Network", "Order", "OrderItem", "OrderLineDetailsInput", @@ -278,6 +289,7 @@ "PaymentProduct3391SpecificInput", "PaymentProduct3391SpecificOutput", "PaymentProduct3392SpecificInput", + "PaymentProduct5002SpecificInput", "PaymentReferences", "PaymentResponse", "PaymentStatus", diff --git a/pcp_serversdk_python/transformer/ApplepayTransformer.py b/pcp_serversdk_python/transformer/ApplepayTransformer.py index d6e37d4..ab00eb5 100644 --- a/pcp_serversdk_python/transformer/ApplepayTransformer.py +++ b/pcp_serversdk_python/transformer/ApplepayTransformer.py @@ -4,16 +4,16 @@ ApplePaymentTokenVersion, ApplePayPayment, MobilePaymentMethodSpecificInput, - Network, + MobilePaymentNetwork, PaymentProduct302SpecificInput, ) -def network_from_string(value: str) -> str: - for network in Network: +def network_from_string(value: str) -> MobilePaymentNetwork: + for network in MobilePaymentNetwork: if value.upper() == network.value: return network - raise TypeError(f"'{value}' can't represent a Network") + raise TypeError(f"'{value}' can't represent a MobilePaymentNetwork") def version_from_string(value: str) -> str: diff --git a/tests/endpoints/test_PaymentExecutionApiClient.py b/tests/endpoints/test_PaymentExecutionApiClient.py index 7055384..dae69d7 100644 --- a/tests/endpoints/test_PaymentExecutionApiClient.py +++ b/tests/endpoints/test_PaymentExecutionApiClient.py @@ -23,6 +23,7 @@ PaymentExecution, PaymentExecutionRequest, RefreshPaymentRequest, + RefreshType, RefundPaymentResponse, RefundRequest, ) @@ -176,7 +177,7 @@ async def test_pause_payment(payment_execution_api_client, mock_httpx_client): "commerce_case_id", "checkout_id", "payment_execution_id", - PausePaymentRequest(refreshType=None), + PausePaymentRequest(), ) assert response == expected_response @@ -198,7 +199,7 @@ async def test_refresh_payment(payment_execution_api_client, mock_httpx_client): "commerce_case_id", "checkout_id", "payment_execution_id", - RefreshPaymentRequest(refreshType=None), + RefreshPaymentRequest(refreshType=RefreshType.PAYMENT_EVENTS), ) assert response == expected_response @@ -213,7 +214,7 @@ async def test_pause_payment_with_invalid_payment_execution_id( "commerce_case_id", "checkout_id", "", - PausePaymentRequest(refreshType=None), + PausePaymentRequest(), ) @@ -227,7 +228,7 @@ async def test_refresh_payment_with_invalid_payment_execution_id( "commerce_case_id", "checkout_id", "", - RefreshPaymentRequest(refreshType=None), + RefreshPaymentRequest(refreshType=RefreshType.PAYMENT_EVENTS), ) diff --git a/tests/endpoints/test_PaymentInformationApiClient.py b/tests/endpoints/test_PaymentInformationApiClient.py index 65f78f3..3286e89 100644 --- a/tests/endpoints/test_PaymentInformationApiClient.py +++ b/tests/endpoints/test_PaymentInformationApiClient.py @@ -169,7 +169,7 @@ def create_payment_information(): amount=1000, currencyCode="EUR", ), - type=PaymentType.Capture, + type=PaymentType.CAPTURE, paymentChannel=PaymentChannel.ECOMMERCE, paymentProductId=1, merchantReference="merchantReference", diff --git a/tests/transformer/test_ApplepayTransformer.py b/tests/transformer/test_ApplepayTransformer.py index ca78bb4..a267ade 100644 --- a/tests/transformer/test_ApplepayTransformer.py +++ b/tests/transformer/test_ApplepayTransformer.py @@ -6,7 +6,7 @@ ApplePaymentTokenVersion, ApplePayPayment, MobilePaymentMethodSpecificInput, - Network, + MobilePaymentNetwork, PaymentProduct302SpecificInput, ) from pcp_serversdk_python.transformer.ApplepayTransformer import ( @@ -17,12 +17,12 @@ def test_network_from_string(): - assert network_from_string("mastercard") == Network.MASTERCARD - assert network_from_string("VISA") == Network.VISA - assert network_from_string("AmEx") == Network.AMEX - assert network_from_string("GIROCARD") == Network.GIROCARD - assert network_from_string("discover") == Network.DISCOVER - assert network_from_string("JCB") == Network.JCB + assert network_from_string("mastercard") == MobilePaymentNetwork.MASTERCARD + assert network_from_string("VISA") == MobilePaymentNetwork.VISA + assert network_from_string("AmEx") == MobilePaymentNetwork.AMEX + assert network_from_string("GIROCARD") == MobilePaymentNetwork.GIROCARD + assert network_from_string("discover") == MobilePaymentNetwork.DISCOVER + assert network_from_string("JCB") == MobilePaymentNetwork.JCB with pytest.raises(TypeError): network_from_string("UNKNOWN") @@ -57,7 +57,7 @@ def test_transform_apple_pay_payment_to_mobile_payment_method_specific_input(): publicKeyHash="publicKeyHash123", ephemeralKey="ephemeralPublicKey123", paymentProduct302SpecificInput=PaymentProduct302SpecificInput( - network=Network.VISA, + network=MobilePaymentNetwork.VISA, token=ApplePaymentDataTokenInformation( version=ApplePaymentTokenVersion.EC_V1, signature="signature123",