|
16 | 16 | HeaderMetadata, |
17 | 17 | PathParamMetadata, |
18 | 18 | RequestMetadata, |
| 19 | + get_discriminator, |
19 | 20 | ) |
20 | 21 | import pydantic |
21 | | -from pydantic import model_serializer |
| 22 | +from pydantic import Discriminator, Tag, model_serializer |
22 | 23 | from typing import List, Optional, Union |
23 | 24 | from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict |
24 | 25 |
|
@@ -109,7 +110,22 @@ def serialize_model(self, handler): |
109 | 110 | r"""Successful Response""" |
110 | 111 |
|
111 | 112 |
|
112 | | -ResponseCaptureTransaction = TypeAliasType( |
113 | | - "ResponseCaptureTransaction", Union[TransactionCaptureOutput, TransactionOutput] |
114 | | -) |
| 113 | +ResponseCaptureTransaction = Annotated[ |
| 114 | + Union[ |
| 115 | + Annotated[TransactionOutput, Tag("processing")], |
| 116 | + Annotated[TransactionOutput, Tag("authorization_succeeded")], |
| 117 | + Annotated[TransactionOutput, Tag("authorization_declined")], |
| 118 | + Annotated[TransactionOutput, Tag("authorization_failed")], |
| 119 | + Annotated[TransactionOutput, Tag("authorization_voided")], |
| 120 | + Annotated[TransactionOutput, Tag("authorization_void_pending")], |
| 121 | + Annotated[TransactionOutput, Tag("capture_succeeded")], |
| 122 | + Annotated[TransactionOutput, Tag("capture_pending")], |
| 123 | + Annotated[TransactionOutput, Tag("buyer_approval_pending")], |
| 124 | + Annotated[TransactionCaptureOutput, Tag("succeeded")], |
| 125 | + Annotated[TransactionCaptureOutput, Tag("pending")], |
| 126 | + Annotated[TransactionCaptureOutput, Tag("declined")], |
| 127 | + Annotated[TransactionCaptureOutput, Tag("failed")], |
| 128 | + ], |
| 129 | + Discriminator(lambda m: get_discriminator(m, "status", "status")), |
| 130 | +] |
115 | 131 | r"""Successful Response""" |
0 commit comments