Skip to content

Conversation

@davidgrayston-paddle
Copy link
Contributor

Added

class CreateAdjustment(Operation):
action: Action
items: list[CreateAdjustmentItem]
items: list[CreateAdjustmentItem] | None | Undefined
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

items cannot be set to Undefined() by default without moving the argument, which would be a breaking change.

CreateAdjustment.full() and CreateAdjustment.partial() have been introduced to make it easier to create this operation, e.g.

CreateAdjustment.partial(
    Action.Refund,
    [CreateAdjustmentItem("txnitm_01h8bxryv3065dyh6103p3yg28", AdjustmentType.Partial, "100")],
    "error",
    "txn_01h8bxpvx398a7zbawb77y0kp5",
)
CreateAdjustment.full(
    Action.Refund,
    "error",
    "txn_01h8bxpvx398a7zbawb77y0kp5",
)

The constructor can still be used, but items must always be provided, e.g.

CreateAdjustment(
    Action.Refund,
    None,
    "error",
    "txn_01h8bxpvx398a7zbawb77y0kp5",
    AdjustmentActionType.Full,
)
CreateAdjustment(
    Action.Refund,
    Undefined(),
    "error",
    "txn_01h8bxpvx398a7zbawb77y0kp5",
    AdjustmentActionType.Full,
)

vifer
vifer previously approved these changes Dec 17, 2024
vifer
vifer previously approved these changes Dec 17, 2024
@davidgrayston-paddle davidgrayston-paddle merged commit 385c359 into main Dec 17, 2024
6 checks passed
@davidgrayston-paddle davidgrayston-paddle deleted the feat/adjustment-type-and-vnd branch December 17, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants