dana-python 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,59 @@
1
+ # Copyright 2025 PT Espay Debit Indonesia Koe
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from enum import Enum
16
+
17
+ class SourcePlatform(str, Enum):
18
+ IPG = "IPG"
19
+
20
+ class TerminalType(str, Enum):
21
+ APP = "APP"
22
+ WEB = "WEB"
23
+ WAP = "WAP"
24
+ SYSTEM = "SYSTEM"
25
+
26
+ class OrderTerminalType(str, Enum):
27
+ APP = "APP"
28
+ WEB = "WEB"
29
+ WAP = "WAP"
30
+ SYSTEM = "SYSTEM"
31
+
32
+ class PayMethod(str, Enum):
33
+ BALANCE = "BALANCE"
34
+ COUPON = "COUPON"
35
+ NET_BANKING = "NET_BANKING"
36
+ CREDIT_CARD = "CREDIT_CARD"
37
+ DEBIT_CARD = "DEBIT_CARD"
38
+ VIRTUAL_ACCOUNT = "VIRTUAL_ACCOUNT"
39
+ OTC = "OTC"
40
+ DIRECT_DEBIT_CREDIT_CARD = "DIRECT_DEBIT_CREDIT_CARD"
41
+ DIRECT_DEBIT_DEBIT_CARD = "DIRECT_DEBIT_DEBIT_CARD"
42
+ ONLINE_CREDIT = "ONLINE_CREDIT"
43
+ LOAN_CREDIT = "LOAN_CREDIT"
44
+ NETWORK_PAY = "NETWORK_PAY"
45
+
46
+ class PayOption(str, Enum):
47
+ NETWORK_PAY_PG_SPAY = "NETWORK_PAY_PG_SPAY"
48
+ NETWORK_PAY_PG_OVO = "NETWORK_PAY_PG_OVO"
49
+ NETWORK_PAY_PG_GOPAY = "NETWORK_PAY_PG_GOPAY"
50
+ NETWORK_PAY_PG_LINKAJA = "NETWORK_PAY_PG_LINKAJA"
51
+ NETWORK_PAY_PG_CARD = "NETWORK_PAY_PG_CARD"
52
+ VIRTUAL_ACCOUNT_BCA = "VIRTUAL_ACCOUNT_BCA"
53
+ VIRTUAL_ACCOUNT_BNI = "VIRTUAL_ACCOUNT_BNI"
54
+ VIRTUAL_ACCOUNT_MANDIRI = "VIRTUAL_ACCOUNT_MANDIRI"
55
+ VIRTUAL_ACCOUNT_BRI = "VIRTUAL_ACCOUNT_BRI"
56
+ VIRTUAL_ACCOUNT_BTPN = "VIRTUAL_ACCOUNT_BTPN"
57
+ VIRTUAL_ACCOUNT_CIMB = "VIRTUAL_ACCOUNT_CIMB"
58
+ VIRTUAL_ACCOUNT_PERMATA = "VIRTUAL_ACCOUNT_PERMATA"
59
+
@@ -0,0 +1,38 @@
1
+ # Copyright 2025 PT Espay Debit Indonesia Koe
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding: utf-8
16
+
17
+ # flake8: noqa
18
+ """
19
+ Payment Gateway API
20
+
21
+ API for doing operations in DANA Payment Gateway (Gapura)
22
+
23
+ The version of the OpenAPI document: 1.0.0
24
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
25
+
26
+ Do not edit the class manually.
27
+ """ # noqa: E501
28
+
29
+
30
+ # import models into model package
31
+ from dana.payment_gateway.v1.models.buyer import Buyer
32
+ from dana.payment_gateway.v1.models.consult_pay_request import ConsultPayRequest
33
+ from dana.payment_gateway.v1.models.consult_pay_request_additional_info import ConsultPayRequestAdditionalInfo
34
+ from dana.payment_gateway.v1.models.consult_pay_request_amount import ConsultPayRequestAmount
35
+ from dana.payment_gateway.v1.models.consult_pay_response import ConsultPayResponse
36
+ from dana.payment_gateway.v1.models.env_info import EnvInfo
37
+ from dana.payment_gateway.v1.models.payment_info import PaymentInfo
38
+ from dana.payment_gateway.v1.models.promo_info import PromoInfo
@@ -0,0 +1,113 @@
1
+ # Copyright 2025 PT Espay Debit Indonesia Koe
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding: utf-8
16
+
17
+ """
18
+ Payment Gateway API
19
+
20
+ API for doing operations in DANA Payment Gateway (Gapura)
21
+
22
+ The version of the OpenAPI document: 1.0.0
23
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
24
+
25
+ Do not edit the class manually.
26
+ """ # noqa: E501
27
+
28
+
29
+ from __future__ import annotations
30
+ import pprint
31
+ import re # noqa: F401
32
+ import json
33
+
34
+ from dana.base.model import BaseSdkModel
35
+
36
+ from pydantic import BaseModel, ConfigDict, Field
37
+ from typing import Any, ClassVar, Dict, List, Optional
38
+ from typing_extensions import Annotated
39
+ from typing import Optional, Set
40
+ from typing_extensions import Self
41
+ from pydantic import AliasGenerator
42
+ from pydantic.alias_generators import to_camel
43
+
44
+ class Buyer(BaseModel, BaseSdkModel):
45
+ """
46
+ Buyer
47
+ """ # noqa: E501
48
+ external_user_type: Optional[Annotated[str, Field(strict=True, max_length=32)]] = Field(default=None)
49
+ nickname: Optional[Annotated[str, Field(strict=True, max_length=64)]] = None
50
+ external_user_id: Optional[Annotated[str, Field(strict=True, max_length=32)]] = Field(default=None)
51
+ user_id: Optional[Annotated[str, Field(strict=True, max_length=32)]] = Field(default=None)
52
+ __properties: ClassVar[List[str]] = ["externalUserType", "nickname", "externalUserId", "userId"]
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ alias_generator=AliasGenerator(serialization_alias=to_camel, validation_alias=to_camel),
59
+ )
60
+
61
+
62
+ def to_str(self) -> str:
63
+ """Returns the string representation of the model using alias"""
64
+ return pprint.pformat(self.model_dump(by_alias=True))
65
+
66
+ def to_json(self) -> str:
67
+ """Returns the JSON representation of the model using alias"""
68
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
+ return json.dumps(self.to_dict(), separators=(',', ': '))
70
+
71
+ @classmethod
72
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
+ """Create an instance of Buyer from a JSON string"""
74
+ return cls.from_dict(json.loads(json_str))
75
+
76
+ def to_dict(self) -> Dict[str, Any]:
77
+ """Return the dictionary representation of the model using alias.
78
+
79
+ This has the following differences from calling pydantic's
80
+ `self.model_dump(by_alias=True)`:
81
+
82
+ * `None` is only added to the output dict for nullable fields that
83
+ were set at model initialization. Other fields with value `None`
84
+ are ignored.
85
+ """
86
+ excluded_fields: Set[str] = set([
87
+ ])
88
+
89
+ _dict = self.model_dump(
90
+ by_alias=True,
91
+ exclude=excluded_fields,
92
+ exclude_none=True,
93
+ )
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of Buyer from a dict"""
99
+ if obj is None:
100
+ return None
101
+
102
+ if not isinstance(obj, dict):
103
+ return cls.model_validate(obj)
104
+
105
+ _obj = cls.model_validate({
106
+ "externalUserType": obj.get("externalUserType"),
107
+ "nickname": obj.get("nickname"),
108
+ "externalUserId": obj.get("externalUserId"),
109
+ "userId": obj.get("userId")
110
+ })
111
+ return _obj
112
+
113
+
@@ -0,0 +1,119 @@
1
+ # Copyright 2025 PT Espay Debit Indonesia Koe
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding: utf-8
16
+
17
+ """
18
+ Payment Gateway API
19
+
20
+ API for doing operations in DANA Payment Gateway (Gapura)
21
+
22
+ The version of the OpenAPI document: 1.0.0
23
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
24
+
25
+ Do not edit the class manually.
26
+ """ # noqa: E501
27
+
28
+
29
+ from __future__ import annotations
30
+ import pprint
31
+ import re # noqa: F401
32
+ import json
33
+
34
+ from dana.base.model import BaseSdkModel
35
+
36
+ from pydantic import BaseModel, ConfigDict, Field
37
+ from typing import Any, ClassVar, Dict, List
38
+ from typing_extensions import Annotated
39
+ from dana.payment_gateway.v1.models.consult_pay_request_additional_info import ConsultPayRequestAdditionalInfo
40
+ from dana.payment_gateway.v1.models.consult_pay_request_amount import ConsultPayRequestAmount
41
+ from typing import Optional, Set
42
+ from typing_extensions import Self
43
+ from pydantic import AliasGenerator
44
+ from pydantic.alias_generators import to_camel
45
+
46
+ class ConsultPayRequest(BaseModel, BaseSdkModel):
47
+ """
48
+ ConsultPayRequest
49
+ """ # noqa: E501
50
+ merchant_id: Annotated[str, Field(strict=True, max_length=64)] = Field(description="Merchant identifier that is unique per each merchant")
51
+ amount: ConsultPayRequestAmount
52
+ additional_info: ConsultPayRequestAdditionalInfo = Field()
53
+ __properties: ClassVar[List[str]] = ["merchantId", "amount", "additionalInfo"]
54
+
55
+ model_config = ConfigDict(
56
+ populate_by_name=True,
57
+ validate_assignment=True,
58
+ protected_namespaces=(),
59
+ alias_generator=AliasGenerator(serialization_alias=to_camel, validation_alias=to_camel),
60
+ )
61
+
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
+ return json.dumps(self.to_dict(), separators=(',', ': '))
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of ConsultPayRequest from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ """
87
+ excluded_fields: Set[str] = set([
88
+ ])
89
+
90
+ _dict = self.model_dump(
91
+ by_alias=True,
92
+ exclude=excluded_fields,
93
+ exclude_none=True,
94
+ )
95
+ # override the default output from pydantic by calling `to_dict()` of amount
96
+ if self.amount:
97
+ _dict['amount'] = self.amount.to_dict()
98
+ # override the default output from pydantic by calling `to_dict()` of additional_info
99
+ if self.additional_info:
100
+ _dict['additionalInfo'] = self.additional_info.to_dict()
101
+ return _dict
102
+
103
+ @classmethod
104
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
105
+ """Create an instance of ConsultPayRequest from a dict"""
106
+ if obj is None:
107
+ return None
108
+
109
+ if not isinstance(obj, dict):
110
+ return cls.model_validate(obj)
111
+
112
+ _obj = cls.model_validate({
113
+ "merchantId": obj.get("merchantId"),
114
+ "amount": ConsultPayRequestAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None,
115
+ "additionalInfo": ConsultPayRequestAdditionalInfo.from_dict(obj["additionalInfo"]) if obj.get("additionalInfo") is not None else None
116
+ })
117
+ return _obj
118
+
119
+
@@ -0,0 +1,119 @@
1
+ # Copyright 2025 PT Espay Debit Indonesia Koe
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding: utf-8
16
+
17
+ """
18
+ Payment Gateway API
19
+
20
+ API for doing operations in DANA Payment Gateway (Gapura)
21
+
22
+ The version of the OpenAPI document: 1.0.0
23
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
24
+
25
+ Do not edit the class manually.
26
+ """ # noqa: E501
27
+
28
+
29
+ from __future__ import annotations
30
+ import pprint
31
+ import re # noqa: F401
32
+ import json
33
+
34
+ from dana.base.model import BaseSdkModel
35
+
36
+ from pydantic import BaseModel, ConfigDict, Field
37
+ from typing import Any, ClassVar, Dict, List, Optional
38
+ from typing_extensions import Annotated
39
+ from dana.payment_gateway.v1.models.buyer import Buyer
40
+ from dana.payment_gateway.v1.models.env_info import EnvInfo
41
+ from typing import Optional, Set
42
+ from typing_extensions import Self
43
+ from pydantic import AliasGenerator
44
+ from pydantic.alias_generators import to_camel
45
+
46
+ class ConsultPayRequestAdditionalInfo(BaseModel, BaseSdkModel):
47
+ """
48
+ Additional information
49
+ """ # noqa: E501
50
+ buyer: Buyer
51
+ env_info: EnvInfo = Field()
52
+ merchant_trans_type: Optional[Annotated[str, Field(strict=True, max_length=64)]] = Field(default=None)
53
+ __properties: ClassVar[List[str]] = ["buyer", "envInfo", "merchantTransType"]
54
+
55
+ model_config = ConfigDict(
56
+ populate_by_name=True,
57
+ validate_assignment=True,
58
+ protected_namespaces=(),
59
+ alias_generator=AliasGenerator(serialization_alias=to_camel, validation_alias=to_camel),
60
+ )
61
+
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
+ return json.dumps(self.to_dict(), separators=(',', ': '))
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of ConsultPayRequestAdditionalInfo from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ """
87
+ excluded_fields: Set[str] = set([
88
+ ])
89
+
90
+ _dict = self.model_dump(
91
+ by_alias=True,
92
+ exclude=excluded_fields,
93
+ exclude_none=True,
94
+ )
95
+ # override the default output from pydantic by calling `to_dict()` of buyer
96
+ if self.buyer:
97
+ _dict['buyer'] = self.buyer.to_dict()
98
+ # override the default output from pydantic by calling `to_dict()` of env_info
99
+ if self.env_info:
100
+ _dict['envInfo'] = self.env_info.to_dict()
101
+ return _dict
102
+
103
+ @classmethod
104
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
105
+ """Create an instance of ConsultPayRequestAdditionalInfo from a dict"""
106
+ if obj is None:
107
+ return None
108
+
109
+ if not isinstance(obj, dict):
110
+ return cls.model_validate(obj)
111
+
112
+ _obj = cls.model_validate({
113
+ "buyer": Buyer.from_dict(obj["buyer"]) if obj.get("buyer") is not None else None,
114
+ "envInfo": EnvInfo.from_dict(obj["envInfo"]) if obj.get("envInfo") is not None else None,
115
+ "merchantTransType": obj.get("merchantTransType")
116
+ })
117
+ return _obj
118
+
119
+
@@ -0,0 +1,109 @@
1
+ # Copyright 2025 PT Espay Debit Indonesia Koe
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding: utf-8
16
+
17
+ """
18
+ Payment Gateway API
19
+
20
+ API for doing operations in DANA Payment Gateway (Gapura)
21
+
22
+ The version of the OpenAPI document: 1.0.0
23
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
24
+
25
+ Do not edit the class manually.
26
+ """ # noqa: E501
27
+
28
+
29
+ from __future__ import annotations
30
+ import pprint
31
+ import re # noqa: F401
32
+ import json
33
+
34
+ from dana.base.model import BaseSdkModel
35
+
36
+ from pydantic import BaseModel, ConfigDict, Field
37
+ from typing import Any, ClassVar, Dict, List
38
+ from typing_extensions import Annotated
39
+ from typing import Optional, Set
40
+ from typing_extensions import Self
41
+ from pydantic import AliasGenerator
42
+ from pydantic.alias_generators import to_camel
43
+
44
+ class ConsultPayRequestAmount(BaseModel, BaseSdkModel):
45
+ """
46
+ ConsultPayRequestAmount
47
+ """ # noqa: E501
48
+ value: Annotated[str, Field(strict=True, max_length=19)] = Field(description="Value of amount. Following ISO-4217, for IDR the value includes 2 decimal digits separated with point e.g. IDR 10.000,- will be placed with 10000.00")
49
+ currency: Annotated[str, Field(strict=True, max_length=3)] = Field(description="Currency of money following ISO-4217")
50
+ __properties: ClassVar[List[str]] = ["value", "currency"]
51
+
52
+ model_config = ConfigDict(
53
+ populate_by_name=True,
54
+ validate_assignment=True,
55
+ protected_namespaces=(),
56
+ alias_generator=AliasGenerator(serialization_alias=to_camel, validation_alias=to_camel),
57
+ )
58
+
59
+
60
+ def to_str(self) -> str:
61
+ """Returns the string representation of the model using alias"""
62
+ return pprint.pformat(self.model_dump(by_alias=True))
63
+
64
+ def to_json(self) -> str:
65
+ """Returns the JSON representation of the model using alias"""
66
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
+ return json.dumps(self.to_dict(), separators=(',', ': '))
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of ConsultPayRequestAmount from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([
85
+ ])
86
+
87
+ _dict = self.model_dump(
88
+ by_alias=True,
89
+ exclude=excluded_fields,
90
+ exclude_none=True,
91
+ )
92
+ return _dict
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
96
+ """Create an instance of ConsultPayRequestAmount from a dict"""
97
+ if obj is None:
98
+ return None
99
+
100
+ if not isinstance(obj, dict):
101
+ return cls.model_validate(obj)
102
+
103
+ _obj = cls.model_validate({
104
+ "value": obj.get("value"),
105
+ "currency": obj.get("currency")
106
+ })
107
+ return _obj
108
+
109
+
@@ -0,0 +1,119 @@
1
+ # Copyright 2025 PT Espay Debit Indonesia Koe
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # coding: utf-8
16
+
17
+ """
18
+ Payment Gateway API
19
+
20
+ API for doing operations in DANA Payment Gateway (Gapura)
21
+
22
+ The version of the OpenAPI document: 1.0.0
23
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
24
+
25
+ Do not edit the class manually.
26
+ """ # noqa: E501
27
+
28
+
29
+ from __future__ import annotations
30
+ import pprint
31
+ import re # noqa: F401
32
+ import json
33
+
34
+ from dana.base.model import BaseSdkModel
35
+
36
+ from pydantic import BaseModel, ConfigDict, Field
37
+ from typing import Any, ClassVar, Dict, List, Optional
38
+ from typing_extensions import Annotated
39
+ from dana.payment_gateway.v1.models.payment_info import PaymentInfo
40
+ from typing import Optional, Set
41
+ from typing_extensions import Self
42
+ from pydantic import AliasGenerator
43
+ from pydantic.alias_generators import to_camel
44
+
45
+ class ConsultPayResponse(BaseModel, BaseSdkModel):
46
+ """
47
+ ConsultPayResponse
48
+ """ # noqa: E501
49
+ response_code: Optional[Annotated[str, Field(strict=True, max_length=7)]] = Field(default=None)
50
+ response_message: Optional[Annotated[str, Field(strict=True, max_length=150)]] = Field(default=None, description="The response code - response message:<br> * 2000000 - Successful<br> * 4000000 - Bad Request - Retry request with proper parameter<br> * 4000001 - Invalid format for certain field - Retry request with proper parameter<br> * 4000002 - Missing or invalid format on mandatory field - Retry request with proper parameter<br> * 4010000 - Signature is invalid - Retry request with proper parameter<br> * 4030005 - Account or user status is abnormal - Retry request with proper parameter or can contact DANA to check the user/account status<br> * 4030015 - Transaction not permitted - Retry request periodically or consult to DANA<br> * 4040008 - Merchant does not exist or status abnormal - Retry request with proper parameter<br> * 4290000 - Maximum transaction limit exceeded - Retry request periodically by sending same request payload<br> * 5000000 - General error - Retry request periodically<br> ")
51
+ payment_infos: Optional[List[PaymentInfo]] = Field(default=None)
52
+ __properties: ClassVar[List[str]] = ["responseCode", "responseMessage", "paymentInfos"]
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ alias_generator=AliasGenerator(serialization_alias=to_camel, validation_alias=to_camel),
59
+ )
60
+
61
+
62
+ def to_str(self) -> str:
63
+ """Returns the string representation of the model using alias"""
64
+ return pprint.pformat(self.model_dump(by_alias=True))
65
+
66
+ def to_json(self) -> str:
67
+ """Returns the JSON representation of the model using alias"""
68
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
+ return json.dumps(self.to_dict(), separators=(',', ': '))
70
+
71
+ @classmethod
72
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
+ """Create an instance of ConsultPayResponse from a JSON string"""
74
+ return cls.from_dict(json.loads(json_str))
75
+
76
+ def to_dict(self) -> Dict[str, Any]:
77
+ """Return the dictionary representation of the model using alias.
78
+
79
+ This has the following differences from calling pydantic's
80
+ `self.model_dump(by_alias=True)`:
81
+
82
+ * `None` is only added to the output dict for nullable fields that
83
+ were set at model initialization. Other fields with value `None`
84
+ are ignored.
85
+ """
86
+ excluded_fields: Set[str] = set([
87
+ ])
88
+
89
+ _dict = self.model_dump(
90
+ by_alias=True,
91
+ exclude=excluded_fields,
92
+ exclude_none=True,
93
+ )
94
+ # override the default output from pydantic by calling `to_dict()` of each item in payment_infos (list)
95
+ _items = []
96
+ if self.payment_infos:
97
+ for _item_payment_infos in self.payment_infos:
98
+ if _item_payment_infos:
99
+ _items.append(_item_payment_infos.to_dict())
100
+ _dict['paymentInfos'] = _items
101
+ return _dict
102
+
103
+ @classmethod
104
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
105
+ """Create an instance of ConsultPayResponse from a dict"""
106
+ if obj is None:
107
+ return None
108
+
109
+ if not isinstance(obj, dict):
110
+ return cls.model_validate(obj)
111
+
112
+ _obj = cls.model_validate({
113
+ "responseCode": obj.get("responseCode"),
114
+ "responseMessage": obj.get("responseMessage"),
115
+ "paymentInfos": [PaymentInfo.from_dict(_item) for _item in obj["paymentInfos"]] if obj.get("paymentInfos") is not None else None
116
+ })
117
+ return _obj
118
+
119
+