Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![PyPI - Version](https://img.shields.io/pypi/v/pcp_serversdk_python)
![PyPI - Downloads](https://img.shields.io/pypi/dw/pcp_serversdk_python)

Welcome to the Python SDK for the PAYONE Commerce Platform (api-version 1.35.0)! This repository contains a powerful, easy-to-use software development kit (SDK) designed to simplify the integration of online payment processing into your applications.
Welcome to the Python SDK for the PAYONE Commerce Platform (api-version 1.40.0)! This repository contains a powerful, easy-to-use software development kit (SDK) designed to simplify the integration of online payment processing into your applications.

## Table of Contents

Expand Down
726 changes: 378 additions & 348 deletions api-definition.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
from dataclasses import dataclass
from typing import Optional

from .CompletePaymentProduct840SpecificInput import (
CompletePaymentProduct840SpecificInput,
)
from .PaymentProduct3391SpecificInput import PaymentProduct3391SpecificInput


@dataclass(kw_only=True)
class CompletePaymentMethodSpecificInput:
paymentProduct3391SpecificInput: Optional[PaymentProduct3391SpecificInput] = None
paymentProduct840SpecificInput: Optional[
CompletePaymentProduct840SpecificInput
] = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from dataclasses import dataclass
from typing import Optional


@dataclass(kw_only=True)
class CompletePaymentProduct840SpecificInput:
"""Payload for completing PayPal payments via JavaScript SDK"""

javaScriptSdkFlow: bool = False
action: Optional[str] = None
6 changes: 6 additions & 0 deletions pcp_serversdk_python/models/CompletePaymentRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
from .CompleteFinancingPaymentMethodSpecificInput import (
CompleteFinancingPaymentMethodSpecificInput,
)
from .CompleteRedirectPaymentMethodSpecificInput import (
CompleteRedirectPaymentMethodSpecificInput,
)
from .CustomerDevice import CustomerDevice
from .Order import Order

Expand All @@ -13,5 +16,8 @@ class CompletePaymentRequest:
financingPaymentMethodSpecificInput: Optional[
CompleteFinancingPaymentMethodSpecificInput
] = None
redirectPaymentMethodSpecificInput: Optional[
CompleteRedirectPaymentMethodSpecificInput
] = None
order: Optional[Order] = None
device: Optional[CustomerDevice] = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from dataclasses import dataclass
from typing import Optional

from .CompletePaymentProduct840SpecificInput import (
CompletePaymentProduct840SpecificInput,
)


@dataclass(kw_only=True)
class CompleteRedirectPaymentMethodSpecificInput:
paymentProductId: Optional[int] = None
paymentProduct840SpecificInput: Optional[CompletePaymentProduct840SpecificInput] = (
None
)
2 changes: 2 additions & 0 deletions pcp_serversdk_python/models/CustomerDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@

@dataclass(kw_only=True)
class CustomerDevice:
acceptHeader: Optional[str] = None
ipAddress: Optional[str] = None
deviceToken: Optional[str] = None
userAgent: Optional[str] = None
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@dataclass(kw_only=True)
class PaymentProduct840SpecificOutput:
payPalTransactionId: str
payPalTransactionId: Optional[str] = None
billingAddress: Optional[Address] = None
customerAccount: Optional[PaymentProduct840CustomerAccount] = None
shippingAddress: Optional[Address] = None
1 change: 1 addition & 0 deletions pcp_serversdk_python/models/PaymentType.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class PaymentType(str, Enum):
Capture = "CAPTURE"
Refund = "REFUND"
Reversal = "REVERSAL"
Chargeback = "CHARGEBACK"
ChargebackReversal = "CHARGEBACK_REVERSAL"
CreditNote = "CREDIT_NOTE"
DebitNote = "DEBIT_NOTE"
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class RedirectPaymentMethodSpecificInput:
reportingToken: Optional[str] = None
tokenize: Optional[bool] = None
paymentProductId: Optional[int] = None
javaScriptSdkFlow: Optional[bool] = False
paymentProduct840SpecificInput: Optional[RedirectPaymentProduct840SpecificInput] = (
None
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@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
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ class RedirectPaymentProduct840SpecificInput:
# transactions, when the FraudNet SDK is used, and to be passed in the API
# request the same tracking ID value (FraudNet Session Identifier).
)
javaScriptSdkFlow: bool = (
True # Required parameter which defines how PayPal is being integrated
# inside the checkout page. True = the current integration uses PayPal SDK,
# False = classic usage with PayPal Redirect flow
)
action: Optional[str] = (
None # Required parameter for a COMPLETE CALL (not only an ORDER CALL)
# which one value "CONFIRM_ORDER_STATUS" signals process is finished
# on merchant side
javaScriptSdkFlow: Optional[bool] = (
False # Flag describing if the PayPal JavaScript SDK flow is used
)
8 changes: 8 additions & 0 deletions pcp_serversdk_python/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,16 @@
from .CompleteFinancingPaymentMethodSpecificInput import (
CompleteFinancingPaymentMethodSpecificInput,
)
from .CompletePaymentProduct840SpecificInput import (
CompletePaymentProduct840SpecificInput,
)
from .CompleteOrderRequest import CompleteOrderRequest
from .CompletePaymentMethodSpecificInput import CompletePaymentMethodSpecificInput
from .CompletePaymentRequest import CompletePaymentRequest
from .CompletePaymentResponse import CompletePaymentResponse
from .CompleteRedirectPaymentMethodSpecificInput import (
CompleteRedirectPaymentMethodSpecificInput,
)
from .ContactDetails import ContactDetails
from .CreateCheckoutRequest import CreateCheckoutRequest
from .CreateCheckoutResponse import CreateCheckoutResponse
Expand Down Expand Up @@ -208,10 +214,12 @@
"CommerceCaseResponse",
"CompanyInformation",
"CompleteFinancingPaymentMethodSpecificInput",
"CompletePaymentProduct840SpecificInput",
"CompleteOrderRequest",
"CompletePaymentMethodSpecificInput",
"CompletePaymentRequest",
"CompletePaymentResponse",
"CompleteRedirectPaymentMethodSpecificInput",
"ContactDetails",
"CreateCheckoutRequest",
"CreateCheckoutResponse",
Expand Down
13 changes: 12 additions & 1 deletion tests/endpoints/test_PaymentExecutionApiClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
CancelPaymentResponse,
CapturePaymentRequest,
CapturePaymentResponse,
CompletePaymentProduct840SpecificInput,
CompletePaymentRequest,
CompletePaymentResponse,
CompleteRedirectPaymentMethodSpecificInput,
CreatePaymentResponse,
PausePaymentRequest,
PausePaymentResponse,
Expand Down Expand Up @@ -138,12 +140,21 @@ async def test_complete_payment(payment_execution_api_client, mock_httpx_client)
mock_response
)

payload = CompletePaymentRequest()
redirect_input = CompleteRedirectPaymentMethodSpecificInput()
product840_input = CompletePaymentProduct840SpecificInput(
action="CONFIRM_ORDER_STATUS",
javaScriptSdkFlow=True,
)
redirect_input.paymentProduct840SpecificInput = product840_input
payload.redirectPaymentMethodSpecificInput = redirect_input

response = await payment_execution_api_client.complete_payment(
"merchant_id",
"commerce_case_id",
"checkout_id",
"payment_execution_id",
CompletePaymentRequest(),
payload,
)
assert response == expected_response

Expand Down
Loading