|
11 | 11 | PlatformCategorization, Billing, SecurityInfo, Birthplace, ApplepayPaymentData, GooglepayPaymentData, \
|
12 | 12 | ScopeBlocked, BrowserInfo, Shipping, CurrentState, FallbackReason, InstantPayout, CountryAuthorizationData, \
|
13 | 13 | PayinsLinked, ConversionRate, CardInfo, LocalAccountDetails, InternationalAccountDetails, \
|
14 |
| - VirtualAccountCapabilities, PaymentRef, PendingUserAction, LegalRepresentative |
| 14 | + VirtualAccountCapabilities, PaymentRef, PendingUserAction, LegalRepresentative, IndividualRecipient, \ |
| 15 | + BusinessRecipient, RecipientPropertySchema, IndividualRecipientPropertySchema, BusinessRecipientPropertySchema |
15 | 16 |
|
16 | 17 |
|
17 | 18 | class FieldDescriptor(object):
|
@@ -161,7 +162,7 @@ def python_value(self, value):
|
161 | 162 |
|
162 | 163 | class DictField(Field):
|
163 | 164 | def api_value(self, value):
|
164 |
| - return json.dumps(value) |
| 165 | + return value |
165 | 166 |
|
166 | 167 | def python_value(self, value):
|
167 | 168 | if value is not None and isinstance(value, str):
|
@@ -917,6 +918,7 @@ def api_value(self, value):
|
917 | 918 |
|
918 | 919 | return value
|
919 | 920 |
|
| 921 | + |
920 | 922 | class ConversionRateField(Field):
|
921 | 923 | def python_value(self, value):
|
922 | 924 | if value is not None:
|
@@ -1066,3 +1068,115 @@ def api_value(self, value):
|
1066 | 1068 | }
|
1067 | 1069 |
|
1068 | 1070 | return value
|
| 1071 | + |
| 1072 | + |
| 1073 | +class IndividualRecipientField(Field): |
| 1074 | + def python_value(self, value): |
| 1075 | + if value is not None: |
| 1076 | + return IndividualRecipient(first_name=value.get('FirstName', None), last_name=value.get('LastName', None), |
| 1077 | + address=value.get('Address', None)) |
| 1078 | + |
| 1079 | + return value |
| 1080 | + |
| 1081 | + def api_value(self, value): |
| 1082 | + value = super(IndividualRecipientField, self).api_value(value) |
| 1083 | + |
| 1084 | + if isinstance(value, IndividualRecipient): |
| 1085 | + value = { |
| 1086 | + 'FirstName': value.first_name, |
| 1087 | + 'LastName': value.last_name, |
| 1088 | + 'Address': value.address |
| 1089 | + } |
| 1090 | + |
| 1091 | + return value |
| 1092 | + |
| 1093 | + |
| 1094 | +class BusinessRecipientField(Field): |
| 1095 | + def python_value(self, value): |
| 1096 | + if value is not None: |
| 1097 | + return BusinessRecipient(business_name=value.get('BusinessName', None), address=value.get('Address', None)) |
| 1098 | + |
| 1099 | + return value |
| 1100 | + |
| 1101 | + def api_value(self, value): |
| 1102 | + value = super(BusinessRecipientField, self).api_value(value) |
| 1103 | + |
| 1104 | + if isinstance(value, BusinessRecipient): |
| 1105 | + value = { |
| 1106 | + 'BusinessName': value.business_name, |
| 1107 | + 'Address': value.address |
| 1108 | + } |
| 1109 | + |
| 1110 | + return value |
| 1111 | + |
| 1112 | + |
| 1113 | +class RecipientPropertySchemaField(Field): |
| 1114 | + def python_value(self, value): |
| 1115 | + if value is not None: |
| 1116 | + return RecipientPropertySchema(required=value.get('Required', None), |
| 1117 | + max_length=value.get('MaxLength', None), |
| 1118 | + min_length=value.get('MinLength', None), |
| 1119 | + pattern=value.get('Pattern', None), |
| 1120 | + allowed_values=value.get('AllowedValues', None), |
| 1121 | + label=value.get('Label', None), |
| 1122 | + end_user_display=value.get('EndUserDisplay', None)) |
| 1123 | + |
| 1124 | + return value |
| 1125 | + |
| 1126 | + def api_value(self, value): |
| 1127 | + value = super(RecipientPropertySchemaField, self).api_value(value) |
| 1128 | + |
| 1129 | + if isinstance(value, RecipientPropertySchema): |
| 1130 | + value = { |
| 1131 | + 'Required': value.required, |
| 1132 | + 'MaxLength': value.max_length, |
| 1133 | + 'MinLength': value.min_length, |
| 1134 | + 'Pattern': value.pattern, |
| 1135 | + 'AllowedValues': value.allowed_values, |
| 1136 | + 'Label': value.label, |
| 1137 | + 'EndUserDisplay': value.end_user_display |
| 1138 | + } |
| 1139 | + |
| 1140 | + return value |
| 1141 | + |
| 1142 | + |
| 1143 | +class IndividualRecipientPropertySchemaField(Field): |
| 1144 | + def python_value(self, value): |
| 1145 | + if value is not None: |
| 1146 | + return IndividualRecipientPropertySchema(first_name=value.get('FirstName', None), |
| 1147 | + last_name=value.get('LastName', None), |
| 1148 | + address=value.get('Address', None)) |
| 1149 | + |
| 1150 | + return value |
| 1151 | + |
| 1152 | + def api_value(self, value): |
| 1153 | + value = super(IndividualRecipientPropertySchemaField, self).api_value(value) |
| 1154 | + |
| 1155 | + if isinstance(value, IndividualRecipientPropertySchema): |
| 1156 | + value = { |
| 1157 | + 'FirstName': value.first_name, |
| 1158 | + 'LastName': value.last_name, |
| 1159 | + 'Address': value.address |
| 1160 | + } |
| 1161 | + |
| 1162 | + return value |
| 1163 | + |
| 1164 | + |
| 1165 | +class BusinessRecipientPropertySchemaField(Field): |
| 1166 | + def python_value(self, value): |
| 1167 | + if value is not None: |
| 1168 | + return BusinessRecipientPropertySchema(business_name=value.get('BusinessName', None), |
| 1169 | + address=value.get('Address', None)) |
| 1170 | + |
| 1171 | + return value |
| 1172 | + |
| 1173 | + def api_value(self, value): |
| 1174 | + value = super(BusinessRecipientPropertySchemaField, self).api_value(value) |
| 1175 | + |
| 1176 | + if isinstance(value, BusinessRecipientPropertySchema): |
| 1177 | + value = { |
| 1178 | + 'BusinessName': value.business_name, |
| 1179 | + 'Address': value.address |
| 1180 | + } |
| 1181 | + |
| 1182 | + return value |
0 commit comments