mangopay4-python-sdk 3.52.0__py2.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.
- mangopay/__init__.py +27 -0
- mangopay/api.py +381 -0
- mangopay/auth.py +130 -0
- mangopay/base.py +289 -0
- mangopay/compat.py +16 -0
- mangopay/constants.py +466 -0
- mangopay/exceptions.py +26 -0
- mangopay/fields.py +1345 -0
- mangopay/page.py +17 -0
- mangopay/query.py +280 -0
- mangopay/ratelimit.py +5 -0
- mangopay/resources.py +3219 -0
- mangopay/signals.py +14 -0
- mangopay/utils.py +1582 -0
- mangopay4_python_sdk-3.52.0.dist-info/METADATA +53 -0
- mangopay4_python_sdk-3.52.0.dist-info/RECORD +20 -0
- mangopay4_python_sdk-3.52.0.dist-info/WHEEL +6 -0
- mangopay4_python_sdk-3.52.0.dist-info/entry_points.txt +2 -0
- mangopay4_python_sdk-3.52.0.dist-info/licenses/LICENSE +22 -0
- mangopay4_python_sdk-3.52.0.dist-info/top_level.txt +1 -0
mangopay/resources.py
ADDED
|
@@ -0,0 +1,3219 @@
|
|
|
1
|
+
import six
|
|
2
|
+
|
|
3
|
+
from mangopay.signals import pre_save, post_save
|
|
4
|
+
from mangopay.utils import Money, Address, Birthplace
|
|
5
|
+
from . import constants
|
|
6
|
+
from .base import BaseApiModel, BaseApiModelMethods
|
|
7
|
+
from .compat import python_2_unicode_compatible
|
|
8
|
+
from .fields import (PrimaryKeyField, EmailField, CharField,
|
|
9
|
+
BooleanField, DateTimeField, DateField,
|
|
10
|
+
ManyToManyField, ForeignKeyField,
|
|
11
|
+
MoneyField, IntegerField, DisputeReasonField, RelatedManager, DictField, AddressField,
|
|
12
|
+
DebitedBankAccountField,
|
|
13
|
+
ShippingAddressField, RefundReasonField, ListField, ReportTransactionsFiltersField,
|
|
14
|
+
ReportWalletsFiltersField, BillingField, SecurityInfoField, PlatformCategorizationField,
|
|
15
|
+
BirthplaceField, ApplepayPaymentDataField, GooglepayPaymentDataField, ScopeBlockedField,
|
|
16
|
+
BrowserInfoField, ShippingField, CurrentStateField, FallbackReasonField, InstantPayoutField,
|
|
17
|
+
CountryAuthorizationDataField, PayinsLinkedField, ConversionRateField, CardInfoField,
|
|
18
|
+
LocalAccountDetailsField, VirtualAccountCapabilitiesField, PaymentRefField, PendingUserActionField,
|
|
19
|
+
LegalRepresentativeField, IndividualRecipientField, BusinessRecipientField,
|
|
20
|
+
RecipientPropertySchemaField, IndividualRecipientPropertySchemaField,
|
|
21
|
+
BusinessRecipientPropertySchemaField, CompanyNumberValidationField, ReportFilterField,
|
|
22
|
+
PayInIntentExternalDataField, PayInIntentBuyerField, SupportedBanksField, VerificationOfPayeeField)
|
|
23
|
+
from .query import InsertQuery, UpdateQuery, SelectQuery, ActionQuery, DeleteQuery, InsertMultipartQuery, \
|
|
24
|
+
UpdateMultipartQuery
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class BaseModel(BaseApiModel):
|
|
28
|
+
id = PrimaryKeyField(api_name='Id')
|
|
29
|
+
tag = CharField(api_name='Tag')
|
|
30
|
+
update_date = DateTimeField(api_name='UpdateDate')
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@python_2_unicode_compatible
|
|
34
|
+
class Client(BaseApiModel):
|
|
35
|
+
client_id = PrimaryKeyField(api_name='ClientId', required=True)
|
|
36
|
+
name = CharField(api_name='Name')
|
|
37
|
+
primary_theme_colour = CharField(api_name='PrimaryThemeColour')
|
|
38
|
+
primary_button_colour = CharField(api_name='PrimaryButtonColour')
|
|
39
|
+
logo = CharField(api_name='Logo')
|
|
40
|
+
tech_emails = ListField(api_name='TechEmails')
|
|
41
|
+
admin_email = ListField(api_name='AdminEmails')
|
|
42
|
+
fraud_emails = ListField(api_name='FraudEmails')
|
|
43
|
+
billing_emails = ListField(api_name='BillingEmails')
|
|
44
|
+
platform_description = ListField(api_name='PlatformDescription')
|
|
45
|
+
platform_categorization = PlatformCategorizationField(api_name='PlatformCategorization')
|
|
46
|
+
platform_url = CharField(api_name='PlatformURL')
|
|
47
|
+
headquarters_address = AddressField(api_name='HeadquartersAddress')
|
|
48
|
+
headquarters_phone_number = CharField(api_name='HeadquartersPhoneNumber')
|
|
49
|
+
tax_number = CharField(api_name='TaxNumber')
|
|
50
|
+
licensor = CharField(api_name='Licensor')
|
|
51
|
+
|
|
52
|
+
class Meta:
|
|
53
|
+
verbose_name = 'client'
|
|
54
|
+
verbose_name_plural = 'clients'
|
|
55
|
+
url = {
|
|
56
|
+
SelectQuery.identifier: '/clients',
|
|
57
|
+
UpdateQuery.identifier: '/clients'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def get(cls):
|
|
62
|
+
return super(Client, cls).get('')
|
|
63
|
+
|
|
64
|
+
def update(self, handler=None):
|
|
65
|
+
data = self.__dict__
|
|
66
|
+
update = UpdateQuery(self, '',
|
|
67
|
+
**data['_data']
|
|
68
|
+
)
|
|
69
|
+
return update.execute(handler)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class ClientLogo(BaseModel):
|
|
73
|
+
file = CharField(api_name='File')
|
|
74
|
+
|
|
75
|
+
class Meta:
|
|
76
|
+
verbose_name = 'client-logo'
|
|
77
|
+
verbose_name_plural = 'client-logos'
|
|
78
|
+
url = {
|
|
79
|
+
'UPLOAD_CLIENT_LOGO': '/clients/logo/'
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
def upload(self, handler=None):
|
|
83
|
+
self._handler = handler or self.handler
|
|
84
|
+
|
|
85
|
+
action = ActionQuery(
|
|
86
|
+
ClientLogo,
|
|
87
|
+
self.get_pk(),
|
|
88
|
+
'UPLOAD_CLIENT_LOGO',
|
|
89
|
+
**{'File': self.file}
|
|
90
|
+
)
|
|
91
|
+
return action.execute(handler)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@python_2_unicode_compatible
|
|
95
|
+
class User(BaseModel):
|
|
96
|
+
email = EmailField(api_name='Email', required=True)
|
|
97
|
+
kyc_level = CharField(api_name='KYCLevel', choices=constants.KYC_LEVEL, default=constants.KYC_LEVEL.light)
|
|
98
|
+
terms_and_conditions_accepted = BooleanField(api_name='TermsAndConditionsAccepted')
|
|
99
|
+
terms_and_conditions_accepted_date = DateTimeField(api_name='TermsAndConditionsAcceptedDate')
|
|
100
|
+
user_category = CharField(api_name='UserCategory')
|
|
101
|
+
user_status = CharField(api_name='UserStatus')
|
|
102
|
+
|
|
103
|
+
def fixed_kwargs(self):
|
|
104
|
+
return {"user_id": self.id}
|
|
105
|
+
|
|
106
|
+
class Meta:
|
|
107
|
+
verbose_name = 'user'
|
|
108
|
+
verbose_name_plural = 'users'
|
|
109
|
+
url = {
|
|
110
|
+
InsertQuery.identifier: '/users',
|
|
111
|
+
SelectQuery.identifier: '/users',
|
|
112
|
+
UpdateQuery.identifier: '/users',
|
|
113
|
+
'USERS_GET_SCA': '/sca/users'
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
def __init__(self, *args, **kwargs):
|
|
117
|
+
super(User, self).__init__(*args, **kwargs)
|
|
118
|
+
self.disputes = RelatedManager(self, Dispute)
|
|
119
|
+
|
|
120
|
+
@classmethod
|
|
121
|
+
def cast(cls, result):
|
|
122
|
+
if 'PersonType' in result:
|
|
123
|
+
if result['PersonType'] == 'NATURAL':
|
|
124
|
+
if 'PendingUserAction' in result:
|
|
125
|
+
return NaturalUserSca
|
|
126
|
+
return NaturalUser
|
|
127
|
+
elif result['PersonType'] == 'LEGAL':
|
|
128
|
+
if 'PendingUserAction' in result:
|
|
129
|
+
return LegalUserSca
|
|
130
|
+
return LegalUser
|
|
131
|
+
|
|
132
|
+
return cls
|
|
133
|
+
|
|
134
|
+
@staticmethod
|
|
135
|
+
def get_sca(user_id, *args, **kwargs):
|
|
136
|
+
select = SelectQuery(User, *args, **kwargs)
|
|
137
|
+
select.identifier = 'USERS_GET_SCA'
|
|
138
|
+
return select.get(user_id, *args, **kwargs)
|
|
139
|
+
|
|
140
|
+
@staticmethod
|
|
141
|
+
def enroll_sca(user_id, idempotency_key=None):
|
|
142
|
+
insert = InsertQuery(ScaEnrollment, idempotency_key)
|
|
143
|
+
insert.insert_query['id'] = user_id
|
|
144
|
+
insert.identifier = 'USERS_ENROLL_SCA'
|
|
145
|
+
result = insert.execute()
|
|
146
|
+
return ScaEnrollment(**result)
|
|
147
|
+
|
|
148
|
+
@staticmethod
|
|
149
|
+
def manage_consent(user_id, idempotency_key=None):
|
|
150
|
+
insert = InsertQuery(UserConsent, idempotency_key)
|
|
151
|
+
insert.insert_query['id'] = user_id
|
|
152
|
+
insert.identifier = 'USERS_MANAGE_CONSENT'
|
|
153
|
+
result = insert.execute()
|
|
154
|
+
return UserConsent(**result)
|
|
155
|
+
|
|
156
|
+
def get_emoney(self, *args, **kwargs):
|
|
157
|
+
kwargs['user_id'] = self.id
|
|
158
|
+
select = SelectQuery(EMoney, *args, **kwargs)
|
|
159
|
+
if kwargs.__contains__('month') and kwargs.__contains__('year'):
|
|
160
|
+
select.identifier = 'FOR_MONTH'
|
|
161
|
+
elif kwargs.__contains__('year'):
|
|
162
|
+
select.identifier = 'FOR_YEAR'
|
|
163
|
+
else:
|
|
164
|
+
select.identifier = 'ALL'
|
|
165
|
+
return select.all(*args, **kwargs)
|
|
166
|
+
|
|
167
|
+
def get_pre_authorizations(self, *args, **kwargs):
|
|
168
|
+
kwargs['id'] = self.id
|
|
169
|
+
select = SelectQuery(PreAuthorization, *args, **kwargs)
|
|
170
|
+
select.identifier = 'USER_GET_PREAUTHORIZATIONS'
|
|
171
|
+
return select.all(*args, **kwargs)
|
|
172
|
+
|
|
173
|
+
def get_block_status(self, *args, **kwargs):
|
|
174
|
+
kwargs['user_id'] = self.id
|
|
175
|
+
select = SelectQuery(UserBlockStatus, *args, **kwargs)
|
|
176
|
+
select.identifier = 'USERS_BLOCK_STATUS'
|
|
177
|
+
return select.get("", *args, **kwargs)
|
|
178
|
+
|
|
179
|
+
def get_regulatory(self, *args, **kwargs):
|
|
180
|
+
kwargs['user_id'] = self.id
|
|
181
|
+
select = SelectQuery(UserBlockStatus, *args, **kwargs)
|
|
182
|
+
select.identifier = 'USERS_REGULATORY'
|
|
183
|
+
return select.get("", *args, **kwargs)
|
|
184
|
+
|
|
185
|
+
def __str__(self):
|
|
186
|
+
return '%s' % self.email
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
@python_2_unicode_compatible
|
|
190
|
+
class ScaEnrollment(BaseModel):
|
|
191
|
+
pending_user_action = PendingUserActionField(api_name='PendingUserAction')
|
|
192
|
+
|
|
193
|
+
class Meta:
|
|
194
|
+
verbose_name = 'sca_enrollment'
|
|
195
|
+
verbose_name_plural = 'sca_enrollments'
|
|
196
|
+
url = {
|
|
197
|
+
'USERS_ENROLL_SCA': '/sca/users/%(id)s/enrollment'
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
@python_2_unicode_compatible
|
|
202
|
+
class UserConsent(BaseModel):
|
|
203
|
+
pending_user_action = PendingUserActionField(api_name='PendingUserAction')
|
|
204
|
+
|
|
205
|
+
class Meta:
|
|
206
|
+
verbose_name = 'user_consent'
|
|
207
|
+
verbose_name_plural = 'user_consents'
|
|
208
|
+
url = {
|
|
209
|
+
'USERS_MANAGE_CONSENT': '/sca/users/%(id)s/consent'
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
@python_2_unicode_compatible
|
|
214
|
+
class NaturalUser(User):
|
|
215
|
+
person_type = CharField(api_name='PersonType',
|
|
216
|
+
choices=constants.USER_TYPE_CHOICES,
|
|
217
|
+
default=constants.USER_TYPE_CHOICES.natural,
|
|
218
|
+
required=True)
|
|
219
|
+
first_name = CharField(api_name='FirstName', required=True)
|
|
220
|
+
last_name = CharField(api_name='LastName', required=True)
|
|
221
|
+
address = AddressField(api_name='Address')
|
|
222
|
+
birthday = DateField(api_name='Birthday')
|
|
223
|
+
nationality = CharField(api_name='Nationality')
|
|
224
|
+
country_of_residence = CharField(api_name='CountryOfResidence')
|
|
225
|
+
occupation = CharField(api_name='Occupation')
|
|
226
|
+
income_range = CharField(api_name='IncomeRange')
|
|
227
|
+
proof_of_identity = CharField(api_name='ProofOfIdentity')
|
|
228
|
+
proof_of_address = CharField(api_name='ProofOfAddress')
|
|
229
|
+
capacity = CharField(api_name='Capacity', choices=constants.NATURAL_USER_CAPACITY_CHOICES)
|
|
230
|
+
|
|
231
|
+
class Meta:
|
|
232
|
+
verbose_name = 'user'
|
|
233
|
+
verbose_name_plural = 'users'
|
|
234
|
+
url = '/users/natural'
|
|
235
|
+
|
|
236
|
+
@classmethod
|
|
237
|
+
def close(cls, *args, **kwargs):
|
|
238
|
+
return DeleteQuery(cls, *args, **kwargs).execute()
|
|
239
|
+
|
|
240
|
+
def __str__(self):
|
|
241
|
+
return '%s' % self.email
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
@python_2_unicode_compatible
|
|
245
|
+
class NaturalUserSca(User):
|
|
246
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
247
|
+
terms_and_conditions_accepted = BooleanField(api_name='TermsAndConditionsAccepted', required=True)
|
|
248
|
+
user_category = CharField(api_name='UserCategory', required=True)
|
|
249
|
+
person_type = CharField(api_name='PersonType',
|
|
250
|
+
choices=constants.USER_TYPE_CHOICES,
|
|
251
|
+
default=constants.USER_TYPE_CHOICES.natural)
|
|
252
|
+
first_name = CharField(api_name='FirstName', required=True)
|
|
253
|
+
last_name = CharField(api_name='LastName', required=True)
|
|
254
|
+
birthday = DateField(api_name='Birthday')
|
|
255
|
+
nationality = CharField(api_name='Nationality')
|
|
256
|
+
country_of_residence = CharField(api_name='CountryOfResidence')
|
|
257
|
+
occupation = CharField(api_name='Occupation')
|
|
258
|
+
income_range = CharField(api_name='IncomeRange')
|
|
259
|
+
proof_of_identity = CharField(api_name='ProofOfIdentity')
|
|
260
|
+
proof_of_address = CharField(api_name='ProofOfAddress')
|
|
261
|
+
capacity = CharField(api_name='Capacity', choices=constants.NATURAL_USER_CAPACITY_CHOICES)
|
|
262
|
+
phone_number = CharField(api_name='PhoneNumber')
|
|
263
|
+
phone_number_country = CharField(api_name='PhoneNumberCountry')
|
|
264
|
+
address = AddressField(api_name='Address')
|
|
265
|
+
pending_user_action = PendingUserActionField(api_name='PendingUserAction')
|
|
266
|
+
sca_context = CharField(api_name='ScaContext')
|
|
267
|
+
|
|
268
|
+
class Meta:
|
|
269
|
+
verbose_name = 'sca_user'
|
|
270
|
+
verbose_name_plural = 'sca_users'
|
|
271
|
+
url = {
|
|
272
|
+
InsertQuery.identifier: '/sca/users/natural',
|
|
273
|
+
SelectQuery.identifier: '/sca/users/natural',
|
|
274
|
+
UpdateQuery.identifier: '/sca/users/natural',
|
|
275
|
+
DeleteQuery.identifier: '/users/natural',
|
|
276
|
+
'USERS_NATURAL_SCA_CATEGORIZE': '/sca/users/natural/%(id)s/category'
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
def __str__(self):
|
|
280
|
+
return '%s' % self.email
|
|
281
|
+
|
|
282
|
+
def categorize(self, **kwargs):
|
|
283
|
+
update = UpdateQuery(NaturalUserSca, '', **kwargs)
|
|
284
|
+
update.identifier = 'USERS_NATURAL_SCA_CATEGORIZE'
|
|
285
|
+
|
|
286
|
+
if kwargs == {}:
|
|
287
|
+
update.update_query = self.__dict__['_data']
|
|
288
|
+
|
|
289
|
+
return update.execute(self.handler)
|
|
290
|
+
|
|
291
|
+
@classmethod
|
|
292
|
+
def close(cls, *args, **kwargs):
|
|
293
|
+
return DeleteQuery(cls, *args, **kwargs).execute()
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
@python_2_unicode_compatible
|
|
297
|
+
class LegalUser(User):
|
|
298
|
+
person_type = CharField(api_name='PersonType',
|
|
299
|
+
choices=constants.USER_TYPE_CHOICES,
|
|
300
|
+
default=constants.USER_TYPE_CHOICES.legal,
|
|
301
|
+
required=True)
|
|
302
|
+
name = CharField(api_name='Name', required=True)
|
|
303
|
+
legal_person_type = CharField(api_name='LegalPersonType',
|
|
304
|
+
choices=constants.LEGAL_USER_TYPE_CHOICES)
|
|
305
|
+
headquarters_address = AddressField(api_name='HeadquartersAddress')
|
|
306
|
+
legal_representative_first_name = CharField(api_name='LegalRepresentativeFirstName', required=True)
|
|
307
|
+
legal_representative_last_name = CharField(api_name='LegalRepresentativeLastName', required=True)
|
|
308
|
+
legal_representative_address = AddressField(api_name='LegalRepresentativeAddress')
|
|
309
|
+
legal_representative_email = EmailField(api_name='LegalRepresentativeEmail')
|
|
310
|
+
legal_representative_birthday = DateField(api_name='LegalRepresentativeBirthday')
|
|
311
|
+
legal_representative_nationality = CharField(api_name='LegalRepresentativeNationality')
|
|
312
|
+
legal_representative_country_of_residence = CharField(api_name='LegalRepresentativeCountryOfResidence')
|
|
313
|
+
legal_representative_proof_of_identity = CharField(api_name='LegalRepresentativeProofOfIdentity')
|
|
314
|
+
statute = CharField(api_name='Statute')
|
|
315
|
+
proof_of_registration = CharField(api_name='ProofOfRegistration')
|
|
316
|
+
shareholder_declaration = CharField(api_name='ShareholderDeclaration')
|
|
317
|
+
company_number = CharField(api_name='CompanyNumber')
|
|
318
|
+
|
|
319
|
+
class Meta:
|
|
320
|
+
verbose_name = 'user'
|
|
321
|
+
verbose_name_plural = 'users'
|
|
322
|
+
url = '/users/legal'
|
|
323
|
+
|
|
324
|
+
def __str__(self):
|
|
325
|
+
return '%s' % self.email
|
|
326
|
+
|
|
327
|
+
@classmethod
|
|
328
|
+
def close(cls, *args, **kwargs):
|
|
329
|
+
return DeleteQuery(cls, *args, **kwargs).execute()
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
@python_2_unicode_compatible
|
|
333
|
+
class LegalUserSca(User):
|
|
334
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
335
|
+
person_type = CharField(api_name='PersonType',
|
|
336
|
+
choices=constants.USER_TYPE_CHOICES,
|
|
337
|
+
default=constants.USER_TYPE_CHOICES.legal)
|
|
338
|
+
name = CharField(api_name='Name', required=True)
|
|
339
|
+
legal_person_type = CharField(api_name='LegalPersonType',
|
|
340
|
+
choices=constants.LEGAL_USER_TYPE_CHOICES,
|
|
341
|
+
required=True)
|
|
342
|
+
legal_representative = LegalRepresentativeField(api_name='LegalRepresentative', required=True)
|
|
343
|
+
proof_of_registration = CharField(api_name='ProofOfRegistration')
|
|
344
|
+
shareholder_declaration = CharField(api_name='ShareholderDeclaration')
|
|
345
|
+
statute = CharField(api_name='Statute')
|
|
346
|
+
company_number = CharField(api_name='CompanyNumber')
|
|
347
|
+
pending_user_action = PendingUserActionField(api_name='PendingUserAction')
|
|
348
|
+
headquarters_address = AddressField(api_name='HeadquartersAddress')
|
|
349
|
+
terms_and_conditions_accepted = BooleanField(api_name='TermsAndConditionsAccepted', required=True)
|
|
350
|
+
user_category = CharField(api_name='UserCategory', required=True)
|
|
351
|
+
legal_representative_address = AddressField(api_name='LegalRepresentativeAddress')
|
|
352
|
+
sca_context = CharField(api_name='ScaContext')
|
|
353
|
+
|
|
354
|
+
class Meta:
|
|
355
|
+
verbose_name = 'sca_user'
|
|
356
|
+
verbose_name_plural = 'sca_users'
|
|
357
|
+
url = {
|
|
358
|
+
InsertQuery.identifier: '/sca/users/legal',
|
|
359
|
+
SelectQuery.identifier: '/sca/users/legal',
|
|
360
|
+
UpdateQuery.identifier: '/sca/users/legal',
|
|
361
|
+
DeleteQuery.identifier: '/users/legal',
|
|
362
|
+
'USERS_LEGAL_SCA_CATEGORIZE': '/sca/users/legal/%(id)s/category'
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
def __str__(self):
|
|
366
|
+
return '%s' % self.email
|
|
367
|
+
|
|
368
|
+
def categorize(self, **kwargs):
|
|
369
|
+
update = UpdateQuery(LegalUserSca, '', **kwargs)
|
|
370
|
+
update.identifier = 'USERS_LEGAL_SCA_CATEGORIZE'
|
|
371
|
+
|
|
372
|
+
if kwargs == {}:
|
|
373
|
+
update.update_query = self.__dict__['_data']
|
|
374
|
+
|
|
375
|
+
return update.execute(self.handler)
|
|
376
|
+
|
|
377
|
+
@classmethod
|
|
378
|
+
def close(cls, *args, **kwargs):
|
|
379
|
+
return DeleteQuery(cls, *args, **kwargs).execute()
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
@python_2_unicode_compatible
|
|
383
|
+
class EMoney(BaseModel):
|
|
384
|
+
user = ForeignKeyField(User, api_name='UserId', related_name='emoney')
|
|
385
|
+
credited_emoney = MoneyField(api_name='CreditedEMoney')
|
|
386
|
+
debited_emoney = MoneyField(api_name='DebitedEMoney')
|
|
387
|
+
|
|
388
|
+
class Meta:
|
|
389
|
+
verbose_name = 'emoney'
|
|
390
|
+
url = {
|
|
391
|
+
'ALL': '/users/%(user_id)s/emoney',
|
|
392
|
+
'FOR_YEAR': '/users/%(user_id)s/emoney/%(year)s',
|
|
393
|
+
'FOR_MONTH': '/users/%(user_id)s/emoney/%(year)s/%(month)s'
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
def __str__(self):
|
|
397
|
+
return 'EMoney for user %s' % self.user_id
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
@python_2_unicode_compatible
|
|
401
|
+
class Wallet(BaseModel):
|
|
402
|
+
owners = ManyToManyField(User, api_name='Owners', related_name='wallets', required=True)
|
|
403
|
+
description = CharField(api_name='Description', required=True)
|
|
404
|
+
currency = CharField(api_name='Currency', required=True)
|
|
405
|
+
balance = MoneyField(api_name='Balance')
|
|
406
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
407
|
+
|
|
408
|
+
class Meta:
|
|
409
|
+
verbose_name = 'wallet'
|
|
410
|
+
verbose_name_plural = 'wallets'
|
|
411
|
+
url = {
|
|
412
|
+
InsertQuery.identifier: '/wallets',
|
|
413
|
+
SelectQuery.identifier: '/wallets',
|
|
414
|
+
UpdateQuery.identifier: '/wallets',
|
|
415
|
+
'GET_ALL_FOR_USER': '/users/%(user_id)s/wallets'
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
def __init__(self, *args, **kwargs):
|
|
419
|
+
super(Wallet, self).__init__(*args, **kwargs)
|
|
420
|
+
self.disputes = RelatedManager(self, Dispute)
|
|
421
|
+
|
|
422
|
+
def __str__(self):
|
|
423
|
+
return 'Wallet n.%s' % self.id
|
|
424
|
+
|
|
425
|
+
@classmethod
|
|
426
|
+
def is_client_wallet(cls, obj):
|
|
427
|
+
if isinstance(obj, Wallet) or isinstance(obj, ClientWallet):
|
|
428
|
+
test_id = obj.id
|
|
429
|
+
elif isinstance(obj, str):
|
|
430
|
+
test_id = obj
|
|
431
|
+
else:
|
|
432
|
+
return False
|
|
433
|
+
if test_id.startswith('FEES_') or \
|
|
434
|
+
test_id.startswith('DEFAULT_') or \
|
|
435
|
+
test_id.startswith('CREDIT_'):
|
|
436
|
+
return True
|
|
437
|
+
return False
|
|
438
|
+
|
|
439
|
+
@classmethod
|
|
440
|
+
def get(cls, *args, **kwargs):
|
|
441
|
+
if len(args) == 1 and cls.is_client_wallet(args[0]):
|
|
442
|
+
return ClientWallet.get(*tuple(args[0].split('_')), **kwargs)
|
|
443
|
+
return super(Wallet, cls).get(with_query_params=True, *args, **kwargs)
|
|
444
|
+
|
|
445
|
+
@staticmethod
|
|
446
|
+
def get_all_for_user(user_id, *args, **kwargs):
|
|
447
|
+
kwargs['user_id'] = user_id
|
|
448
|
+
select = SelectQuery(Wallet, *args, **kwargs)
|
|
449
|
+
select.identifier = 'GET_ALL_FOR_USER'
|
|
450
|
+
return select.all(*args, **kwargs)
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
@python_2_unicode_compatible
|
|
454
|
+
class ConversionRate(BaseModel):
|
|
455
|
+
debited_currency = CharField(api_name='DebitedCurrency', required=True)
|
|
456
|
+
credited_currency = CharField(api_name='CreditedCurrency', required=True)
|
|
457
|
+
client_rate = CharField(api_name='ClientRate')
|
|
458
|
+
market_rate = CharField(api_name='MarketRate')
|
|
459
|
+
|
|
460
|
+
def get_conversion_rate(self, *args, **kwargs):
|
|
461
|
+
kwargs['debited_currency'] = self.debited_currency
|
|
462
|
+
kwargs['credited_currency'] = self.credited_currency
|
|
463
|
+
select = SelectQuery(ConversionRate, *args, **kwargs)
|
|
464
|
+
select.identifier = 'GET_CONVERSION_RATE'
|
|
465
|
+
return select.all(*args, **kwargs)
|
|
466
|
+
|
|
467
|
+
class Meta:
|
|
468
|
+
verbose_name = 'conversion_rate'
|
|
469
|
+
verbose_name_plural = 'conversion_rates'
|
|
470
|
+
url = {
|
|
471
|
+
'GET_CONVERSION_RATE': '/conversions/rate/%(debited_currency)s/%(credited_currency)s'
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
class ConversionQuote(BaseModel):
|
|
476
|
+
expiration_date = DateTimeField(api_name='ExpirationDate')
|
|
477
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
478
|
+
duration = IntegerField(api_name='Duration')
|
|
479
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
480
|
+
credited_funds = MoneyField(api_name='CreditedFunds', required=True)
|
|
481
|
+
conversion_rate = ConversionRateField(api_name='ConversionRateResponse')
|
|
482
|
+
|
|
483
|
+
def create_conversion_quote(self, **kwargs):
|
|
484
|
+
insert = InsertQuery(self, **kwargs)
|
|
485
|
+
insert.insert_query = self.get_field_dict()
|
|
486
|
+
insert.identifier = 'CREATE_CONVERSION_QUOTE'
|
|
487
|
+
return insert.execute()
|
|
488
|
+
|
|
489
|
+
@staticmethod
|
|
490
|
+
def get_conversion_quote(id, *args, **kwargs):
|
|
491
|
+
kwargs['id'] = id
|
|
492
|
+
select = SelectQuery(ConversionQuote, *args, **kwargs)
|
|
493
|
+
select.identifier = 'GET_CONVERSION_QUOTE'
|
|
494
|
+
return select.all(*args, **kwargs)
|
|
495
|
+
|
|
496
|
+
class Meta:
|
|
497
|
+
verbose_name = 'conversion_quote'
|
|
498
|
+
verbose_name_plural = 'conversions'
|
|
499
|
+
url = {
|
|
500
|
+
'CREATE_CONVERSION_QUOTE': '/conversions/quote',
|
|
501
|
+
'GET_CONVERSION_QUOTE': '/conversions/quote/%(id)s'
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
@python_2_unicode_compatible
|
|
506
|
+
class Conversion(BaseModel):
|
|
507
|
+
quote_id = ForeignKeyField(ConversionQuote, api_name='QuoteId', default=None)
|
|
508
|
+
type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
|
|
509
|
+
nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
|
|
510
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
511
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
512
|
+
debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId', required=True)
|
|
513
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
514
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
515
|
+
credited_funds = MoneyField(api_name='CreditedFunds', required=True)
|
|
516
|
+
fees = MoneyField(api_name="Fees", required=True)
|
|
517
|
+
result_code = CharField(api_name='ResultCode')
|
|
518
|
+
result_message = CharField(api_name='ResultMessage')
|
|
519
|
+
execution_date = DateTimeField(api_name='ExecutionDate')
|
|
520
|
+
conversion_rate = ConversionRateField(api_name='ConversionRate')
|
|
521
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
522
|
+
|
|
523
|
+
@staticmethod
|
|
524
|
+
def get_conversion(id, *args, **kwargs):
|
|
525
|
+
kwargs['id'] = id
|
|
526
|
+
select = SelectQuery(Conversion, *args, **kwargs)
|
|
527
|
+
select.identifier = 'GET_CONVERSION'
|
|
528
|
+
return select.all(*args, **kwargs)
|
|
529
|
+
|
|
530
|
+
class Meta:
|
|
531
|
+
verbose_name = 'conversion'
|
|
532
|
+
verbose_name_plural = 'conversions'
|
|
533
|
+
url = {
|
|
534
|
+
'GET_CONVERSION': '/conversions/%(id)s'
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
class QuotedConversion(BaseModel):
|
|
539
|
+
quote = ForeignKeyField(ConversionQuote, api_name='QuoteId')
|
|
540
|
+
author = ForeignKeyField(User, api_name="AuthorId")
|
|
541
|
+
debited_wallet = ForeignKeyField(Wallet, api_name="DebitedWalletId")
|
|
542
|
+
credited_wallet = ForeignKeyField(Wallet, api_name="CreditedWalletId")
|
|
543
|
+
tag = CharField(api_name="Tag")
|
|
544
|
+
|
|
545
|
+
def save(self, **kwargs):
|
|
546
|
+
insert = InsertQuery(self, **kwargs)
|
|
547
|
+
insert.insert_query = self.get_field_dict()
|
|
548
|
+
insert.identifier = InsertQuery.identifier
|
|
549
|
+
return insert.execute(model_klass=Conversion)
|
|
550
|
+
|
|
551
|
+
class Meta:
|
|
552
|
+
verbose_name = 'quoted_conversion'
|
|
553
|
+
verbose_name_plural = 'quoted_conversions'
|
|
554
|
+
url = {
|
|
555
|
+
InsertQuery.identifier: '/conversions/quoted-conversion'
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
class ClientWalletsQuotedConversion(BaseModel):
|
|
560
|
+
quote = ForeignKeyField(ConversionQuote, api_name='QuoteId', required=True)
|
|
561
|
+
debited_wallet_type = CharField(Wallet, api_name="DebitedWalletType", required=True)
|
|
562
|
+
credited_wallet_type = CharField(Wallet, api_name="CreditedWalletType", required=True)
|
|
563
|
+
tag = CharField(api_name="Tag")
|
|
564
|
+
|
|
565
|
+
def save(self, **kwargs):
|
|
566
|
+
insert = InsertQuery(self, **kwargs)
|
|
567
|
+
insert.insert_query = self.get_field_dict()
|
|
568
|
+
insert.identifier = InsertQuery.identifier
|
|
569
|
+
return insert.execute(model_klass=Conversion)
|
|
570
|
+
|
|
571
|
+
class Meta:
|
|
572
|
+
verbose_name = 'client_wallet_quoted_conversion'
|
|
573
|
+
verbose_name_plural = 'client_wallet_quoted_conversions'
|
|
574
|
+
url = {
|
|
575
|
+
InsertQuery.identifier: '/clients/conversions/quoted-conversion'
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
class InstantConversion(BaseModel):
|
|
580
|
+
author = ForeignKeyField(User, api_name="AuthorId")
|
|
581
|
+
debited_wallet = ForeignKeyField(Wallet, api_name="DebitedWalletId")
|
|
582
|
+
credited_wallet = ForeignKeyField(Wallet, api_name="CreditedWalletId")
|
|
583
|
+
debited_funds = MoneyField(api_name="DebitedFunds")
|
|
584
|
+
credited_funds = MoneyField(api_name="CreditedFunds")
|
|
585
|
+
fees = MoneyField(api_name="Fees")
|
|
586
|
+
tag = CharField(api_name="Tag")
|
|
587
|
+
|
|
588
|
+
def save(self, **kwargs):
|
|
589
|
+
insert = InsertQuery(self, **kwargs)
|
|
590
|
+
insert.insert_query = self.get_field_dict()
|
|
591
|
+
insert.identifier = 'INSTANT_CONVERSION'
|
|
592
|
+
return insert.execute(model_klass=Conversion)
|
|
593
|
+
|
|
594
|
+
class Meta:
|
|
595
|
+
verbose_name = 'instant_conversion'
|
|
596
|
+
verbose_name_plural = 'instant_conversions'
|
|
597
|
+
url = {
|
|
598
|
+
'INSTANT_CONVERSION': '/conversions/instant-conversion'
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
class ClientWalletsInstantConversion(BaseModel):
|
|
603
|
+
debited_wallet_type = CharField(Wallet, api_name="DebitedWalletType", required=True)
|
|
604
|
+
credited_wallet_type = CharField(Wallet, api_name="CreditedWalletType", required=True)
|
|
605
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
606
|
+
credited_funds = MoneyField(api_name='CreditedFunds', required=True)
|
|
607
|
+
tag = CharField(api_name="Tag")
|
|
608
|
+
|
|
609
|
+
def save(self, **kwargs):
|
|
610
|
+
insert = InsertQuery(self, **kwargs)
|
|
611
|
+
insert.insert_query = self.get_field_dict()
|
|
612
|
+
insert.identifier = InsertQuery.identifier
|
|
613
|
+
return insert.execute(model_klass=Conversion)
|
|
614
|
+
|
|
615
|
+
class Meta:
|
|
616
|
+
verbose_name = 'client_wallet_instant_conversion'
|
|
617
|
+
verbose_name_plural = 'client_wallet_instant_conversions'
|
|
618
|
+
url = {
|
|
619
|
+
InsertQuery.identifier: '/clients/conversions/instant-conversion'
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
@python_2_unicode_compatible
|
|
624
|
+
class Transfer(BaseModel):
|
|
625
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
626
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId', required=True, related_name='credited_users')
|
|
627
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
628
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
629
|
+
debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId')
|
|
630
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
631
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
632
|
+
credited_funds = MoneyField(api_name='CreditedFunds')
|
|
633
|
+
status = CharField(api_name='Status',
|
|
634
|
+
choices=constants.STATUS_CHOICES,
|
|
635
|
+
default=None)
|
|
636
|
+
result_code = CharField(api_name='ResultCode')
|
|
637
|
+
result_message = CharField(api_name='ResultMessage')
|
|
638
|
+
execution_date = DateTimeField(api_name='ExecutionDate')
|
|
639
|
+
sca_context = CharField(api_name='ScaContext')
|
|
640
|
+
pending_user_action = PendingUserActionField(api_name='PendingUserAction')
|
|
641
|
+
|
|
642
|
+
def get_refunds(self, *args, **kwargs):
|
|
643
|
+
kwargs['id'] = self.id
|
|
644
|
+
select = SelectQuery(Refund, *args, **kwargs)
|
|
645
|
+
select.identifier = 'TRANSFER_GET_REFUNDS'
|
|
646
|
+
return select.all(*args, **kwargs)
|
|
647
|
+
|
|
648
|
+
class Meta:
|
|
649
|
+
verbose_name = 'transfer'
|
|
650
|
+
verbose_name_plural = 'transfers'
|
|
651
|
+
url = '/transfers'
|
|
652
|
+
|
|
653
|
+
def __str__(self):
|
|
654
|
+
return 'Transfer from wallet %s to wallet %s' % (self.debited_wallet_id, self.credited_wallet_id)
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
@python_2_unicode_compatible
|
|
658
|
+
class Card(BaseModel):
|
|
659
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
660
|
+
expiration_date = CharField(api_name='ExpirationDate')
|
|
661
|
+
alias = CharField(api_name='Alias')
|
|
662
|
+
card_provider = CharField(api_name='CardProvider')
|
|
663
|
+
card_type = CharField(api_name='CardType',
|
|
664
|
+
choices=constants.CARD_TYPE_CHOICES,
|
|
665
|
+
default=None)
|
|
666
|
+
country = CharField(api_name='Country')
|
|
667
|
+
product = CharField(api_name='Product')
|
|
668
|
+
bank_code = CharField(api_name='BankCode')
|
|
669
|
+
active = BooleanField(api_name='Active')
|
|
670
|
+
currency = CharField(api_name='Currency')
|
|
671
|
+
validity = CharField(api_name='Validity',
|
|
672
|
+
choices=constants.VALIDITY_CHOICES,
|
|
673
|
+
default=constants.VALIDITY_CHOICES.unknown)
|
|
674
|
+
user = ForeignKeyField(User, api_name='UserId', required=True, related_name='cards')
|
|
675
|
+
fingerprint = CharField(api_name='Fingerprint')
|
|
676
|
+
card_holder_name = CharField(api_name='CardHolderName')
|
|
677
|
+
|
|
678
|
+
@classmethod
|
|
679
|
+
def get_by_fingerprint(cls, fingerprint, *args, **kwargs):
|
|
680
|
+
kwargs['fingerprint'] = fingerprint
|
|
681
|
+
select = SelectQuery(cls, *args, **kwargs)
|
|
682
|
+
select.identifier = 'CARDS_FOR_FINGERPRINT'
|
|
683
|
+
return select.all(*args, **kwargs)
|
|
684
|
+
|
|
685
|
+
def get_pre_authorizations(self, *args, **kwargs):
|
|
686
|
+
kwargs['id'] = self.id
|
|
687
|
+
select = SelectQuery(PreAuthorization, *args, **kwargs)
|
|
688
|
+
select.identifier = 'CARD_PRE_AUTHORIZATIONS'
|
|
689
|
+
return select.all(*args, **kwargs)
|
|
690
|
+
|
|
691
|
+
def get_transactions(self, *args, **kwargs):
|
|
692
|
+
kwargs['id'] = self.id
|
|
693
|
+
select = SelectQuery(Transaction, *args, **kwargs)
|
|
694
|
+
select.identifier = 'CARD_GET_TRANSACTIONS'
|
|
695
|
+
return select.all(*args, **kwargs)
|
|
696
|
+
|
|
697
|
+
@classmethod
|
|
698
|
+
def get_transactions_by_fingerprint(cls, fingerprint, *args, **kwargs):
|
|
699
|
+
kwargs['fingerprint'] = fingerprint
|
|
700
|
+
select = SelectQuery(Transaction, *args, **kwargs)
|
|
701
|
+
select.identifier = 'TRANSACTIONS_FOR_FINGERPRINT'
|
|
702
|
+
return select.all(*args, **kwargs)
|
|
703
|
+
|
|
704
|
+
class Meta:
|
|
705
|
+
verbose_name = 'card'
|
|
706
|
+
verbose_name_plural = 'cards'
|
|
707
|
+
url = {
|
|
708
|
+
SelectQuery.identifier: '/cards',
|
|
709
|
+
UpdateQuery.identifier: '/cards',
|
|
710
|
+
'CARDS_FOR_FINGERPRINT': '/cards/fingerprints/%(fingerprint)s'
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
def __str__(self):
|
|
714
|
+
return '%s of user %s' % (self.card_type, self.user_id)
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
class CardValidation(BaseModel):
|
|
718
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
719
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
720
|
+
ip_address = CharField(api_name='IpAddress', required=True)
|
|
721
|
+
browser_info = BrowserInfoField(api_name='BrowserInfo', required=True)
|
|
722
|
+
secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True)
|
|
723
|
+
secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
|
|
724
|
+
secure_mode_needed = BooleanField(api_name='SecureModeNeeded')
|
|
725
|
+
secure_mode = CharField(api_name='SecureMode',
|
|
726
|
+
choices=constants.SECURE_MODE_CHOICES)
|
|
727
|
+
validity = CharField(api_name='Validity',
|
|
728
|
+
choices=constants.VALIDITY_CHOICES,
|
|
729
|
+
default=constants.VALIDITY_CHOICES.unknown)
|
|
730
|
+
type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
|
|
731
|
+
applied_3ds_version = CharField(api_name='Applied3DSVersion')
|
|
732
|
+
status = CharField(api_name='Status',
|
|
733
|
+
choices=constants.STATUS_CHOICES,
|
|
734
|
+
default=None)
|
|
735
|
+
result_code = CharField(api_name='ResultCode')
|
|
736
|
+
result_message = CharField(api_name='ResultMessage')
|
|
737
|
+
preferred_card_network = CharField(api_name='PreferredCardNetwork')
|
|
738
|
+
authorization_date = DateTimeField(api_name='AuthorizationDate')
|
|
739
|
+
card_info = CardInfoField(api_name='CardInfo')
|
|
740
|
+
payment_category = CharField(api_name='PaymentCategory')
|
|
741
|
+
|
|
742
|
+
def validate(self, card_id, **kwargs):
|
|
743
|
+
insert = InsertQuery(self, **kwargs)
|
|
744
|
+
insert.insert_query = self.get_field_dict()
|
|
745
|
+
insert.insert_query['id'] = card_id
|
|
746
|
+
insert.identifier = 'CARD_VALIDATE'
|
|
747
|
+
return insert.execute()
|
|
748
|
+
|
|
749
|
+
def get_card_validation(self, card_id, *args, **kwargs):
|
|
750
|
+
kwargs['card_id'] = card_id
|
|
751
|
+
kwargs['id'] = self.id
|
|
752
|
+
select = SelectQuery(CardValidation, *args, **kwargs)
|
|
753
|
+
select.identifier = 'GET_CARD_VALIDATION'
|
|
754
|
+
return select.all(*args, **kwargs)
|
|
755
|
+
|
|
756
|
+
class Meta:
|
|
757
|
+
verbose_name = 'card_validation'
|
|
758
|
+
verbose_name_plural = 'card_validations'
|
|
759
|
+
url = {
|
|
760
|
+
'CARD_VALIDATE': '/cards/%(id)s/validation',
|
|
761
|
+
'GET_CARD_VALIDATION': '/cards/%(card_id)s/validation/%(id)s'
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
class CardRegistration(BaseModel):
|
|
766
|
+
user = ForeignKeyField(User, api_name='UserId', required=True, related_name='card_registrations')
|
|
767
|
+
currency = CharField(api_name='Currency', required=True)
|
|
768
|
+
card_type = CharField(api_name='CardType', choices=constants.CARD_TYPE_CHOICES, default=None)
|
|
769
|
+
card_registration_url = CharField(api_name='CardRegistrationURL')
|
|
770
|
+
access_key = CharField(api_name='AccessKey')
|
|
771
|
+
preregistration_data = CharField(api_name='PreregistrationData')
|
|
772
|
+
registration_data = CharField(api_name='RegistrationData')
|
|
773
|
+
card = ForeignKeyField(Card, api_name='CardId')
|
|
774
|
+
result_code = CharField(api_name='ResultCode')
|
|
775
|
+
result_message = CharField(api_name='ResultMessage')
|
|
776
|
+
status = CharField(api_name='Status', choices=constants.CARD_STATUS_CHOICES, default=None)
|
|
777
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
778
|
+
card_holder_name = CharField(api_name='CardHolderName')
|
|
779
|
+
|
|
780
|
+
class Meta:
|
|
781
|
+
verbose_name = 'cardregistration'
|
|
782
|
+
verbose_name_plural = 'cardregistrations'
|
|
783
|
+
url = '/cardregistrations'
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
class Mandate(BaseModel):
|
|
787
|
+
user = ForeignKeyField(User, api_name='UserId', related_name='mandates')
|
|
788
|
+
bank_account_id = CharField(api_name='BankAccountId', required=True)
|
|
789
|
+
return_url = CharField(api_name='ReturnURL')
|
|
790
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
791
|
+
document_url = CharField(api_name='DocumentURL')
|
|
792
|
+
culture = CharField(api_name='Culture')
|
|
793
|
+
bank_reference = CharField(api_name='BankReference')
|
|
794
|
+
|
|
795
|
+
scheme = CharField(api_name='Scheme', choices=constants.MANDATE_SCHEME_CHOICES, default=None)
|
|
796
|
+
|
|
797
|
+
status = CharField(api_name='Status',
|
|
798
|
+
choices=constants.MANDATE_STATUS_CHOICES,
|
|
799
|
+
default=None)
|
|
800
|
+
|
|
801
|
+
result_code = CharField(api_name='ResultCode')
|
|
802
|
+
result_message = CharField(api_name='ResultMessage')
|
|
803
|
+
|
|
804
|
+
execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None)
|
|
805
|
+
mandate_type = CharField(api_name='MandateType', choiced=constants.MANDATE_TYPE_CHOICES, default=None)
|
|
806
|
+
|
|
807
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
808
|
+
|
|
809
|
+
def get_transactions(self, *args, **kwargs):
|
|
810
|
+
kwargs['id'] = self.id
|
|
811
|
+
select = SelectQuery(Transaction, *args, **kwargs)
|
|
812
|
+
select.identifier = 'MANDATE_GET_TRANSACTIONS'
|
|
813
|
+
return select.all(*args, **kwargs)
|
|
814
|
+
|
|
815
|
+
class Meta:
|
|
816
|
+
verbose_name = 'mandate'
|
|
817
|
+
verbose_name_plural = 'mandates'
|
|
818
|
+
url = {
|
|
819
|
+
SelectQuery.identifier: '/mandates',
|
|
820
|
+
InsertQuery.identifier: '/mandates/directdebit/web',
|
|
821
|
+
'CANCEL_MANDATE': '/mandates/%(id)s/cancel/',
|
|
822
|
+
'MANDATES_FOR_BANKACCOUNT': '/users/%(user_id)s/bankaccounts/%(id)s/mandates/'
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
def __str__(self):
|
|
826
|
+
return 'Mandate n.%s' % self.id
|
|
827
|
+
|
|
828
|
+
def cancel(self, handler=None):
|
|
829
|
+
self._handler = handler or self.handler
|
|
830
|
+
|
|
831
|
+
if self.status not in ('SUBMITTED', 'ACTIVE'):
|
|
832
|
+
raise TypeError('Mandate status must be SUBMITTED or ACTIVE')
|
|
833
|
+
|
|
834
|
+
action = ActionQuery(
|
|
835
|
+
Mandate,
|
|
836
|
+
self.get_pk(),
|
|
837
|
+
'CANCEL_MANDATE'
|
|
838
|
+
)
|
|
839
|
+
return action.execute(handler)
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
class PayIn(BaseModel):
|
|
843
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId', related_name='credited_users')
|
|
844
|
+
credited_funds = MoneyField(api_name='CreditedFunds')
|
|
845
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId')
|
|
846
|
+
debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId')
|
|
847
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
848
|
+
result_code = CharField(api_name='ResultCode')
|
|
849
|
+
result_message = CharField(api_name='ResultMessage')
|
|
850
|
+
execution_date = DateTimeField(api_name='ExecutionDate')
|
|
851
|
+
type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
|
|
852
|
+
nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
|
|
853
|
+
payment_type = CharField(api_name='PaymentType', choices=constants.PAYIN_PAYMENT_TYPE, default=None)
|
|
854
|
+
execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None)
|
|
855
|
+
profiling_attempt_reference = CharField(api_name='ProfilingAttemptReference')
|
|
856
|
+
|
|
857
|
+
def get_refunds(self, *args, **kwargs):
|
|
858
|
+
kwargs['id'] = self.id
|
|
859
|
+
select = SelectQuery(Refund, args, kwargs)
|
|
860
|
+
select.identifier = 'PAYIN_GET_REFUNDS'
|
|
861
|
+
return select.all(*args, **kwargs)
|
|
862
|
+
|
|
863
|
+
class Meta:
|
|
864
|
+
verbose_name = 'payin'
|
|
865
|
+
verbose_name_plural = 'payins'
|
|
866
|
+
url = '/payins'
|
|
867
|
+
|
|
868
|
+
def __init__(self, *args, **kwargs):
|
|
869
|
+
super(PayIn, self).__init__(*args, **kwargs)
|
|
870
|
+
self.disputes = RelatedManager(self, Dispute)
|
|
871
|
+
|
|
872
|
+
@classmethod
|
|
873
|
+
def cast(cls, result):
|
|
874
|
+
if cls.__name__ == "RecurringPayInCIT":
|
|
875
|
+
return RecurringPayInCIT
|
|
876
|
+
|
|
877
|
+
if cls.__name__ == "RecurringPayInMIT":
|
|
878
|
+
return RecurringPayInMIT
|
|
879
|
+
|
|
880
|
+
if cls.__name__ == "RecurringPayPalPayInCIT":
|
|
881
|
+
return RecurringPayPalPayInCIT
|
|
882
|
+
|
|
883
|
+
if cls.__name__ == "RecurringPayPalPayInMIT":
|
|
884
|
+
return RecurringPayPalPayInMIT
|
|
885
|
+
|
|
886
|
+
payment_type = result.get('PaymentType')
|
|
887
|
+
execution_type = result.get('ExecutionType')
|
|
888
|
+
|
|
889
|
+
types = {
|
|
890
|
+
("CARD", "DIRECT"): DirectPayIn,
|
|
891
|
+
("CARD", "WEB"): CardWebPayIn,
|
|
892
|
+
("DIRECT_DEBIT", "DIRECT"): DirectDebitDirectPayIn,
|
|
893
|
+
("DIRECT_DEBIT", "WEB"): DirectDebitWebPayIn,
|
|
894
|
+
("PREAUTHORIZED", "DIRECT"): PreAuthorizedPayIn,
|
|
895
|
+
("BANK_WIRE", "DIRECT"): BankWirePayIn,
|
|
896
|
+
("BANK_WIRE", "EXTERNAL_INSTRUCTION"): BankWirePayInExternalInstruction,
|
|
897
|
+
("APPLEPAY", "DIRECT"): ApplepayPayIn,
|
|
898
|
+
("GOOGLEPAY", "DIRECT"): GooglepayPayIn,
|
|
899
|
+
("GOOGLE_PAY", "DIRECT"): GooglePayDirectPayIn,
|
|
900
|
+
("MBWAY", "WEB"): MbwayPayIn,
|
|
901
|
+
("PAYPAL", "WEB"): PayPalWebPayIn,
|
|
902
|
+
("MULTIBANCO", "WEB"): MultibancoPayIn,
|
|
903
|
+
("SATISPAY", "WEB"): SatispayPayIn,
|
|
904
|
+
("BLIK", "WEB"): BlikPayIn,
|
|
905
|
+
("KLARNA", "WEB"): KlarnaPayIn,
|
|
906
|
+
("IDEAL", "WEB"): IdealPayIn,
|
|
907
|
+
("GIROPAY", "WEB"): GiropayPayIn,
|
|
908
|
+
("BANCONTACT", "WEB"): BancontactPayIn,
|
|
909
|
+
("BIZUM", "WEB"): BizumPayIn,
|
|
910
|
+
("SWISH", "WEB"): SwishPayIn,
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
return types.get((payment_type, execution_type), cls)
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
@python_2_unicode_compatible
|
|
917
|
+
class RecurringPayInRegistration(BaseModel):
|
|
918
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
919
|
+
card = ForeignKeyField(Card, api_name='CardId')
|
|
920
|
+
user = ForeignKeyField(User, api_name='CreditedUserId')
|
|
921
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId')
|
|
922
|
+
first_transaction_debited_funds = MoneyField(api_name='FirstTransactionDebitedFunds', required=True)
|
|
923
|
+
first_transaction_fees = MoneyField(api_name='FirstTransactionFees', required=True)
|
|
924
|
+
billing = BillingField(api_name='Billing', required=False)
|
|
925
|
+
shipping = ShippingField(api_name='Shipping', required=False)
|
|
926
|
+
end_date = DateField(api_name='EndDate')
|
|
927
|
+
frequency = CharField(api_name='Frequency')
|
|
928
|
+
fixed_next_amount = BooleanField(api_name='FixedNextAmount')
|
|
929
|
+
fractioned_payment = BooleanField(api_name='FractionedPayment')
|
|
930
|
+
migration = BooleanField(api_name='Migration')
|
|
931
|
+
next_transaction_debited_funds = MoneyField(api_name='NextTransactionDebitedFunds')
|
|
932
|
+
next_transaction_fees = MoneyField(api_name='NextTransactionFees')
|
|
933
|
+
free_cycles = IntegerField(api_name='FreeCycles', required=False)
|
|
934
|
+
cycle_number = IntegerField(api_name='CycleNumber')
|
|
935
|
+
total_amount = MoneyField(api_name='TotalAmount')
|
|
936
|
+
recurring_type = CharField(api_name='RecurringType')
|
|
937
|
+
current_state = CurrentStateField(api_name='CurrentState')
|
|
938
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
939
|
+
payment_type = CharField(api_name='PaymentType', choices=constants.RECURRING_PAYIN_REGISTRATION_PAYMENT_TYPE,
|
|
940
|
+
default=None)
|
|
941
|
+
|
|
942
|
+
def get_read_only_properties(self):
|
|
943
|
+
read_only = ["Id", "FreeCycles", "CycleNumber", "TotalAmount", "RecurringType", "Status", "CurrentState"]
|
|
944
|
+
return read_only
|
|
945
|
+
|
|
946
|
+
class Meta:
|
|
947
|
+
verbose_name = 'recurring_registration_payin'
|
|
948
|
+
verbose_name_plural = 'recurring_registration_payins'
|
|
949
|
+
url = {
|
|
950
|
+
InsertQuery.identifier: '/recurringpayinregistrations',
|
|
951
|
+
SelectQuery.identifier: '/recurringpayinregistrations',
|
|
952
|
+
UpdateQuery.identifier: '/recurringpayinregistrations'
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
@python_2_unicode_compatible
|
|
957
|
+
class RecurringPayInCIT(PayIn):
|
|
958
|
+
recurring_payin_registration_id = CharField(api_name='RecurringPayinRegistrationId', required=True)
|
|
959
|
+
browser_info = BrowserInfoField(api_name='BrowserInfo', required=True)
|
|
960
|
+
ip_address = CharField(api_name='IpAddress', required=True)
|
|
961
|
+
secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True)
|
|
962
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
963
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
964
|
+
fees = MoneyField(api_name='Fees')
|
|
965
|
+
applied_3ds_version = CharField(api_name='Applied3DSVersion')
|
|
966
|
+
author = ForeignKeyField(User, api_name='AuthorId')
|
|
967
|
+
billing = BillingField(api_name='Billing')
|
|
968
|
+
card = ForeignKeyField(Card, api_name='CardId')
|
|
969
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
970
|
+
culture = CharField(api_name='Culture')
|
|
971
|
+
secure_mode_needed = BooleanField(api_name='SecureModeNeeded')
|
|
972
|
+
secure_mode = CharField(api_name='SecureMode',
|
|
973
|
+
choices=constants.SECURE_MODE_CHOICES)
|
|
974
|
+
secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
|
|
975
|
+
security_info = SecurityInfoField(api_name='SecurityInfo')
|
|
976
|
+
shipping = ShippingField(api_name='Shipping')
|
|
977
|
+
card_info = CardInfoField(api_name='CardInfo')
|
|
978
|
+
|
|
979
|
+
def get_read_only_properties(self):
|
|
980
|
+
read_only = ["AuthorId", "Applied3DSVersion", "CardId", "CreationDate", "Culture", "SecureModeNeeded"
|
|
981
|
+
, "SecureMode", "SecureModeRedirectURL", "SecurityInfo"]
|
|
982
|
+
return read_only
|
|
983
|
+
|
|
984
|
+
class Meta:
|
|
985
|
+
verbose_name = 'recurring_payin'
|
|
986
|
+
verbose_name_plural = 'recurring_payins'
|
|
987
|
+
url = {
|
|
988
|
+
InsertQuery.identifier: '/payins/recurring/card/direct',
|
|
989
|
+
SelectQuery.identifier: '/payins'
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
@python_2_unicode_compatible
|
|
994
|
+
class RecurringPayInMIT(PayIn):
|
|
995
|
+
recurring_payin_registration_id = CharField(api_name='RecurringPayinRegistrationId', required=True)
|
|
996
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
997
|
+
fees = MoneyField(api_name='Fees')
|
|
998
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
999
|
+
browser_info = BrowserInfoField(api_name='BrowserInfo')
|
|
1000
|
+
ip_address = CharField(api_name='IpAddress')
|
|
1001
|
+
secure_mode_return_url = CharField(api_name='SecureModeReturnURL')
|
|
1002
|
+
applied_3ds_version = CharField(api_name='Applied3DSVersion')
|
|
1003
|
+
author = ForeignKeyField(User, api_name='AuthorId')
|
|
1004
|
+
billing = BillingField(api_name='Billing')
|
|
1005
|
+
card = ForeignKeyField(Card, api_name='CardId')
|
|
1006
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1007
|
+
culture = CharField(api_name='Culture')
|
|
1008
|
+
secure_mode_needed = BooleanField(api_name='SecureModeNeeded')
|
|
1009
|
+
secure_mode = CharField(api_name='SecureMode',
|
|
1010
|
+
choices=constants.SECURE_MODE_CHOICES)
|
|
1011
|
+
secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
|
|
1012
|
+
security_info = SecurityInfoField(api_name='SecurityInfo')
|
|
1013
|
+
shipping = ShippingField(api_name='Shipping')
|
|
1014
|
+
card_info = CardInfoField(api_name='CardInfo')
|
|
1015
|
+
|
|
1016
|
+
def get_read_only_properties(self):
|
|
1017
|
+
read_only = ["AuthorId", "Applied3DSVersion", "CardId", "CreationDate", "Culture", "SecureModeNeeded"
|
|
1018
|
+
, "SecureMode", "SecureModeRedirectURL", "SecurityInfo", "DebitedFunds", "Fees",
|
|
1019
|
+
"StatementDescriptor", "BrowserInfo", "IpAddress", "SecureModeReturnURL"]
|
|
1020
|
+
return read_only
|
|
1021
|
+
|
|
1022
|
+
class Meta:
|
|
1023
|
+
verbose_name = 'recurring_payin'
|
|
1024
|
+
verbose_name_plural = 'recurring_payins'
|
|
1025
|
+
url = {
|
|
1026
|
+
InsertQuery.identifier: '/payins/recurring/card/direct',
|
|
1027
|
+
SelectQuery.identifier: '/payins'
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
@python_2_unicode_compatible
|
|
1032
|
+
class RecurringPayPalPayInCIT(PayIn):
|
|
1033
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1034
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
1035
|
+
fees = MoneyField(api_name='Fees')
|
|
1036
|
+
author = ForeignKeyField(User, api_name='AuthorId')
|
|
1037
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1038
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1039
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1040
|
+
shipping = ShippingField(api_name='Shipping')
|
|
1041
|
+
line_items = ListField(api_name='LineItems', required=True)
|
|
1042
|
+
culture = CharField(api_name='Culture')
|
|
1043
|
+
shipping_preference = CharField(api_name='ShippingPreference', choices=constants.SHIPPING_PREFERENCE_CHOICES,
|
|
1044
|
+
default=None)
|
|
1045
|
+
buyer_account_email = CharField(api_name="PaypalBuyerAccountEmail")
|
|
1046
|
+
reference = CharField(api_name='Reference')
|
|
1047
|
+
trackings = ListField(api_name='Trackings')
|
|
1048
|
+
cancel_url = CharField(api_name='CancelURL')
|
|
1049
|
+
paypal_order_id = CharField(api_name='PaypalOrderID')
|
|
1050
|
+
buyer_country = CharField(api_name='BuyerCountry')
|
|
1051
|
+
buyer_first_name = CharField(api_name='BuyerFirstname')
|
|
1052
|
+
buyer_last_name = CharField(api_name='BuyerLastname')
|
|
1053
|
+
buyer_phone = CharField(api_name='BuyerPhone')
|
|
1054
|
+
paypal_payer_id = CharField(api_name='PaypalPayerID')
|
|
1055
|
+
recurring_payin_registration_id = CharField(api_name='RecurringPayinRegistrationId', required=True)
|
|
1056
|
+
data_collection_id = CharField(api_name='DataCollectionId')
|
|
1057
|
+
|
|
1058
|
+
class Meta:
|
|
1059
|
+
verbose_name = 'recurring_paypal_payin'
|
|
1060
|
+
verbose_name_plural = 'recurring_paypal_payins'
|
|
1061
|
+
url = {
|
|
1062
|
+
InsertQuery.identifier: '/payins/payment-methods/paypal/recurring',
|
|
1063
|
+
SelectQuery.identifier: '/payins'
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
@python_2_unicode_compatible
|
|
1068
|
+
class RecurringPayPalPayInMIT(PayIn):
|
|
1069
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1070
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
1071
|
+
fees = MoneyField(api_name='Fees')
|
|
1072
|
+
author = ForeignKeyField(User, api_name='AuthorId')
|
|
1073
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1074
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1075
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1076
|
+
shipping = ShippingField(api_name='Shipping')
|
|
1077
|
+
line_items = ListField(api_name='LineItems', required=True)
|
|
1078
|
+
culture = CharField(api_name='Culture')
|
|
1079
|
+
shipping_preference = CharField(api_name='ShippingPreference', choices=constants.SHIPPING_PREFERENCE_CHOICES,
|
|
1080
|
+
default=None)
|
|
1081
|
+
buyer_account_email = CharField(api_name="PaypalBuyerAccountEmail")
|
|
1082
|
+
reference = CharField(api_name='Reference')
|
|
1083
|
+
trackings = ListField(api_name='Trackings')
|
|
1084
|
+
cancel_url = CharField(api_name='CancelURL')
|
|
1085
|
+
paypal_order_id = CharField(api_name='PaypalOrderID')
|
|
1086
|
+
buyer_country = CharField(api_name='BuyerCountry')
|
|
1087
|
+
buyer_first_name = CharField(api_name='BuyerFirstname')
|
|
1088
|
+
buyer_last_name = CharField(api_name='BuyerLastname')
|
|
1089
|
+
buyer_phone = CharField(api_name='BuyerPhone')
|
|
1090
|
+
paypal_payer_id = CharField(api_name='PaypalPayerID')
|
|
1091
|
+
recurring_payin_registration_id = CharField(api_name='RecurringPayinRegistrationId', required=True)
|
|
1092
|
+
data_collection_id = CharField(api_name='DataCollectionId')
|
|
1093
|
+
|
|
1094
|
+
class Meta:
|
|
1095
|
+
verbose_name = 'recurring_paypal_payin'
|
|
1096
|
+
verbose_name_plural = 'recurring_paypal_payins'
|
|
1097
|
+
url = {
|
|
1098
|
+
InsertQuery.identifier: '/payins/payment-methods/paypal/recurring',
|
|
1099
|
+
SelectQuery.identifier: '/payins'
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
@python_2_unicode_compatible
|
|
1104
|
+
class DirectPayIn(PayIn):
|
|
1105
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1106
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1107
|
+
secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
|
|
1108
|
+
secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True)
|
|
1109
|
+
card = ForeignKeyField(Card, api_name='CardId', required=True)
|
|
1110
|
+
secure_mode_needed = BooleanField(api_name='SecureModeNeeded')
|
|
1111
|
+
secure_mode = CharField(api_name='SecureMode',
|
|
1112
|
+
choices=constants.SECURE_MODE_CHOICES,
|
|
1113
|
+
default=constants.SECURE_MODE_CHOICES.default)
|
|
1114
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1115
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1116
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1117
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1118
|
+
billing = BillingField(api_name='Billing')
|
|
1119
|
+
security_info = SecurityInfoField(api_name='SecurityInfo')
|
|
1120
|
+
culture = CharField(api_name='Culture')
|
|
1121
|
+
ip_address = CharField(api_name='IpAddress')
|
|
1122
|
+
browser_info = BrowserInfoField(api_name='BrowserInfo')
|
|
1123
|
+
shipping = ShippingField(api_name='Shipping')
|
|
1124
|
+
requested_3ds_version = CharField(api_name='Requested3DSVersion')
|
|
1125
|
+
applied_3ds_version = CharField(api_name='Applied3DSVersion')
|
|
1126
|
+
preferred_card_network = CharField(api_name='PreferredCardNetwork')
|
|
1127
|
+
card_info = CardInfoField(api_name='CardInfo')
|
|
1128
|
+
payment_category = CharField(api_name='PaymentCategory')
|
|
1129
|
+
|
|
1130
|
+
class Meta:
|
|
1131
|
+
verbose_name = 'payin'
|
|
1132
|
+
verbose_name_plural = 'payins'
|
|
1133
|
+
url = {
|
|
1134
|
+
InsertQuery.identifier: '/payins/card/direct',
|
|
1135
|
+
SelectQuery.identifier: '/payins'
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
def __str__(self):
|
|
1139
|
+
return 'Direct Payin: %s to %s' % (self.author_id, self.credited_user_id)
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
@python_2_unicode_compatible
|
|
1143
|
+
class BankWirePayIn(PayIn):
|
|
1144
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1145
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1146
|
+
declared_debited_funds = MoneyField(api_name='DeclaredDebitedFunds', required=True)
|
|
1147
|
+
declared_fees = MoneyField(api_name='DeclaredFees', required=True)
|
|
1148
|
+
wire_reference = CharField(api_name='WireReference')
|
|
1149
|
+
bank_account = CharField(api_name='BankAccount')
|
|
1150
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
1151
|
+
fees = MoneyField(api_name='Fees')
|
|
1152
|
+
|
|
1153
|
+
class Meta:
|
|
1154
|
+
verbose_name = 'payin'
|
|
1155
|
+
verbose_name_plural = 'payins'
|
|
1156
|
+
url = {
|
|
1157
|
+
InsertQuery.identifier: '/payins/bankwire/direct',
|
|
1158
|
+
SelectQuery.identifier: '/payins'
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
def __str__(self):
|
|
1162
|
+
return 'Bank Wire Payin: %s to %s' % (self.author_id, self.credited_user_id)
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
@python_2_unicode_compatible
|
|
1166
|
+
class BankWirePayInExternalInstruction(PayIn):
|
|
1167
|
+
banking_alias_id = CharField(api_name='BankingAliasId')
|
|
1168
|
+
wire_reference = CharField(api_name='WireReference')
|
|
1169
|
+
debited_bank_account = DebitedBankAccountField(api_name='DebitedBankAccount')
|
|
1170
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
1171
|
+
fees = MoneyField(api_name='Fees')
|
|
1172
|
+
|
|
1173
|
+
class Meta:
|
|
1174
|
+
verbose_name = 'payin'
|
|
1175
|
+
verbose_name_plural = 'payins'
|
|
1176
|
+
url = {
|
|
1177
|
+
SelectQuery.identifier: '/payins'
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
def __str__(self):
|
|
1181
|
+
return 'Bank Wire Payin External Instruction'
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
@python_2_unicode_compatible
|
|
1185
|
+
class PayPalPayIn(PayIn):
|
|
1186
|
+
tag = CharField(api_name='Tag')
|
|
1187
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1188
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId', related_name='credited_users')
|
|
1189
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1190
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1191
|
+
return_url = CharField(api_name='ReturnURL', required=False)
|
|
1192
|
+
redirect_url = CharField(api_name='RedirectURL', required=False)
|
|
1193
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1194
|
+
shipping_address = ShippingAddressField(api_name='ShippingAddress')
|
|
1195
|
+
buyer_account_email = CharField(api_name="PaypalBuyerAccountEmail", required=False)
|
|
1196
|
+
|
|
1197
|
+
class Meta:
|
|
1198
|
+
verbose_name = 'payin'
|
|
1199
|
+
verbose_name_plural = 'payins'
|
|
1200
|
+
url = {
|
|
1201
|
+
InsertQuery.identifier: '/payins/paypal/web',
|
|
1202
|
+
SelectQuery.identifier: '/payins'
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
@python_2_unicode_compatible
|
|
1207
|
+
class PayPalWebPayIn(PayIn):
|
|
1208
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1209
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1210
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1211
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1212
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1213
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1214
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1215
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1216
|
+
shipping = ShippingField(api_name='Shipping')
|
|
1217
|
+
line_items = ListField(api_name='LineItems', required=True)
|
|
1218
|
+
culture = CharField(api_name='Culture')
|
|
1219
|
+
shipping_preference = CharField(api_name='ShippingPreference', choices=constants.SHIPPING_PREFERENCE_CHOICES,
|
|
1220
|
+
default=None)
|
|
1221
|
+
reference = CharField(api_name='Reference')
|
|
1222
|
+
cancel_url = CharField(api_name='CancelURL')
|
|
1223
|
+
paypal_payer_id = CharField(api_name='PaypalPayerID')
|
|
1224
|
+
buyer_country = CharField(api_name='BuyerCountry')
|
|
1225
|
+
buyer_first_name = CharField(api_name='BuyerFirstname')
|
|
1226
|
+
buyer_last_name = CharField(api_name='BuyerLastname')
|
|
1227
|
+
buyer_phone = CharField(api_name='BuyerPhone')
|
|
1228
|
+
paypal_order_id = CharField(api_name='PaypalOrderID')
|
|
1229
|
+
trackings = ListField(api_name='Trackings')
|
|
1230
|
+
data_collection_id = CharField(api_name='DataCollectionId')
|
|
1231
|
+
|
|
1232
|
+
class Meta:
|
|
1233
|
+
verbose_name = 'payin'
|
|
1234
|
+
verbose_name_plural = 'payins'
|
|
1235
|
+
url = {
|
|
1236
|
+
InsertQuery.identifier: '/payins/payment-methods/paypal',
|
|
1237
|
+
SelectQuery.identifier: '/payins',
|
|
1238
|
+
'ADD_TRACKING_INFORMATION': '/payins/%(id)s/trackings'
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
@classmethod
|
|
1242
|
+
def add_tracking_information(cls, pay_in_id, tracking_information):
|
|
1243
|
+
action = ActionQuery(
|
|
1244
|
+
model=cls,
|
|
1245
|
+
reference=cls.id,
|
|
1246
|
+
identifier='ADD_TRACKING_INFORMATION',
|
|
1247
|
+
method='PUT',
|
|
1248
|
+
params={'id': pay_in_id}
|
|
1249
|
+
)
|
|
1250
|
+
action.action_query = tracking_information.to_api_json()
|
|
1251
|
+
return action.execute()
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
@python_2_unicode_compatible
|
|
1255
|
+
class PayconiqPayIn(PayIn):
|
|
1256
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1257
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1258
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1259
|
+
return_url = CharField(api_name='ReturnURL', required=False)
|
|
1260
|
+
redirect_url = CharField(api_name='RedirectURL', required=False)
|
|
1261
|
+
creation_date = DateField(api_name='CreationDate', required=False)
|
|
1262
|
+
expiration_date = CharField(api_name='ExpirationDate', required=False)
|
|
1263
|
+
deep_link_url = CharField(api_name='DeepLinkURL', required=False)
|
|
1264
|
+
|
|
1265
|
+
class Meta:
|
|
1266
|
+
verbose_name = 'payin'
|
|
1267
|
+
verbose_name_plural = 'payins'
|
|
1268
|
+
url = {
|
|
1269
|
+
InsertQuery.identifier: '/payins/payconiq/web',
|
|
1270
|
+
SelectQuery.identifier: '/payins'
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
@python_2_unicode_compatible
|
|
1275
|
+
class PayconiqV2PayIn(PayIn):
|
|
1276
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1277
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1278
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1279
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1280
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1281
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1282
|
+
creation_date = DateField(api_name='CreationDate')
|
|
1283
|
+
expiration_date = CharField(api_name='ExpirationDate')
|
|
1284
|
+
deep_link_url = CharField(api_name='DeepLinkURL')
|
|
1285
|
+
country = CharField(api_name='Country', required=True)
|
|
1286
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1287
|
+
qr_code_url = CharField(api_name='QRCodeURL')
|
|
1288
|
+
|
|
1289
|
+
class Meta:
|
|
1290
|
+
verbose_name = 'payin'
|
|
1291
|
+
verbose_name_plural = 'payins'
|
|
1292
|
+
url = {
|
|
1293
|
+
InsertQuery.identifier: '/payins/payment-methods/payconiq',
|
|
1294
|
+
SelectQuery.identifier: '/payins'
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
class ApplepayPayIn(PayIn):
|
|
1299
|
+
tag = CharField(api_name='Tag')
|
|
1300
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1301
|
+
payment_data = ApplepayPaymentDataField(api_name='PaymentData', required=True)
|
|
1302
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1303
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1304
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1305
|
+
card_info = CardInfoField(api_name='CardInfo')
|
|
1306
|
+
|
|
1307
|
+
class Meta:
|
|
1308
|
+
verbose_name = 'applepay_payin'
|
|
1309
|
+
verbose_name_plural = 'applepay_payins'
|
|
1310
|
+
url = {
|
|
1311
|
+
InsertQuery.identifier: '/payins/applepay/direct'
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
class GooglepayPayIn(PayIn):
|
|
1316
|
+
tag = CharField(api_name='Tag')
|
|
1317
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1318
|
+
payment_type = GooglepayPaymentDataField(api_name='PaymentData', required=True)
|
|
1319
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1320
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1321
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1322
|
+
|
|
1323
|
+
class Meta:
|
|
1324
|
+
verbose_name = 'googlepay_payin'
|
|
1325
|
+
verbose_name_plural = 'googlepay_payins'
|
|
1326
|
+
url = {
|
|
1327
|
+
InsertQuery.identifier: '/payins/googlepay/direct'
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
class GooglePayDirectPayIn(PayIn):
|
|
1332
|
+
tag = CharField(api_name='Tag')
|
|
1333
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1334
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1335
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1336
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1337
|
+
secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True)
|
|
1338
|
+
secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
|
|
1339
|
+
secure_mode = CharField(api_name='SecureMode',
|
|
1340
|
+
choices=constants.SECURE_MODE_CHOICES,
|
|
1341
|
+
default=constants.SECURE_MODE_CHOICES.default)
|
|
1342
|
+
ip_address = CharField(api_name='IpAddress', required=True)
|
|
1343
|
+
browser_info = BrowserInfoField(api_name='BrowserInfo', required=True)
|
|
1344
|
+
payment_data = CharField(api_name='PaymentData', required=True)
|
|
1345
|
+
shipping = ShippingField(api_name='Shipping')
|
|
1346
|
+
billing = BillingField(api_name='Billing')
|
|
1347
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1348
|
+
card_info = CardInfoField(api_name='CardInfo')
|
|
1349
|
+
|
|
1350
|
+
class Meta:
|
|
1351
|
+
verbose_name = 'googlepay_direct_payin'
|
|
1352
|
+
verbose_name_plural = 'googlepay_direct_payins'
|
|
1353
|
+
url = {
|
|
1354
|
+
InsertQuery.identifier: '/payins/payment-methods/googlepay',
|
|
1355
|
+
SelectQuery.identifier: '/payins'
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
class MbwayPayIn(PayIn):
|
|
1360
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1361
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1362
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1363
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1364
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1365
|
+
phone = CharField(api_name='Phone', required=True)
|
|
1366
|
+
|
|
1367
|
+
class Meta:
|
|
1368
|
+
verbose_name = 'mbway_payin'
|
|
1369
|
+
verbose_name_plural = 'mbway_payins'
|
|
1370
|
+
url = {
|
|
1371
|
+
InsertQuery.identifier: '/payins/payment-methods/mbway',
|
|
1372
|
+
SelectQuery.identifier: '/payins'
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
class MultibancoPayIn(PayIn):
|
|
1377
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1378
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1379
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1380
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1381
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1382
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1383
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1384
|
+
|
|
1385
|
+
class Meta:
|
|
1386
|
+
verbose_name = 'multibanco_payin'
|
|
1387
|
+
verbose_name_plural = 'multibanco_payins'
|
|
1388
|
+
url = {
|
|
1389
|
+
InsertQuery.identifier: '/payins/payment-methods/multibanco',
|
|
1390
|
+
SelectQuery.identifier: '/payins'
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
class SatispayPayIn(PayIn):
|
|
1395
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1396
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1397
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1398
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1399
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1400
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1401
|
+
country = CharField(api_name='Country', required=True)
|
|
1402
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1403
|
+
|
|
1404
|
+
class Meta:
|
|
1405
|
+
verbose_name = 'satispay_payin'
|
|
1406
|
+
verbose_name_plural = 'satispay_payins'
|
|
1407
|
+
url = {
|
|
1408
|
+
InsertQuery.identifier: '/payins/payment-methods/satispay',
|
|
1409
|
+
SelectQuery.identifier: '/payins'
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
class BlikPayIn(PayIn):
|
|
1414
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1415
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1416
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1417
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1418
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1419
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1420
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1421
|
+
code = CharField(api_name='Code')
|
|
1422
|
+
ip_address = CharField(api_name='IpAddress')
|
|
1423
|
+
browser_info = BrowserInfoField(api_name='BrowserInfo')
|
|
1424
|
+
|
|
1425
|
+
class Meta:
|
|
1426
|
+
verbose_name = 'blik_payin'
|
|
1427
|
+
verbose_name_plural = 'blik_payins'
|
|
1428
|
+
url = {
|
|
1429
|
+
InsertQuery.identifier: '/payins/payment-methods/blik',
|
|
1430
|
+
SelectQuery.identifier: '/payins'
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
class KlarnaPayIn(PayIn):
|
|
1435
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1436
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1437
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1438
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1439
|
+
line_items = ListField(api_name='LineItems', required=True)
|
|
1440
|
+
country = CharField(api_name='Country', required=True)
|
|
1441
|
+
phone = CharField(api_name='Phone', required=True)
|
|
1442
|
+
email = EmailField(api_name='Email', required=True)
|
|
1443
|
+
additional_data = CharField(api_name='AdditionalData', required=True)
|
|
1444
|
+
billing = BillingField(api_name='Billing', required=True)
|
|
1445
|
+
reference = CharField(api_name='Reference', required=True)
|
|
1446
|
+
culture = CharField(api_name='Culture', required=True)
|
|
1447
|
+
shipping = ShippingField(api_name='Shipping')
|
|
1448
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1449
|
+
credited_funds = MoneyField(api_name='CreditedFunds')
|
|
1450
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1451
|
+
payment_method = CharField(api_name='PaymentMethod')
|
|
1452
|
+
|
|
1453
|
+
class Meta:
|
|
1454
|
+
verbose_name = 'klarna_payin'
|
|
1455
|
+
verbose_name_plural = 'klarna_payins'
|
|
1456
|
+
url = {
|
|
1457
|
+
InsertQuery.identifier: '/payins/payment-methods/klarna',
|
|
1458
|
+
SelectQuery.identifier: '/payins'
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
class IdealPayIn(PayIn):
|
|
1463
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1464
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1465
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1466
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1467
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1468
|
+
bic = CharField(api_name='Bic', choices=constants.BIC_CHOICES, required=False)
|
|
1469
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1470
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1471
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1472
|
+
bank_name = CharField(api_name='BankName', choices=constants.BANK_NAME_CHOICES)
|
|
1473
|
+
|
|
1474
|
+
class Meta:
|
|
1475
|
+
verbose_name = 'ideal_payin'
|
|
1476
|
+
verbose_name_plural = 'ideal_payins'
|
|
1477
|
+
url = {
|
|
1478
|
+
InsertQuery.identifier: '/payins/payment-methods/ideal',
|
|
1479
|
+
SelectQuery.identifier: '/payins'
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
class GiropayPayIn(PayIn):
|
|
1484
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1485
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1486
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1487
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1488
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1489
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1490
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1491
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1492
|
+
|
|
1493
|
+
class Meta:
|
|
1494
|
+
verbose_name = 'giropay_payin'
|
|
1495
|
+
verbose_name_plural = 'giropay_payins'
|
|
1496
|
+
url = {
|
|
1497
|
+
InsertQuery.identifier: '/payins/payment-methods/giropay',
|
|
1498
|
+
SelectQuery.identifier: '/payins'
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
|
|
1502
|
+
class SwishPayIn(PayIn):
|
|
1503
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1504
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1505
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1506
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1507
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1508
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1509
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1510
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1511
|
+
deep_link_url = CharField(api_name='DeepLinkURL')
|
|
1512
|
+
qr_code_url = CharField(api_name='QRCodeURL')
|
|
1513
|
+
payment_flow = CharField(api_name='PaymentFlow')
|
|
1514
|
+
|
|
1515
|
+
class Meta:
|
|
1516
|
+
verbose_name = 'swish_payin'
|
|
1517
|
+
verbose_name_plural = 'swish_payins'
|
|
1518
|
+
url = {
|
|
1519
|
+
InsertQuery.identifier: '/payins/payment-methods/swish',
|
|
1520
|
+
SelectQuery.identifier: '/payins'
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
|
|
1524
|
+
class TwintPayIn(PayIn):
|
|
1525
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1526
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1527
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1528
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1529
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1530
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1531
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1532
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1533
|
+
|
|
1534
|
+
class Meta:
|
|
1535
|
+
verbose_name = 'twint_payin'
|
|
1536
|
+
verbose_name_plural = 'twint_payins'
|
|
1537
|
+
url = {
|
|
1538
|
+
InsertQuery.identifier: '/payins/payment-methods/twint',
|
|
1539
|
+
SelectQuery.identifier: '/payins'
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
class BancontactPayIn(PayIn):
|
|
1544
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1545
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1546
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1547
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1548
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1549
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1550
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1551
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1552
|
+
recurring = BooleanField(api_name='Recurring')
|
|
1553
|
+
culture = CharField(api_name='Culture')
|
|
1554
|
+
deep_link_url = CharField(api_name='DeepLinkURL')
|
|
1555
|
+
|
|
1556
|
+
class Meta:
|
|
1557
|
+
verbose_name = 'gancontact_payin'
|
|
1558
|
+
verbose_name_plural = 'bancontact_payins'
|
|
1559
|
+
url = {
|
|
1560
|
+
InsertQuery.identifier: '/payins/payment-methods/bancontact',
|
|
1561
|
+
SelectQuery.identifier: '/payins'
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
class BizumPayIn(PayIn):
|
|
1566
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1567
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1568
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1569
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1570
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1571
|
+
return_url = CharField(api_name='ReturnURL')
|
|
1572
|
+
phone = CharField(api_name='Phone')
|
|
1573
|
+
tag = CharField(api_name='Tag')
|
|
1574
|
+
|
|
1575
|
+
class Meta:
|
|
1576
|
+
verbose_name = 'bizum_payin'
|
|
1577
|
+
verbose_name_plural = 'bizum_payins'
|
|
1578
|
+
url = {
|
|
1579
|
+
InsertQuery.identifier: '/payins/payment-methods/bizum',
|
|
1580
|
+
SelectQuery.identifier: '/payins'
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
|
|
1584
|
+
class CardWebPayIn(PayIn):
|
|
1585
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1586
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1587
|
+
return_url = CharField(api_name='ReturnURL')
|
|
1588
|
+
template_url_options = CharField(api_name='TemplateURLOptions')
|
|
1589
|
+
culture = CharField(api_name='Culture')
|
|
1590
|
+
card_type = CharField(api_name='CardType', choices=constants.CARD_TYPE_CHOICES, default=None)
|
|
1591
|
+
secure_mode = CharField(api_name='SecureMode',
|
|
1592
|
+
choices=constants.SECURE_MODE_CHOICES,
|
|
1593
|
+
default=constants.SECURE_MODE_CHOICES.default)
|
|
1594
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1595
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1596
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1597
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1598
|
+
shipping = ShippingField(api_name='Shipping')
|
|
1599
|
+
bic = CharField(api_name='Bic', choices=constants.BIC_CHOICES)
|
|
1600
|
+
bank_name = CharField(api_name='BankName', choices=constants.BANK_NAME_CHOICES)
|
|
1601
|
+
|
|
1602
|
+
class Meta:
|
|
1603
|
+
verbose_name = 'card_payin'
|
|
1604
|
+
verbose_name_plural = 'card_payins'
|
|
1605
|
+
url = {
|
|
1606
|
+
InsertQuery.identifier: '/payins/card/web',
|
|
1607
|
+
SelectQuery.identifier: '/payins'
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
class ExtendedCardWebPayIn(BaseModel):
|
|
1612
|
+
payment_type = CharField(api_name='PaymentType', choices=constants.PAYIN_PAYMENT_TYPE, default=None)
|
|
1613
|
+
execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None)
|
|
1614
|
+
expiration_date = DateTimeField(api_name='ExpirationDate')
|
|
1615
|
+
alias = CharField(api_name='Alias')
|
|
1616
|
+
card_type = CharField(api_name='CardType', choices=constants.CARD_TYPE_CHOICES, default=None)
|
|
1617
|
+
country = CharField(api_name='Country')
|
|
1618
|
+
fingerprint = CharField(api_name='Fingerprint')
|
|
1619
|
+
|
|
1620
|
+
class Meta:
|
|
1621
|
+
verbose_name = 'extended_card_payin'
|
|
1622
|
+
verbose_name_plural = 'extended_card_payins'
|
|
1623
|
+
url = {
|
|
1624
|
+
'GET': '/payins/card/web/%(id)s/extended',
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
@classmethod
|
|
1628
|
+
def get(cls, pay_in_id, *args, **kwargs):
|
|
1629
|
+
select = SelectQuery(ExtendedCardWebPayIn, *args, **kwargs)
|
|
1630
|
+
kwargs['id'] = pay_in_id
|
|
1631
|
+
select.identifier = 'GET'
|
|
1632
|
+
return select.get("", *args, **kwargs)
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
class DirectDebitWebPayIn(PayIn):
|
|
1636
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1637
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1638
|
+
return_url = CharField(api_name='ReturnURL')
|
|
1639
|
+
template_url_options = CharField(api_name='TemplateURLOptions')
|
|
1640
|
+
culture = CharField(api_name='Culture')
|
|
1641
|
+
direct_debit_type = CharField(api_name='DirectDebitType', choices=constants.DIRECT_DEBIT_TYPE_CHOICES, default=None)
|
|
1642
|
+
nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
|
|
1643
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1644
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1645
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1646
|
+
|
|
1647
|
+
class Meta:
|
|
1648
|
+
verbose_name = 'direct_debit_payin'
|
|
1649
|
+
verbose_name_plural = 'direct_debit_payins'
|
|
1650
|
+
url = {
|
|
1651
|
+
InsertQuery.identifier: '/payins/directdebit/web',
|
|
1652
|
+
SelectQuery.identifier: '/payins'
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
|
|
1656
|
+
class DirectDebitDirectPayIn(PayIn):
|
|
1657
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1658
|
+
mandate = ForeignKeyField(Mandate, api_name='MandateId', required=True)
|
|
1659
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1660
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId', required=True, related_name='credited_users')
|
|
1661
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1662
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1663
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1664
|
+
charge_date = CharField(api_name='ChargeDate')
|
|
1665
|
+
culture = CharField(api_name='Culture')
|
|
1666
|
+
|
|
1667
|
+
class Meta:
|
|
1668
|
+
verbose_name = 'direct_debit_direct_payin'
|
|
1669
|
+
verbose_name_plural = 'direct_debit_direct_payins'
|
|
1670
|
+
url = {
|
|
1671
|
+
InsertQuery.identifier: '/payins/directdebit/direct',
|
|
1672
|
+
SelectQuery.identifier: '/payins'
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
class CardPreAuthorizedDepositPayIn(BaseModel):
|
|
1677
|
+
author_id = CharField(api_name='AuthorId')
|
|
1678
|
+
credited_wallet_id = CharField(api_name='CreditedWalletId')
|
|
1679
|
+
deposit_id = CharField(api_name='DepositId')
|
|
1680
|
+
result_code = CharField(api_name='ResultCode')
|
|
1681
|
+
result_message = CharField(api_name='ResultMessage')
|
|
1682
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
1683
|
+
execution_date = DateTimeField(api_name='ExecutionDate')
|
|
1684
|
+
type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
|
|
1685
|
+
nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
|
|
1686
|
+
payment_type = CharField(api_name='PaymentType', choices=constants.PAYIN_PAYMENT_TYPE, default=None)
|
|
1687
|
+
execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None)
|
|
1688
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
1689
|
+
credited_funds = MoneyField(api_name='CreditedFunds')
|
|
1690
|
+
fees = MoneyField(api_name='Fees')
|
|
1691
|
+
card_info = CardInfoField(api_name='CardInfo')
|
|
1692
|
+
|
|
1693
|
+
class Meta:
|
|
1694
|
+
verbose_name = 'card_preauthorized_deposit_payin'
|
|
1695
|
+
verbose_name_plural = 'card_preauthorized_deposit_payins'
|
|
1696
|
+
url = {
|
|
1697
|
+
InsertQuery.identifier: '/payins/deposit-preauthorized/direct/full-capture',
|
|
1698
|
+
SelectQuery.identifier: '/payins',
|
|
1699
|
+
'CREATE_WITHOUT_COMPLEMENT': '/payins/deposit-preauthorized/direct/full-capture',
|
|
1700
|
+
'CREATE_PRIOR_TO_COMPLEMENT': '/payins/deposit-preauthorized/direct/capture-with-complement',
|
|
1701
|
+
'CREATE_COMPLEMENT': '/payins/deposit-preauthorized/direct/complement'
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
def create_without_complement(self, idempotency_key=None, **kwargs):
|
|
1705
|
+
insert = InsertQuery(self, idempotency_key, **kwargs)
|
|
1706
|
+
insert.identifier = 'CREATE_WITHOUT_COMPLEMENT'
|
|
1707
|
+
insert.insert_query = self.get_field_dict()
|
|
1708
|
+
return insert.execute()
|
|
1709
|
+
|
|
1710
|
+
def create_prior_to_complement(self, idempotency_key=None, **kwargs):
|
|
1711
|
+
insert = InsertQuery(self, idempotency_key, **kwargs)
|
|
1712
|
+
insert.identifier = 'CREATE_PRIOR_TO_COMPLEMENT'
|
|
1713
|
+
insert.insert_query = self.get_field_dict()
|
|
1714
|
+
return insert.execute()
|
|
1715
|
+
|
|
1716
|
+
def create_complement(self, idempotency_key=None, **kwargs):
|
|
1717
|
+
insert = InsertQuery(self, idempotency_key, **kwargs)
|
|
1718
|
+
insert.identifier = 'CREATE_COMPLEMENT'
|
|
1719
|
+
insert.insert_query = self.get_field_dict()
|
|
1720
|
+
return insert.execute()
|
|
1721
|
+
|
|
1722
|
+
|
|
1723
|
+
class PaymentMethodMetadata(BaseModel):
|
|
1724
|
+
type = CharField(api_name='Type')
|
|
1725
|
+
bin = CharField(api_name='Bin')
|
|
1726
|
+
token = CharField(api_name='Token')
|
|
1727
|
+
token_format = CharField(api_name='TokenFormat')
|
|
1728
|
+
issuer_country_code = CharField(api_name='IssuerCountryCode')
|
|
1729
|
+
issuing_bank = CharField(api_name='IssuingBank')
|
|
1730
|
+
bin_data = ListField(api_name='BinData')
|
|
1731
|
+
|
|
1732
|
+
class Meta:
|
|
1733
|
+
verbose_name = 'payment_method_metadata'
|
|
1734
|
+
verbose_name_plural = 'payment_method_metadatas'
|
|
1735
|
+
url = {
|
|
1736
|
+
InsertQuery.identifier: '/payment-methods/metadata'
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
|
|
1740
|
+
class PreAuthorization(BaseModel):
|
|
1741
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1742
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1743
|
+
remaining_funds = MoneyField(api_name='RemainingFunds')
|
|
1744
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
1745
|
+
payment_status = CharField(api_name='PaymentStatus', choices=constants.PAYMENT_STATUS_CHOICES, default=None)
|
|
1746
|
+
result_code = CharField(api_name='ResultCode')
|
|
1747
|
+
result_message = CharField(api_name='ResultMessage')
|
|
1748
|
+
execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None)
|
|
1749
|
+
secure_mode = CharField(api_name='SecureMode',
|
|
1750
|
+
choices=constants.SECURE_MODE_CHOICES,
|
|
1751
|
+
default=constants.SECURE_MODE_CHOICES.default,
|
|
1752
|
+
required=True)
|
|
1753
|
+
card = ForeignKeyField(Card, api_name='CardId', required=True)
|
|
1754
|
+
secure_mode_needed = BooleanField(api_name='SecureModeNeeded')
|
|
1755
|
+
secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
|
|
1756
|
+
secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True)
|
|
1757
|
+
expiration_date = DateTimeField(api_name='ExpirationDate')
|
|
1758
|
+
payin = ForeignKeyField(PayIn, api_name='PayInId')
|
|
1759
|
+
billing = BillingField(api_name='Billing')
|
|
1760
|
+
security_info = SecurityInfoField(api_name='SecurityInfo')
|
|
1761
|
+
multi_capture = BooleanField(api_name='MultiCapture')
|
|
1762
|
+
ip_address = CharField(api_name='IpAddress')
|
|
1763
|
+
browser_info = BrowserInfoField(api_name='BrowserInfo')
|
|
1764
|
+
shipping = ShippingField(api_name='Shipping')
|
|
1765
|
+
requested_3ds_version = CharField(api_name='Requested3DSVersion')
|
|
1766
|
+
applied_3ds_version = CharField(api_name='Applied3DSVersion')
|
|
1767
|
+
card_info = CardInfoField(api_name='CardInfo')
|
|
1768
|
+
payment_category = CharField(api_name='PaymentCategory')
|
|
1769
|
+
|
|
1770
|
+
def get_transactions(self, *args, **kwargs):
|
|
1771
|
+
kwargs['id'] = self.id
|
|
1772
|
+
select = SelectQuery(Transaction, *args, **kwargs)
|
|
1773
|
+
select.identifier = 'PRE_AUTHORIZATION_TRANSACTIONS'
|
|
1774
|
+
return select.all(*args, **kwargs)
|
|
1775
|
+
|
|
1776
|
+
class Meta:
|
|
1777
|
+
verbose_name = 'preauthorization'
|
|
1778
|
+
verbose_name_plural = 'preauthorizations'
|
|
1779
|
+
url = {
|
|
1780
|
+
InsertQuery.identifier: '/preauthorizations/card/direct',
|
|
1781
|
+
UpdateQuery.identifier: '/preauthorizations',
|
|
1782
|
+
SelectQuery.identifier: '/preauthorizations',
|
|
1783
|
+
'USER_GET_PREAUTHORIZATIONS': '/users/%(id)s/preauthorizations',
|
|
1784
|
+
'CARD_PRE_AUTHORIZATIONS': '/cards/%(id)s/preauthorizations'
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
class PreAuthorizedPayIn(PayIn):
|
|
1789
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1790
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1791
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1792
|
+
secure_mode_return_url = CharField(api_name='SecureModeReturnURL')
|
|
1793
|
+
preauthorization = ForeignKeyField(PreAuthorization, api_name='PreauthorizationId', required=True)
|
|
1794
|
+
secure_mode = CharField(api_name='SecureMode',
|
|
1795
|
+
choices=constants.SECURE_MODE_CHOICES,
|
|
1796
|
+
default=constants.SECURE_MODE_CHOICES.default)
|
|
1797
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1798
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1799
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1800
|
+
culture = CharField(api_name='Culture')
|
|
1801
|
+
|
|
1802
|
+
class Meta:
|
|
1803
|
+
verbose_name = 'preauthorized_payin'
|
|
1804
|
+
verbose_name_plural = 'preauthorized_payins'
|
|
1805
|
+
url = {
|
|
1806
|
+
InsertQuery.identifier: '/payins/PreAuthorized/direct',
|
|
1807
|
+
SelectQuery.identifier: '/payins'
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
|
|
1811
|
+
class PayByBankPayIn(PayIn):
|
|
1812
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1813
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
|
|
1814
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1815
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1816
|
+
return_url = CharField(api_name='ReturnURL', required=True)
|
|
1817
|
+
redirect_url = CharField(api_name='RedirectURL')
|
|
1818
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
1819
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1820
|
+
country = CharField(api_name='Country', required=True)
|
|
1821
|
+
bic = CharField(api_name='BIC')
|
|
1822
|
+
iban = CharField(api_name='IBAN')
|
|
1823
|
+
payment_flow = CharField(api_name='PaymentFlow')
|
|
1824
|
+
bank_name = CharField(api_name='BankName')
|
|
1825
|
+
culture = CharField(api_name='Culture')
|
|
1826
|
+
scheme = CharField(api_name='Scheme')
|
|
1827
|
+
processing_status = CharField(api_name='ProcessingStatus')
|
|
1828
|
+
|
|
1829
|
+
class Meta:
|
|
1830
|
+
verbose_name = 'pay_by_bank_payin'
|
|
1831
|
+
verbose_name_plural = 'pay_by_bank_payins'
|
|
1832
|
+
url = {
|
|
1833
|
+
InsertQuery.identifier: '/payins/payment-methods/openbanking',
|
|
1834
|
+
SelectQuery.identifier: '/payins'
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
class PayByBankSupportedBank(BaseModel):
|
|
1839
|
+
supported_banks = SupportedBanksField(api_name="SupportedBanks")
|
|
1840
|
+
|
|
1841
|
+
class Meta:
|
|
1842
|
+
verbose_name = 'pay_by_bank_supported_bank'
|
|
1843
|
+
verbose_name_plural = 'pay_by_bank_supported_banks'
|
|
1844
|
+
url = {
|
|
1845
|
+
'GET': '/payment-methods/openbanking/metadata/supported-banks'
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
@classmethod
|
|
1849
|
+
def get(cls, *args, **kwargs):
|
|
1850
|
+
select = SelectQuery(PayByBankSupportedBank, *args, **kwargs)
|
|
1851
|
+
select.identifier = 'GET'
|
|
1852
|
+
return select.get("", with_query_params=True, *args, **kwargs)
|
|
1853
|
+
|
|
1854
|
+
|
|
1855
|
+
@python_2_unicode_compatible
|
|
1856
|
+
class BankAccount(BaseModel):
|
|
1857
|
+
user = ForeignKeyField(User, api_name='UserId', related_name='bankaccounts')
|
|
1858
|
+
owner_name = CharField(api_name='OwnerName', required=True)
|
|
1859
|
+
owner_address = AddressField(api_name='OwnerAddress', required=True)
|
|
1860
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1861
|
+
type = CharField(api_name='Type', choices=constants.BANK_ACCOUNT_TYPE_CHOICES, default=None, required=True)
|
|
1862
|
+
iban = CharField(api_name='IBAN')
|
|
1863
|
+
bic = CharField(api_name='BIC')
|
|
1864
|
+
account_number = CharField(api_name='AccountNumber')
|
|
1865
|
+
sort_code = CharField(api_name='SortCode')
|
|
1866
|
+
aba = CharField(api_name='ABA')
|
|
1867
|
+
deposit_account_type = CharField(api_name='DepositAccountType',
|
|
1868
|
+
choices=constants.DEPOSIT_CHOICES,
|
|
1869
|
+
default=constants.DEPOSIT_CHOICES.checking)
|
|
1870
|
+
bank_name = CharField(api_name='BankName')
|
|
1871
|
+
institution_number = CharField(api_name='InstitutionNumber')
|
|
1872
|
+
branch_code = CharField(api_name='BranchCode')
|
|
1873
|
+
country = CharField(api_name='Country')
|
|
1874
|
+
active = BooleanField(api_name='Active', default=True)
|
|
1875
|
+
|
|
1876
|
+
def get_transactions(self, *args, **kwargs):
|
|
1877
|
+
kwargs['id'] = self.id
|
|
1878
|
+
select = SelectQuery(Transaction, *args, **kwargs)
|
|
1879
|
+
select.identifier = 'BANK_ACCOUNT_GET_TRANSACTIONS'
|
|
1880
|
+
return select.all(*args, **kwargs)
|
|
1881
|
+
|
|
1882
|
+
def create_client_bank_account(self, **kwargs):
|
|
1883
|
+
insert = InsertQuery(self, **kwargs)
|
|
1884
|
+
insert.identifier = 'CLIENT_CREATE_BANK_ACCOUNT'
|
|
1885
|
+
insert.insert_query = self.get_field_dict()
|
|
1886
|
+
return insert.execute()
|
|
1887
|
+
|
|
1888
|
+
class Meta:
|
|
1889
|
+
verbose_name = 'bankaccount'
|
|
1890
|
+
verbose_name_plural = 'bankaccounts'
|
|
1891
|
+
url = {
|
|
1892
|
+
InsertQuery.identifier: '/users/%(user_id)s/bankaccounts/%(type)s',
|
|
1893
|
+
SelectQuery.identifier: '/users/%(user_id)s/bankaccounts',
|
|
1894
|
+
UpdateQuery.identifier: '/users/%(user_id)s/bankaccounts',
|
|
1895
|
+
'CLIENT_CREATE_BANK_ACCOUNT': '/clients/bankaccounts/iban'
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
def __str__(self):
|
|
1899
|
+
return 'Bank account %s of user %s' % (self.type, self.user_id)
|
|
1900
|
+
|
|
1901
|
+
def get_mandates(self, *args, **kwargs):
|
|
1902
|
+
kwargs['user_id'] = self.user_id
|
|
1903
|
+
kwargs['id'] = self.id
|
|
1904
|
+
select = SelectQuery(Mandate, *args, **kwargs)
|
|
1905
|
+
select.identifier = 'MANDATES_FOR_BANKACCOUNT'
|
|
1906
|
+
return select.all(*args, **kwargs)
|
|
1907
|
+
|
|
1908
|
+
def deactivate(self):
|
|
1909
|
+
return BankAccount.update(self.id, active=False, user_id=self.user_id).execute()
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
@python_2_unicode_compatible
|
|
1913
|
+
class BankWirePayOut(BaseModel):
|
|
1914
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1915
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
1916
|
+
credited_funds = MoneyField(api_name='CreditedFunds')
|
|
1917
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1918
|
+
debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId', required=True)
|
|
1919
|
+
bank_account = ForeignKeyField(BankAccount, api_name='BankAccountId', required=True)
|
|
1920
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
1921
|
+
result_code = CharField(api_name='ResultCode')
|
|
1922
|
+
result_message = CharField(api_name='ResultMessage')
|
|
1923
|
+
execution_date = DateTimeField(api_name='ExecutionDate')
|
|
1924
|
+
type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
|
|
1925
|
+
nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
|
|
1926
|
+
payment_type = CharField(api_name='PaymentType', choices=constants.PAYOUT_PAYMENT_TYPE, default=None)
|
|
1927
|
+
execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None)
|
|
1928
|
+
bank_wire_ref = CharField(api_name='BankWireRef')
|
|
1929
|
+
payment_ref = PaymentRefField(api_name='PaymentRef', default=None)
|
|
1930
|
+
payout_mode_requested = CharField(api_name='PayoutModeRequested')
|
|
1931
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId')
|
|
1932
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
1933
|
+
mode_requested = CharField(api_name='ModeRequested')
|
|
1934
|
+
mode_applied = CharField(api_name='ModeApplied')
|
|
1935
|
+
fallback_reason = FallbackReasonField(api_name='FallbackReason')
|
|
1936
|
+
recipient_verification_of_payee = VerificationOfPayeeField(api_name='RecipientVerificationOfPayee')
|
|
1937
|
+
|
|
1938
|
+
def get_refunds(self, *args, **kwargs):
|
|
1939
|
+
kwargs['id'] = self.id
|
|
1940
|
+
select = SelectQuery(Refund, *args, **kwargs)
|
|
1941
|
+
select.identifier = 'PAYOUT_GET_REFUNDS'
|
|
1942
|
+
return select.all(*args, **kwargs)
|
|
1943
|
+
|
|
1944
|
+
def create_client_payout(self, **kwargs):
|
|
1945
|
+
insert = InsertQuery(self, **kwargs)
|
|
1946
|
+
insert.identifier = 'CLIENT_CREATE_PAYOUT'
|
|
1947
|
+
insert.insert_query = self.get_field_dict()
|
|
1948
|
+
return insert.execute()
|
|
1949
|
+
|
|
1950
|
+
@classmethod
|
|
1951
|
+
def get_bankwire(cls, payout_id, **kwargs):
|
|
1952
|
+
kwargs['id'] = payout_id
|
|
1953
|
+
args = '',
|
|
1954
|
+
select = SelectQuery(cls, *args, **kwargs)
|
|
1955
|
+
select.identifier = 'PAYOUT_BANKWIRE_GET'
|
|
1956
|
+
return select.get(*args, **kwargs)
|
|
1957
|
+
|
|
1958
|
+
class Meta:
|
|
1959
|
+
verbose_name = 'payout'
|
|
1960
|
+
verbose_name_plural = 'payouts'
|
|
1961
|
+
url = {
|
|
1962
|
+
InsertQuery.identifier: '/payouts/bankwire',
|
|
1963
|
+
SelectQuery.identifier: '/payouts',
|
|
1964
|
+
'PAYOUT_BANKWIRE_GET': '/payouts/bankwire/%(id)s',
|
|
1965
|
+
'CLIENT_CREATE_PAYOUT': '/clients/payouts'
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
def __str__(self):
|
|
1969
|
+
return 'PayOut request from user %s' % self.author_id
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
@python_2_unicode_compatible
|
|
1973
|
+
class PayOutEligibilityResult(BaseModel):
|
|
1974
|
+
instant_payout = InstantPayoutField(api_name='InstantPayout')
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
@python_2_unicode_compatible
|
|
1978
|
+
class PayOutEligibility(BaseModel):
|
|
1979
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
1980
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
1981
|
+
bank_account = ForeignKeyField(BankAccount, api_name='BankAccountId', required=True)
|
|
1982
|
+
debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId', required=True)
|
|
1983
|
+
fees = MoneyField(api_name='Fees')
|
|
1984
|
+
payout_mode_requested = CharField(api_name='PayoutModeRequested')
|
|
1985
|
+
bank_wire_ref = CharField(api_name='BankWireRef')
|
|
1986
|
+
|
|
1987
|
+
def check_eligibility(self, **kwargs):
|
|
1988
|
+
insert = InsertQuery(self, **kwargs)
|
|
1989
|
+
insert.identifier = 'PAYOUT_CHECK_ELIGIBILITY'
|
|
1990
|
+
insert.insert_query = self.get_field_dict()
|
|
1991
|
+
return insert.execute(model_klass=PayOutEligibilityResult)
|
|
1992
|
+
|
|
1993
|
+
class Meta:
|
|
1994
|
+
verbose_name = 'payout_eligibility'
|
|
1995
|
+
verbose_name_plural = 'payouts_eligibility'
|
|
1996
|
+
url = {
|
|
1997
|
+
'PAYOUT_CHECK_ELIGIBILITY': '/payouts/reachability'
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
|
|
2001
|
+
class Refund(BaseModel):
|
|
2002
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
2003
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId', related_name='credited_users')
|
|
2004
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
2005
|
+
credited_funds = MoneyField(api_name='CreditedFunds')
|
|
2006
|
+
fees = MoneyField(api_name='Fees')
|
|
2007
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
2008
|
+
result_code = CharField(api_name='ResultCode')
|
|
2009
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2010
|
+
execution_date = DateTimeField(api_name='ExecutionDate')
|
|
2011
|
+
type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
|
|
2012
|
+
nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
|
|
2013
|
+
debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId')
|
|
2014
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId')
|
|
2015
|
+
refund_reason = RefundReasonField(api_name='RefundReason')
|
|
2016
|
+
initial_transaction_id = CharField(api_name='InitialTransactionId')
|
|
2017
|
+
initial_transaction_type = CharField(api_name='InitialTransactionType', choices=constants.TRANSACTION_TYPE_CHOICES,
|
|
2018
|
+
default=None)
|
|
2019
|
+
reference = CharField(api_name='Reference')
|
|
2020
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
2021
|
+
|
|
2022
|
+
class Meta:
|
|
2023
|
+
verbose_name = 'refund'
|
|
2024
|
+
verbose_name_plural = 'refunds'
|
|
2025
|
+
url = {
|
|
2026
|
+
SelectQuery.identifier: '/refunds',
|
|
2027
|
+
InsertQuery.identifier: '/refunds',
|
|
2028
|
+
UpdateQuery.identifier: '/refunds',
|
|
2029
|
+
'REPUDIATION_GET_REFUNDS': '/repudiations/%(id)s/refunds',
|
|
2030
|
+
'TRANSFER_GET_REFUNDS': '/transfers/%(id)s/refunds',
|
|
2031
|
+
'PAYOUT_GET_REFUNDS': '/payouts/%(id)s/refunds',
|
|
2032
|
+
'PAYIN_GET_REFUNDS': '/payins/%(id)s/refunds'
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
@python_2_unicode_compatible
|
|
2037
|
+
class TransferRefund(Refund):
|
|
2038
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
2039
|
+
transfer = ForeignKeyField(Transfer)
|
|
2040
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
2041
|
+
fees = MoneyField(api_name='Fees')
|
|
2042
|
+
|
|
2043
|
+
class Meta:
|
|
2044
|
+
verbose_name = 'refund'
|
|
2045
|
+
verbose_name_plural = 'refunds'
|
|
2046
|
+
url = '/transfers/%(transfer_id)s/refunds'
|
|
2047
|
+
|
|
2048
|
+
def __str__(self):
|
|
2049
|
+
return 'TransferRefund request from user %s' % self.author_id
|
|
2050
|
+
|
|
2051
|
+
|
|
2052
|
+
@python_2_unicode_compatible
|
|
2053
|
+
class PayInRefund(Refund):
|
|
2054
|
+
author = ForeignKeyField(User, api_name='AuthorId', required=True)
|
|
2055
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
2056
|
+
fees = MoneyField(api_name='Fees')
|
|
2057
|
+
payin = ForeignKeyField(PayIn)
|
|
2058
|
+
reference = CharField(api_name='Reference')
|
|
2059
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
2060
|
+
|
|
2061
|
+
class Meta:
|
|
2062
|
+
verbose_name = 'refund'
|
|
2063
|
+
verbose_name_plural = 'refunds'
|
|
2064
|
+
url = {
|
|
2065
|
+
InsertQuery.identifier: '/payins/%(payin_id)s/refunds',
|
|
2066
|
+
SelectQuery.identifier: '/refunds'
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
def __str__(self):
|
|
2070
|
+
return 'PayInRefund request from user %s' % self.author_id
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
class KYC(BaseModel):
|
|
2074
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2075
|
+
|
|
2076
|
+
class Meta:
|
|
2077
|
+
verbose_name = 'kyc'
|
|
2078
|
+
verbose_name_plural = 'kycs'
|
|
2079
|
+
url = '/KYC/documents'
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
@python_2_unicode_compatible
|
|
2083
|
+
class Document(KYC):
|
|
2084
|
+
user = ForeignKeyField(User, related_name='documents', api_name='UserId')
|
|
2085
|
+
type = CharField(api_name='Type', choices=constants.DOCUMENTS_TYPE_CHOICES, default=None)
|
|
2086
|
+
status = CharField(api_name='Status', choices=constants.DOCUMENTS_STATUS_CHOICES, default=None)
|
|
2087
|
+
refused_reason_type = CharField(api_name='RefusedReasonType')
|
|
2088
|
+
refused_reason_message = CharField(api_name='RefusedReasonMessage')
|
|
2089
|
+
processed_date = DateTimeField(api_name='ProcessedDate')
|
|
2090
|
+
flags = ListField(api_name='Flags')
|
|
2091
|
+
|
|
2092
|
+
class Meta:
|
|
2093
|
+
verbose_name = 'KYC/document'
|
|
2094
|
+
verbose_name_plural = 'KYC/documents'
|
|
2095
|
+
url = {
|
|
2096
|
+
InsertQuery.identifier: '/users/%(user_id)s/KYC/documents',
|
|
2097
|
+
UpdateQuery.identifier: '/users/%(user_id)s/KYC/documents',
|
|
2098
|
+
SelectQuery.identifier: '/KYC/documents'
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
def __str__(self):
|
|
2102
|
+
return 'Document for user %s' % self.user_id
|
|
2103
|
+
|
|
2104
|
+
|
|
2105
|
+
@python_2_unicode_compatible
|
|
2106
|
+
class Page(KYC):
|
|
2107
|
+
file = CharField(api_name='File', required=True, python_value_callback=lambda value: six.b(value))
|
|
2108
|
+
user = ForeignKeyField(User)
|
|
2109
|
+
document = ForeignKeyField(Document)
|
|
2110
|
+
|
|
2111
|
+
class Meta:
|
|
2112
|
+
verbose_name = 'page'
|
|
2113
|
+
verbose_name_plural = 'pages'
|
|
2114
|
+
url = '/users/%(user_id)s/KYC/documents/%(document_id)s/pages'
|
|
2115
|
+
|
|
2116
|
+
def __str__(self):
|
|
2117
|
+
return 'Page of document %s for user %s' % (self.document_id, self.user_id)
|
|
2118
|
+
|
|
2119
|
+
|
|
2120
|
+
@python_2_unicode_compatible
|
|
2121
|
+
class Transaction(BaseModel):
|
|
2122
|
+
author = ForeignKeyField(User, api_name='AuthorId', related_name='transactions')
|
|
2123
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId')
|
|
2124
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
2125
|
+
credited_funds = MoneyField(api_name='CreditedFunds')
|
|
2126
|
+
fees = MoneyField(api_name='Fees')
|
|
2127
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
2128
|
+
result_code = CharField(api_name='ResultCode')
|
|
2129
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2130
|
+
execution_date = DateTimeField(api_name='ExecutionDate')
|
|
2131
|
+
type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
|
|
2132
|
+
nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
|
|
2133
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId')
|
|
2134
|
+
debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId')
|
|
2135
|
+
wallet = ForeignKeyField(Wallet, related_name='transactions')
|
|
2136
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2137
|
+
|
|
2138
|
+
class Meta:
|
|
2139
|
+
verbose_name = 'transaction'
|
|
2140
|
+
verbose_name_plural = 'transactions'
|
|
2141
|
+
url = {
|
|
2142
|
+
SelectQuery.identifier: '/users/%(user_id)s/transactions',
|
|
2143
|
+
InsertQuery.identifier: '/users/%(user_id)s/transactions',
|
|
2144
|
+
UpdateQuery.identifier: '/users/%(user_id)s/transactions',
|
|
2145
|
+
'MANDATE_GET_TRANSACTIONS': '/mandates/%(id)s/transactions',
|
|
2146
|
+
'CARD_GET_TRANSACTIONS': '/cards/%(id)s/transactions',
|
|
2147
|
+
'BANK_ACCOUNT_GET_TRANSACTIONS': '/bankaccounts/%(id)s/transactions',
|
|
2148
|
+
'PRE_AUTHORIZATION_TRANSACTIONS': '/preauthorizations/%(id)s/transactions',
|
|
2149
|
+
'CLIENT_WALLET_TRANSACTIONS': '/clients/wallets/%(fund_type)s/%(currency)s/transactions',
|
|
2150
|
+
'DEPOSIT_GET_TRANSACTIONS': '/deposit-preauthorizations/%(deposit_id)s/transactions/',
|
|
2151
|
+
'TRANSACTIONS_FOR_FINGERPRINT': '/cards/fingerprints/%(fingerprint)s/transactions',
|
|
2152
|
+
'DISPUTE_GET_TRANSACTIONS': '/disputes/%(dispute_id)s/transactions/'
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
def __str__(self):
|
|
2156
|
+
return 'Transaction n.%s' % self.id
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
class Event(BaseModel):
|
|
2160
|
+
resource_id = CharField(api_name='ResourceId')
|
|
2161
|
+
event_type = CharField(api_name='EventType', choices=constants.EVENT_TYPE_CHOICES, default=None)
|
|
2162
|
+
date = DateTimeField(api_name='Date')
|
|
2163
|
+
|
|
2164
|
+
class Meta:
|
|
2165
|
+
verbose_name = 'event'
|
|
2166
|
+
verbose_name_plural = 'events'
|
|
2167
|
+
url = '/events'
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
class Notification(BaseModel):
|
|
2171
|
+
url = CharField(api_name='Url', required=True)
|
|
2172
|
+
status = CharField(api_name='Status', choices=constants.NOTIFICATION_STATUS_CHOICES, default=None)
|
|
2173
|
+
validity = CharField(api_name='Validity', choices=constants.NOTIFICATION_VALIDITY_CHOICES, default=None)
|
|
2174
|
+
event_type = CharField(api_name='EventType', choices=constants.EVENT_TYPE_CHOICES, default=None, required=True)
|
|
2175
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2176
|
+
|
|
2177
|
+
class Meta:
|
|
2178
|
+
verbose_name = 'notification'
|
|
2179
|
+
verbose_name_plural = 'notifications'
|
|
2180
|
+
url = '/hooks'
|
|
2181
|
+
|
|
2182
|
+
|
|
2183
|
+
@python_2_unicode_compatible
|
|
2184
|
+
class ClientWallet(Wallet):
|
|
2185
|
+
funds_type = CharField(api_name='FundsType')
|
|
2186
|
+
|
|
2187
|
+
class Meta:
|
|
2188
|
+
verbose_name = 'client_wallets'
|
|
2189
|
+
verbose_name_plural = 'client_wallets'
|
|
2190
|
+
fund_type_url = {
|
|
2191
|
+
'CREDIT': 'SELECT_BY_CREDIT',
|
|
2192
|
+
'FEES': 'SELECT_BY_FEES',
|
|
2193
|
+
'DEFAULT': 'SELECT_BY_DEFAULT'
|
|
2194
|
+
}
|
|
2195
|
+
url = {
|
|
2196
|
+
SelectQuery.identifier: '/clients/wallets',
|
|
2197
|
+
'SELECT_CLIENT_WALLET': '/clients/wallets/%(fund_type)s/%(currency)s',
|
|
2198
|
+
'SELECT_BY_CREDIT': '/clients/wallets/CREDIT',
|
|
2199
|
+
'SELECT_BY_FEES': '/clients/wallets/FEES',
|
|
2200
|
+
'SELECT_BY_DEFAULT': '/clients/wallets'
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
def __str__(self):
|
|
2204
|
+
return 'Client wallet n.%s' % self.id
|
|
2205
|
+
|
|
2206
|
+
@classmethod
|
|
2207
|
+
def get(cls, funds_type, currency, **kwargs):
|
|
2208
|
+
kwargs['fund_type'], kwargs['currency'] = funds_type, currency
|
|
2209
|
+
args = '',
|
|
2210
|
+
select = SelectQuery(cls, *args, **kwargs)
|
|
2211
|
+
select.identifier = 'SELECT_CLIENT_WALLET'
|
|
2212
|
+
return select.get(*args, **kwargs)
|
|
2213
|
+
|
|
2214
|
+
@classmethod
|
|
2215
|
+
def all_by_funds_type(cls, fund_type, *args, **kwargs):
|
|
2216
|
+
select = SelectQuery(cls, *args, **kwargs)
|
|
2217
|
+
select.identifier = cls._meta.fund_type_url[fund_type]
|
|
2218
|
+
return select.all(*args, **kwargs)
|
|
2219
|
+
|
|
2220
|
+
def get_transactions(cls, fund_type, currency, **kwargs):
|
|
2221
|
+
kwargs['fund_type'], kwargs['currency'] = fund_type, currency
|
|
2222
|
+
args = '',
|
|
2223
|
+
select = SelectQuery(Transaction, *args, **kwargs)
|
|
2224
|
+
select.identifier = 'CLIENT_WALLET_TRANSACTIONS'
|
|
2225
|
+
return select.all(*args, **kwargs)
|
|
2226
|
+
|
|
2227
|
+
def get_pk(self):
|
|
2228
|
+
return getattr(self, 'id', None)
|
|
2229
|
+
|
|
2230
|
+
|
|
2231
|
+
class Dispute(BaseModel):
|
|
2232
|
+
initial_transaction_id = CharField(api_name='InitialTransactionId')
|
|
2233
|
+
initial_transaction_type = CharField(api_name='InitialTransactionType', choices=constants.TRANSACTION_TYPE_CHOICES,
|
|
2234
|
+
default=None)
|
|
2235
|
+
result_code = CharField(api_name='ResultCode')
|
|
2236
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2237
|
+
dispute_reason = DisputeReasonField(api_name='DisputeReason')
|
|
2238
|
+
status = CharField(api_name='Status', choices=constants.DISPUTES_STATUS_CHOICES, default=None)
|
|
2239
|
+
status_message = CharField(api_name='StatusMessage')
|
|
2240
|
+
disputed_funds = MoneyField(api_name='DisputedFunds')
|
|
2241
|
+
contested_funds = MoneyField(api_name='ContestedFunds')
|
|
2242
|
+
repudiation_id = CharField(api_name='RepudiationId')
|
|
2243
|
+
|
|
2244
|
+
dispute_type = CharField(api_name='DisputeType', choices=constants.DISPUTE_TYPE_CHOICE, default=None)
|
|
2245
|
+
contest_deadline_date = DateTimeField(api_name='ContestDeadlineDate')
|
|
2246
|
+
|
|
2247
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2248
|
+
closed_date = DateTimeField(api_name='ClosedDate', required=False)
|
|
2249
|
+
|
|
2250
|
+
class Meta:
|
|
2251
|
+
verbose_name = 'dispute'
|
|
2252
|
+
verbose_name_plural = 'disputes'
|
|
2253
|
+
url = {
|
|
2254
|
+
SelectQuery.identifier: '/disputes',
|
|
2255
|
+
UpdateQuery.identifier: '/disputes',
|
|
2256
|
+
'CLOSE_DISPUTE': '/disputes/%(id)s/close/',
|
|
2257
|
+
'SUBMIT_DISPUTE': '/disputes/%(id)s/submit/',
|
|
2258
|
+
'RE_SUBMIT_DISPUTE': '/disputes/%(id)s/submit/',
|
|
2259
|
+
'PENDING_SETTLEMENT': '/disputes/pendingsettlement'
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
def __init__(self, *args, **kwargs):
|
|
2263
|
+
super(Dispute, self).__init__(*args, **kwargs)
|
|
2264
|
+
self.transactions = RelatedManager(self, Transaction)
|
|
2265
|
+
|
|
2266
|
+
def __str__(self):
|
|
2267
|
+
return 'Dispute n.%s tag:%s' % (self.id, self.tag)
|
|
2268
|
+
|
|
2269
|
+
def save(self, handler=None, cls=None):
|
|
2270
|
+
self._handler = handler or self.handler
|
|
2271
|
+
|
|
2272
|
+
if cls is None:
|
|
2273
|
+
cls = self.__class__
|
|
2274
|
+
|
|
2275
|
+
created = False
|
|
2276
|
+
|
|
2277
|
+
pre_save.send(cls, instance=self)
|
|
2278
|
+
|
|
2279
|
+
update = self.update(
|
|
2280
|
+
self.get_pk(),
|
|
2281
|
+
**{'tag': self.tag}
|
|
2282
|
+
)
|
|
2283
|
+
result = update.execute(handler)
|
|
2284
|
+
|
|
2285
|
+
post_save.send(cls, instance=self, created=created)
|
|
2286
|
+
|
|
2287
|
+
for key, value in result.items():
|
|
2288
|
+
setattr(self, key, value)
|
|
2289
|
+
|
|
2290
|
+
return result
|
|
2291
|
+
|
|
2292
|
+
def close(self, handler=None):
|
|
2293
|
+
self._handler = handler or self.handler
|
|
2294
|
+
action = ActionQuery(
|
|
2295
|
+
Dispute,
|
|
2296
|
+
self.get_pk(),
|
|
2297
|
+
'CLOSE_DISPUTE'
|
|
2298
|
+
)
|
|
2299
|
+
action.execute(handler)
|
|
2300
|
+
|
|
2301
|
+
def contest(self, money, handler=None):
|
|
2302
|
+
self._handler = handler or self.handler
|
|
2303
|
+
if isinstance(money, Money):
|
|
2304
|
+
action = ActionQuery(
|
|
2305
|
+
Dispute,
|
|
2306
|
+
self.get_pk(),
|
|
2307
|
+
'SUBMIT_DISPUTE',
|
|
2308
|
+
**{'ContestedFunds': MoneyField().api_value(money)}
|
|
2309
|
+
)
|
|
2310
|
+
return action.execute(handler)
|
|
2311
|
+
|
|
2312
|
+
def resubmit(self, handler=None):
|
|
2313
|
+
self._handler = handler or self.handler
|
|
2314
|
+
action = ActionQuery(
|
|
2315
|
+
Dispute,
|
|
2316
|
+
self.get_pk(),
|
|
2317
|
+
'RE_SUBMIT_DISPUTE'
|
|
2318
|
+
)
|
|
2319
|
+
return action.execute(handler)
|
|
2320
|
+
|
|
2321
|
+
@classmethod
|
|
2322
|
+
def get_pending_settlement(cls, *args, **kwargs):
|
|
2323
|
+
select = SelectQuery(cls, *args, **kwargs)
|
|
2324
|
+
select.identifier = 'PENDING_SETTLEMENT'
|
|
2325
|
+
return select.all(*args, **kwargs)
|
|
2326
|
+
|
|
2327
|
+
@classmethod
|
|
2328
|
+
def get_transactions(cls, dispute_id, *args, **kwargs):
|
|
2329
|
+
kwargs['dispute_id'] = dispute_id
|
|
2330
|
+
select = SelectQuery(Transaction, *args, **kwargs)
|
|
2331
|
+
select.identifier = 'DISPUTE_GET_TRANSACTIONS'
|
|
2332
|
+
return select.all(*args, **kwargs)
|
|
2333
|
+
|
|
2334
|
+
|
|
2335
|
+
class DisputeDocument(BaseModel):
|
|
2336
|
+
dispute = ForeignKeyField(Dispute, api_name='DisputeId', related_name='documents', required=True)
|
|
2337
|
+
status = CharField(api_name='Status', choices=constants.DOCUMENTS_STATUS_CHOICES, default=None)
|
|
2338
|
+
type = CharField(api_name='Type', choices=constants.DISPUTE_DOCUMENT_TYPE_CHOICES, defalut=None)
|
|
2339
|
+
refused_reason_message = CharField(api_name='RefusedReasonMessage')
|
|
2340
|
+
refused_reason_type = CharField(api_name='RefusedReasonType', choices=constants.REFUSED_REASON_TYPE_CHOICES,
|
|
2341
|
+
default=None)
|
|
2342
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2343
|
+
processed_date = DateTimeField(api_name='ProcessedDate')
|
|
2344
|
+
|
|
2345
|
+
class Meta:
|
|
2346
|
+
verbose_name = 'document'
|
|
2347
|
+
verbose_name_plural = 'documents'
|
|
2348
|
+
url = {
|
|
2349
|
+
SelectQuery.identifier: '/dispute-documents',
|
|
2350
|
+
InsertQuery.identifier: 'disputes/%(dispute_id)s/documents/',
|
|
2351
|
+
'SUBMIT_DOCUMENT': '/disputes/%(dispute_id)s/documents/%(id)s'
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
def __str__(self):
|
|
2355
|
+
return 'Dispute document id:%s status:%s type:%s' % (self.id, self.status, self.type)
|
|
2356
|
+
|
|
2357
|
+
def submit(self, status=None, handler=None):
|
|
2358
|
+
self._handler = handler or self.handler
|
|
2359
|
+
submit_status = status or self.status
|
|
2360
|
+
if submit_status is None or submit_status not in constants.DOCUMENTS_STATUS_CHOICES:
|
|
2361
|
+
raise TypeError('Invalid status')
|
|
2362
|
+
|
|
2363
|
+
action = ActionQuery(
|
|
2364
|
+
DisputeDocument,
|
|
2365
|
+
self.get_pk(),
|
|
2366
|
+
'SUBMIT_DOCUMENT',
|
|
2367
|
+
params={'dispute_id': self.dispute_id},
|
|
2368
|
+
**{'Status': submit_status}
|
|
2369
|
+
)
|
|
2370
|
+
return action.execute(handler)
|
|
2371
|
+
|
|
2372
|
+
|
|
2373
|
+
@python_2_unicode_compatible
|
|
2374
|
+
class DisputeDocumentPage(BaseModel):
|
|
2375
|
+
file = CharField(api_name='File', required=True, python_value_callback=lambda value: six.b(value))
|
|
2376
|
+
document = ForeignKeyField(DisputeDocument)
|
|
2377
|
+
dispute = ForeignKeyField(Dispute)
|
|
2378
|
+
|
|
2379
|
+
class Meta:
|
|
2380
|
+
verbose_name = 'page'
|
|
2381
|
+
verbose_name_plural = 'pages'
|
|
2382
|
+
url = '/disputes/%(dispute_id)s/documents/%(document_id)s/pages/'
|
|
2383
|
+
|
|
2384
|
+
def __str__(self):
|
|
2385
|
+
return 'Page of dispute document %s for dispute %s' % (self.document_id, self.dispute_id)
|
|
2386
|
+
|
|
2387
|
+
|
|
2388
|
+
class DocumentConsult(BaseModel):
|
|
2389
|
+
url = CharField(api_name='Url')
|
|
2390
|
+
expiration_date = DateField(api_name='ExpirationDate')
|
|
2391
|
+
|
|
2392
|
+
class Meta:
|
|
2393
|
+
verbose_name = 'consult_page'
|
|
2394
|
+
verbose_name_plural = 'consult_pages'
|
|
2395
|
+
url = {
|
|
2396
|
+
'DISPUTE_CONSULT': '/dispute-documents/%(id)s/consult',
|
|
2397
|
+
'KYC_CONSULT': '/KYC/documents/%(id)s/consult'
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
@classmethod
|
|
2401
|
+
def _get_document_consult(cls, id, identifier, handler=None):
|
|
2402
|
+
query = ActionQuery(cls, id, identifier, 'POST')
|
|
2403
|
+
return query.execute(handler)
|
|
2404
|
+
|
|
2405
|
+
@classmethod
|
|
2406
|
+
def get_kyc_document_consult(cls, KYCDocId, handler=None):
|
|
2407
|
+
return DocumentConsult._get_document_consult(KYCDocId, 'KYC_CONSULT', handler)
|
|
2408
|
+
|
|
2409
|
+
@classmethod
|
|
2410
|
+
def get_dispute_document_consult(cls, disputeDocId, handler=None):
|
|
2411
|
+
return DocumentConsult._get_document_consult(disputeDocId, 'DISPUTE_CONSULT', handler)
|
|
2412
|
+
|
|
2413
|
+
|
|
2414
|
+
class Repudiation(BaseModel):
|
|
2415
|
+
author = ForeignKeyField(User, api_name='AuthorId')
|
|
2416
|
+
disputed_funds = MoneyField(api_name='DisputedFunds')
|
|
2417
|
+
credited_funds = MoneyField(api_name='CreditedFunds')
|
|
2418
|
+
fees = MoneyField(api_name='Fees')
|
|
2419
|
+
credited_wallet = CharField(Wallet, api_name='CreditedWalletId')
|
|
2420
|
+
debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId')
|
|
2421
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId')
|
|
2422
|
+
nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
|
|
2423
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
2424
|
+
execution_date = DateTimeField(api_name='ExecutionDate')
|
|
2425
|
+
result_code = CharField(api_name='ResultCode')
|
|
2426
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2427
|
+
|
|
2428
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2429
|
+
|
|
2430
|
+
def get_refunds(self, *args, **kwargs):
|
|
2431
|
+
kwargs['id'] = self.id
|
|
2432
|
+
select = SelectQuery(Refund, *args, **kwargs)
|
|
2433
|
+
select.identifier = 'REPUDIATION_GET_REFUNDS'
|
|
2434
|
+
return select.all(*args, **kwargs)
|
|
2435
|
+
|
|
2436
|
+
class Meta:
|
|
2437
|
+
verbose_name = 'repudiation'
|
|
2438
|
+
verbose_name_plural = 'repudiations'
|
|
2439
|
+
url = {
|
|
2440
|
+
SelectQuery.identifier: '/repudiations',
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
def __str__(self):
|
|
2444
|
+
return 'Repudiation n.%s' % self.id
|
|
2445
|
+
|
|
2446
|
+
|
|
2447
|
+
class SettlementTransfer(BaseModel):
|
|
2448
|
+
author = ForeignKeyField(User, api_name='AuthorId')
|
|
2449
|
+
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
|
|
2450
|
+
credited_funds = MoneyField(api_name='CreditedFunds')
|
|
2451
|
+
fees = MoneyField(api_name='Fees', required=True)
|
|
2452
|
+
debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId')
|
|
2453
|
+
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId')
|
|
2454
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId', required=True)
|
|
2455
|
+
nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
|
|
2456
|
+
status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
|
|
2457
|
+
execution_date = DateTimeField(api_name='ExecutionDate')
|
|
2458
|
+
result_code = CharField(api_name='ResultCode')
|
|
2459
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2460
|
+
type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
|
|
2461
|
+
repudiation = ForeignKeyField(Repudiation, api_name='RepudiationId')
|
|
2462
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2463
|
+
|
|
2464
|
+
class Meta:
|
|
2465
|
+
verbose_name = 'settlement_transfer'
|
|
2466
|
+
verbose_name_plural = 'settlement_transfers'
|
|
2467
|
+
url = {
|
|
2468
|
+
SelectQuery.identifier: '/settlements',
|
|
2469
|
+
InsertQuery.identifier: '/repudiations/%(repudiation_id)s/settlementtransfer/'
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
def __str__(self):
|
|
2473
|
+
return 'SettlementTransfer n.%s' % self.id
|
|
2474
|
+
|
|
2475
|
+
|
|
2476
|
+
class IdempotencyResponse(BaseApiModelMethods):
|
|
2477
|
+
status = CharField(api_name='StatusCode')
|
|
2478
|
+
content_length = CharField(api_name='ContentLength')
|
|
2479
|
+
content_type = CharField(api_name='ContentType')
|
|
2480
|
+
date = CharField(api_name='Date')
|
|
2481
|
+
resource = DictField(api_name='Resource')
|
|
2482
|
+
|
|
2483
|
+
class Meta:
|
|
2484
|
+
verbose_name = 'idempotency'
|
|
2485
|
+
verbose_name_plural = 'idempotency'
|
|
2486
|
+
url = {
|
|
2487
|
+
SelectQuery.identifier: '/responses/',
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
@classmethod
|
|
2491
|
+
def get(cls, idempotency_key):
|
|
2492
|
+
return SelectQuery(cls).get(idempotency_key)
|
|
2493
|
+
|
|
2494
|
+
def get_resource(self, model=BaseModel):
|
|
2495
|
+
query = SelectQuery(model)
|
|
2496
|
+
data = query.parse_result(self.resource)
|
|
2497
|
+
return model(**data)
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
class Report(BaseModel):
|
|
2501
|
+
creation_date = CharField(api_name='CreationDate')
|
|
2502
|
+
report_date = CharField(api_name='ReportDate')
|
|
2503
|
+
download_url = CharField(api_name='DownloadURL')
|
|
2504
|
+
callback_url = CharField(api_name='CallbackURL')
|
|
2505
|
+
download_format = CharField(api_name='DownloadFormat', choices=constants.DOWNLOAD_FORMAT, default='CSV')
|
|
2506
|
+
report_type = CharField(api_name='ReportType', choices=constants.REPORT_TYPE, default='transactions',
|
|
2507
|
+
related_name='report_type')
|
|
2508
|
+
sort = CharField(api_name='Sort')
|
|
2509
|
+
preview = BooleanField(api_name='Preview')
|
|
2510
|
+
columns = ListField(api_name='Columns')
|
|
2511
|
+
result_code = CharField(api_name='ResultCode')
|
|
2512
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2513
|
+
|
|
2514
|
+
class Meta:
|
|
2515
|
+
verbose_name = 'report'
|
|
2516
|
+
verbose_name_plural = 'reports'
|
|
2517
|
+
url = {
|
|
2518
|
+
SelectQuery.identifier: '/reports/',
|
|
2519
|
+
InsertQuery.identifier: '/reports/%(report_type)s/'
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
|
|
2523
|
+
class ReportTransactions(BaseModel):
|
|
2524
|
+
creation_date = CharField(api_name='CreationDate')
|
|
2525
|
+
report_date = CharField(api_name='ReportDate')
|
|
2526
|
+
download_url = CharField(api_name='DownloadURL')
|
|
2527
|
+
callback_url = CharField(api_name='CallbackURL')
|
|
2528
|
+
download_format = CharField(api_name='DownloadFormat', choices=constants.DOWNLOAD_FORMAT, default='CSV')
|
|
2529
|
+
report_type = CharField(api_name='ReportType', choices=constants.REPORT_TYPE, default='transactions',
|
|
2530
|
+
related_name='report_type')
|
|
2531
|
+
sort = CharField(api_name='Sort')
|
|
2532
|
+
preview = BooleanField(api_name='Preview')
|
|
2533
|
+
columns = ListField(api_name='Columns')
|
|
2534
|
+
result_code = CharField(api_name='ResultCode')
|
|
2535
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2536
|
+
filters = ReportTransactionsFiltersField(api_name='Filters')
|
|
2537
|
+
|
|
2538
|
+
class Meta:
|
|
2539
|
+
verbose_name = 'report'
|
|
2540
|
+
verbose_name_plural = 'reports'
|
|
2541
|
+
url = {
|
|
2542
|
+
SelectQuery.identifier: '/reports/',
|
|
2543
|
+
InsertQuery.identifier: '/reports/transactions/'
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
|
|
2547
|
+
class ReportWallets(BaseModel):
|
|
2548
|
+
creation_date = CharField(api_name='CreationDate')
|
|
2549
|
+
report_date = CharField(api_name='ReportDate')
|
|
2550
|
+
download_url = CharField(api_name='DownloadURL')
|
|
2551
|
+
callback_url = CharField(api_name='CallbackURL')
|
|
2552
|
+
download_format = CharField(api_name='DownloadFormat', choices=constants.DOWNLOAD_FORMAT, default='CSV')
|
|
2553
|
+
report_type = CharField(api_name='ReportType', choices=constants.REPORT_TYPE, default='transactions',
|
|
2554
|
+
related_name='report_type')
|
|
2555
|
+
sort = CharField(api_name='Sort')
|
|
2556
|
+
preview = BooleanField(api_name='Preview')
|
|
2557
|
+
columns = ListField(api_name='Columns')
|
|
2558
|
+
result_code = CharField(api_name='ResultCode')
|
|
2559
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2560
|
+
filters = ReportWalletsFiltersField(api_name='Filters')
|
|
2561
|
+
|
|
2562
|
+
class Meta:
|
|
2563
|
+
verbose_name = 'report'
|
|
2564
|
+
verbose_name_plural = 'reports'
|
|
2565
|
+
url = {
|
|
2566
|
+
SelectQuery.identifier: '/reports/',
|
|
2567
|
+
InsertQuery.identifier: '/reports/wallets/'
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
|
|
2571
|
+
class ReportV2(BaseModel):
|
|
2572
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2573
|
+
report_date = DateTimeField(api_name='ReportDate')
|
|
2574
|
+
status = CharField(api_name='Status')
|
|
2575
|
+
result_code = CharField(api_name='ResultCode')
|
|
2576
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2577
|
+
download_format = CharField(api_name='DownloadFormat', required=True)
|
|
2578
|
+
download_url = CharField(api_name='DownloadURL')
|
|
2579
|
+
report_type = CharField(api_name='ReportType', required=True)
|
|
2580
|
+
sort = CharField(api_name='Sort')
|
|
2581
|
+
after_date = DateTimeField(api_name='AfterDate', required=True)
|
|
2582
|
+
before_date = DateTimeField(api_name='BeforeDate', required=True)
|
|
2583
|
+
filters = ReportFilterField(api_name='Filters')
|
|
2584
|
+
columns = ListField(api_name='Columns')
|
|
2585
|
+
|
|
2586
|
+
class Meta:
|
|
2587
|
+
verbose_name = 'reportv2'
|
|
2588
|
+
verbose_name_plural = 'reportsv2'
|
|
2589
|
+
url = {
|
|
2590
|
+
InsertQuery.identifier: '/reporting/reports',
|
|
2591
|
+
SelectQuery.identifier: '/reporting/reports'
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
|
|
2595
|
+
class BankingAlias(BaseModel):
|
|
2596
|
+
tag = CharField(api_name='Tag')
|
|
2597
|
+
credited_user = ForeignKeyField(User, api_name='CreditedUserId')
|
|
2598
|
+
wallet = ForeignKeyField(Wallet, api_name='WalletId', related_name='wallet_id')
|
|
2599
|
+
type = CharField(api_name='Type')
|
|
2600
|
+
owner_name = CharField(api_name='OwnerName')
|
|
2601
|
+
active = BooleanField(api_name='Active')
|
|
2602
|
+
virtual_account_purpose = CharField(api_name='VirtualAccountPurpose')
|
|
2603
|
+
|
|
2604
|
+
class Meta:
|
|
2605
|
+
verbose_name = 'bankingalias'
|
|
2606
|
+
verbose_name_plural = 'bankingaliases'
|
|
2607
|
+
url = '/bankingaliases'
|
|
2608
|
+
url = {
|
|
2609
|
+
InsertQuery.identifier: '/bankingaliases/',
|
|
2610
|
+
SelectQuery.identifier: '/bankingaliases/%(id)s',
|
|
2611
|
+
UpdateQuery.identifier: '/bankingaliases/%(id)s',
|
|
2612
|
+
'SELECT_ALL_BANKING_ALIASES': '/wallets/%(wallet_id)s/bankingaliases'
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
@classmethod
|
|
2616
|
+
def cast(cls, result):
|
|
2617
|
+
if 'Type' in result:
|
|
2618
|
+
if result['Type'] == 'IBAN':
|
|
2619
|
+
return BankingAliasIBAN
|
|
2620
|
+
elif result['Type'] == 'OTHER':
|
|
2621
|
+
return BankingAliasOther
|
|
2622
|
+
else:
|
|
2623
|
+
return BankingAlias
|
|
2624
|
+
|
|
2625
|
+
def __str__(self):
|
|
2626
|
+
return '%s banking alias account of user %s' % (self.type, self.credited_user)
|
|
2627
|
+
|
|
2628
|
+
def all(self, *args, **kwargs):
|
|
2629
|
+
kwargs['wallet_id'] = self.wallet_id
|
|
2630
|
+
select = SelectQuery(self.__class__, *args, **kwargs)
|
|
2631
|
+
select.identifier = 'SELECT_ALL_BANKING_ALIASES'
|
|
2632
|
+
return select.all(*args, **kwargs)
|
|
2633
|
+
|
|
2634
|
+
|
|
2635
|
+
class BankingAliasIBAN(BankingAlias):
|
|
2636
|
+
type = CharField(api_name='Type', default='IBAN', required=True)
|
|
2637
|
+
iban = CharField(api_name='IBAN')
|
|
2638
|
+
bic = CharField(api_name='BIC')
|
|
2639
|
+
country = CharField(api_name='Country', required=True)
|
|
2640
|
+
|
|
2641
|
+
class Meta:
|
|
2642
|
+
verbose_name = 'bankingalias'
|
|
2643
|
+
verbose_name_plural = 'bankingaliases'
|
|
2644
|
+
url = {
|
|
2645
|
+
InsertQuery.identifier: '/wallets/%(wallet_id)s/bankingaliases/iban',
|
|
2646
|
+
SelectQuery.identifier: '/bankingaliases/%(id)s',
|
|
2647
|
+
UpdateQuery.identifier: '/bankingaliases/%(id)s'
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
|
|
2651
|
+
class BankingAliasOther(BankingAlias):
|
|
2652
|
+
type = CharField(api_name='Type', default='OTHER', required='True')
|
|
2653
|
+
account_number = CharField(api_name='AccountNumber')
|
|
2654
|
+
bic = CharField(api_name='BIC')
|
|
2655
|
+
country = CharField(api_name='Country', required=True)
|
|
2656
|
+
|
|
2657
|
+
class Meta:
|
|
2658
|
+
verbose_name = 'bankingalias'
|
|
2659
|
+
verbose_name_plural = 'bankingaliases'
|
|
2660
|
+
url = {
|
|
2661
|
+
InsertQuery.identifier: '/wallets/%(wallet_id)s/bankingaliases/accountNumber',
|
|
2662
|
+
SelectQuery.identifier: '/bankingaliases/%(id)s',
|
|
2663
|
+
UpdateQuery.identifier: '/bankingaliases/%(id)s'
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
|
|
2667
|
+
class UboDeclaration(BaseModel):
|
|
2668
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2669
|
+
processed_date = DateTimeField(api_name='ProcessedDate')
|
|
2670
|
+
reason = CharField(api_name='Reason')
|
|
2671
|
+
message = CharField(api_name='Message')
|
|
2672
|
+
status = CharField(api_name='Status', choices=constants.UBO_DECLARATION_STATUS_CHOICES, default=None)
|
|
2673
|
+
ubos = ListField(api_name='Ubos')
|
|
2674
|
+
user = ForeignKeyField(User)
|
|
2675
|
+
|
|
2676
|
+
class Meta:
|
|
2677
|
+
verbose_name = 'ubodeclaration'
|
|
2678
|
+
verbose_name_plural = 'ubodeclarations'
|
|
2679
|
+
|
|
2680
|
+
# For Update as well as Select, 'ubo_declaration_id' is provided by the 'reference' param of the update method
|
|
2681
|
+
url = {
|
|
2682
|
+
InsertQuery.identifier: '/users/%(user_id)s/kyc/ubodeclarations',
|
|
2683
|
+
UpdateQuery.identifier: '/users/%(user_id)s/kyc/ubodeclarations',
|
|
2684
|
+
SelectQuery.identifier: '/users/%(user_id)s/kyc/ubodeclarations'
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
def create(self, **kwargs):
|
|
2688
|
+
insert = InsertQuery(self, **kwargs)
|
|
2689
|
+
return insert.execute()
|
|
2690
|
+
|
|
2691
|
+
def get_read_only_properties(self):
|
|
2692
|
+
read_only = ["ProcessedDate", "Reason", "Message"]
|
|
2693
|
+
return read_only
|
|
2694
|
+
|
|
2695
|
+
def get_sub_objects(self, sub_objects=None):
|
|
2696
|
+
sub_objects['Ubos'] = Ubo
|
|
2697
|
+
return sub_objects
|
|
2698
|
+
|
|
2699
|
+
|
|
2700
|
+
class Ubo(BaseModel):
|
|
2701
|
+
first_name = CharField(api_name='FirstName', required=True)
|
|
2702
|
+
last_name = CharField(api_name='LastName', required=True)
|
|
2703
|
+
address = AddressField(api_name='Address', required=True)
|
|
2704
|
+
nationality = CharField(api_name='Nationality', required=True)
|
|
2705
|
+
birthday = DateField(api_name='Birthday', required=True)
|
|
2706
|
+
birthplace = BirthplaceField(api_name='Birthplace', required=True)
|
|
2707
|
+
user = ForeignKeyField(User)
|
|
2708
|
+
ubo_declaration = ForeignKeyField(UboDeclaration)
|
|
2709
|
+
is_active = BooleanField(api_name='IsActive')
|
|
2710
|
+
|
|
2711
|
+
class Meta:
|
|
2712
|
+
verbose_name = 'ubo'
|
|
2713
|
+
verbose_name_plural = 'ubos'
|
|
2714
|
+
|
|
2715
|
+
# For Update, 'ubo_id' is provided by the 'reference' param of the update method
|
|
2716
|
+
url = {
|
|
2717
|
+
InsertQuery.identifier: '/users/%(user_id)s/kyc/ubodeclarations/%(ubo_declaration_id)s/ubos',
|
|
2718
|
+
UpdateQuery.identifier: '/users/%(user_id)s/kyc/ubodeclarations/%(ubo_declaration_id)s/ubos',
|
|
2719
|
+
SelectQuery.identifier: '/users/%(user_id)s/kyc/ubodeclarations/%(ubo_declaration_id)s/ubos/'
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
def get_sub_objects(self, sub_objects=None):
|
|
2723
|
+
sub_objects['Address'] = Address
|
|
2724
|
+
sub_objects['Birthplace'] = Birthplace
|
|
2725
|
+
return sub_objects
|
|
2726
|
+
|
|
2727
|
+
|
|
2728
|
+
class UserBlockStatus(BaseModel):
|
|
2729
|
+
scope_blocked = ScopeBlockedField(api_name='ScopeBlocked', required=True)
|
|
2730
|
+
action_code = CharField(api_name='ActionCode', required=True)
|
|
2731
|
+
|
|
2732
|
+
class Meta:
|
|
2733
|
+
verbose_name = 'userblockstatus'
|
|
2734
|
+
verbose_name_plural = 'userblockstatuses'
|
|
2735
|
+
|
|
2736
|
+
url = {
|
|
2737
|
+
'USERS_BLOCK_STATUS': '/users/%(user_id)s/blockStatus',
|
|
2738
|
+
'USERS_REGULATORY': '/users/%(user_id)s/Regulatory'
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
|
|
2742
|
+
class CountryAuthorization(BaseModel):
|
|
2743
|
+
country_code = CharField(api_name='CountryCode')
|
|
2744
|
+
country_name = CharField(api_name='CountryName')
|
|
2745
|
+
authorization = CountryAuthorizationDataField(api_name='Authorization')
|
|
2746
|
+
last_update = DateTimeField(api_name='LastUpdate')
|
|
2747
|
+
|
|
2748
|
+
class Meta:
|
|
2749
|
+
verbose_name = 'country_authorization'
|
|
2750
|
+
verbose_name_plural = 'country_authorizations'
|
|
2751
|
+
url = {
|
|
2752
|
+
'COUNTRY_AUTHORIZATIONS': 'countries/%(id)s/authorizations',
|
|
2753
|
+
'ALL_COUNTRIES_AUTHORIZATIONS': 'countries/authorizations'
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
@classmethod
|
|
2757
|
+
def get_country_authorizations(cls, country_code, **kwargs):
|
|
2758
|
+
kwargs['id'] = country_code
|
|
2759
|
+
args = '',
|
|
2760
|
+
select = SelectQuery(CountryAuthorization, *args, **kwargs)
|
|
2761
|
+
select.identifier = 'COUNTRY_AUTHORIZATIONS'
|
|
2762
|
+
return select.get(without_client_id=True, *args, **kwargs)
|
|
2763
|
+
|
|
2764
|
+
@classmethod
|
|
2765
|
+
def get_all_countries_authorizations(cls, *args, **kwargs):
|
|
2766
|
+
select = SelectQuery(CountryAuthorization, *args, **kwargs)
|
|
2767
|
+
select.identifier = 'ALL_COUNTRIES_AUTHORIZATIONS'
|
|
2768
|
+
return select.all(without_client_id=True, *args, **kwargs)
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
class Deposit(BaseModel):
|
|
2772
|
+
author_id = CharField(api_name='AuthorId')
|
|
2773
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
2774
|
+
status = CharField(api_name='Status', choices=constants.DEPOSIT_STATUS_CHOICES, default=None)
|
|
2775
|
+
payment_status = CharField(api_name='PaymentStatus', choices=constants.PAYMENT_STATUS_CHOICES, default=None)
|
|
2776
|
+
payins_linked = PayinsLinkedField(api_name="PayinsLinked")
|
|
2777
|
+
result_code = CharField(api_name='ResultCode')
|
|
2778
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2779
|
+
card_id = CharField(api_name='CardId')
|
|
2780
|
+
secure_mode_return_url = CharField(api_name='SecureModeReturnURL')
|
|
2781
|
+
secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
|
|
2782
|
+
secure_mode_needed = BooleanField(api_name='SecureModeNeeded')
|
|
2783
|
+
expiration_date = DateField(api_name='ExpirationDate')
|
|
2784
|
+
payment_type = CharField(api_name='PaymentType', choices=constants.PAYIN_PAYMENT_TYPE, default=None)
|
|
2785
|
+
execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None)
|
|
2786
|
+
statement_descriptor = CharField(api_name='StatementDescriptor')
|
|
2787
|
+
culture = CharField(api_name='Culture')
|
|
2788
|
+
ip_address = CharField(api_name='IpAddress')
|
|
2789
|
+
browser_info = BrowserInfoField(api_name='BrowserInfo')
|
|
2790
|
+
billing = BillingField(api_name='Billing')
|
|
2791
|
+
shipping = ShippingField(api_name='Shipping')
|
|
2792
|
+
requested_3ds_version = CharField(api_name='Requested3DSVersion')
|
|
2793
|
+
applied_3ds_version = CharField(api_name='Applied3DSVersion')
|
|
2794
|
+
|
|
2795
|
+
class Meta:
|
|
2796
|
+
verbose_name = 'deposit'
|
|
2797
|
+
verbose_name_plural = 'deposits'
|
|
2798
|
+
url = {
|
|
2799
|
+
InsertQuery.identifier: '/deposit-preauthorizations/card/direct',
|
|
2800
|
+
SelectQuery.identifier: '/deposit-preauthorizations/',
|
|
2801
|
+
UpdateQuery.identifier: '/deposit-preauthorizations/',
|
|
2802
|
+
'GET_ALL_FOR_USER': '/users/%(user_id)s/deposit-preauthorizations/',
|
|
2803
|
+
'GET_ALL_FOR_CARD': '/cards/%(card_id)s/deposit-preauthorizations/'
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
@classmethod
|
|
2807
|
+
def get_all_for_user(cls, user_id, *args, **kwargs):
|
|
2808
|
+
kwargs['user_id'] = user_id
|
|
2809
|
+
select = SelectQuery(Deposit, *args, **kwargs)
|
|
2810
|
+
select.identifier = 'GET_ALL_FOR_USER'
|
|
2811
|
+
return select.all(*args, **kwargs)
|
|
2812
|
+
|
|
2813
|
+
@classmethod
|
|
2814
|
+
def get_all_for_card(cls, card_id, *args, **kwargs):
|
|
2815
|
+
kwargs['card_id'] = card_id
|
|
2816
|
+
select = SelectQuery(Deposit, *args, **kwargs)
|
|
2817
|
+
select.identifier = 'GET_ALL_FOR_CARD'
|
|
2818
|
+
return select.all(*args, **kwargs)
|
|
2819
|
+
|
|
2820
|
+
@classmethod
|
|
2821
|
+
def get_transactions(cls, deposit_id, *args, **kwargs):
|
|
2822
|
+
kwargs['deposit_id'] = deposit_id
|
|
2823
|
+
select = SelectQuery(Transaction, *args, **kwargs)
|
|
2824
|
+
select.identifier = 'DEPOSIT_GET_TRANSACTIONS'
|
|
2825
|
+
return select.all(*args, **kwargs)
|
|
2826
|
+
|
|
2827
|
+
|
|
2828
|
+
class VirtualAccount(BaseModel):
|
|
2829
|
+
wallet_id = CharField(api_name='WalletId', required=True)
|
|
2830
|
+
credited_user_id = CharField(api_name='CreditedUserId')
|
|
2831
|
+
virtual_account_purpose = CharField(api_name='VirtualAccountPurpose', required=True)
|
|
2832
|
+
country = CharField(api_name='Country', required=True)
|
|
2833
|
+
status = CharField(api_name='Status')
|
|
2834
|
+
active = BooleanField(api_name='Active')
|
|
2835
|
+
account_owner = CharField(api_name='AccountOwner')
|
|
2836
|
+
local_account_details = LocalAccountDetailsField(api_name='LocalAccountDetails')
|
|
2837
|
+
international_account_details = ListField(api_name='InternationalAccountDetails')
|
|
2838
|
+
capabilities = VirtualAccountCapabilitiesField(api_name='Capabilities')
|
|
2839
|
+
result_code = CharField(api_name='ResultCode')
|
|
2840
|
+
result_message = CharField(api_name='ResultMessage')
|
|
2841
|
+
|
|
2842
|
+
class Meta:
|
|
2843
|
+
verbose_name = 'virtual_account'
|
|
2844
|
+
verbose_name_plural = 'virtual_accounts'
|
|
2845
|
+
|
|
2846
|
+
url = '/wallets/%(wallet_id)s/virtual-accounts'
|
|
2847
|
+
|
|
2848
|
+
|
|
2849
|
+
class VirtualAccountAvailability(BaseModel):
|
|
2850
|
+
collection = ListField(api_name='Collection')
|
|
2851
|
+
user_owned = ListField(api_name='UserOwned')
|
|
2852
|
+
|
|
2853
|
+
class Meta:
|
|
2854
|
+
verbose_name = 'virtual_account_availability'
|
|
2855
|
+
verbose_name_plural = 'virtual_account_availabilities'
|
|
2856
|
+
|
|
2857
|
+
url = {
|
|
2858
|
+
SelectQuery.identifier: '/virtual-accounts/availability'
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
|
|
2862
|
+
class IdentityVerification(BaseModel):
|
|
2863
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
2864
|
+
hosted_url = CharField(api_name='HostedUrl')
|
|
2865
|
+
return_url = CharField(api_name='ReturnUrl', required=True)
|
|
2866
|
+
status = CharField(api_name='Status')
|
|
2867
|
+
last_update = DateTimeField(api_name='UpdateDate')
|
|
2868
|
+
user_id = CharField(api_name='UserId')
|
|
2869
|
+
checks = ListField(api_name='Checks')
|
|
2870
|
+
|
|
2871
|
+
class Meta:
|
|
2872
|
+
verbose_name = 'identity_verification'
|
|
2873
|
+
verbose_name_plural = 'identity_verifications'
|
|
2874
|
+
|
|
2875
|
+
url = {
|
|
2876
|
+
InsertQuery.identifier: '/users/%(user_id)s/identity-verifications',
|
|
2877
|
+
SelectQuery.identifier: '/identity-verifications',
|
|
2878
|
+
'GET_ALL': '/users/%(user_id)s/identity-verifications'
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
def create(self, user_id, idempotency_key=None, **kwargs):
|
|
2882
|
+
path_params = {'user_id': user_id}
|
|
2883
|
+
insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
|
|
2884
|
+
insert.insert_query = self.get_field_dict()
|
|
2885
|
+
return insert.execute()
|
|
2886
|
+
|
|
2887
|
+
@classmethod
|
|
2888
|
+
def get_all(cls, user_id, *args, **kwargs):
|
|
2889
|
+
kwargs['user_id'] = user_id
|
|
2890
|
+
select = SelectQuery(IdentityVerification, *args, **kwargs)
|
|
2891
|
+
select.identifier = 'GET_ALL'
|
|
2892
|
+
return select.all(*args, **kwargs)
|
|
2893
|
+
|
|
2894
|
+
|
|
2895
|
+
class Recipient(BaseModel):
|
|
2896
|
+
status = CharField(api_name='Status')
|
|
2897
|
+
display_name = CharField(api_name='DisplayName', required=True)
|
|
2898
|
+
payout_method_type = CharField(api_name='PayoutMethodType', required=True)
|
|
2899
|
+
recipient_type = CharField(api_name='RecipientType', required=True)
|
|
2900
|
+
currency = CharField(api_name='Currency', required=True)
|
|
2901
|
+
country = CharField(api_name='Country')
|
|
2902
|
+
recipient_scope = CharField(api_name='RecipientScope')
|
|
2903
|
+
user_id = CharField(api_name='UserId')
|
|
2904
|
+
individual_recipient = IndividualRecipientField(api_name='IndividualRecipient')
|
|
2905
|
+
business_recipient = BusinessRecipientField(api_name='BusinessRecipient')
|
|
2906
|
+
local_bank_transfer = DictField(api_name='LocalBankTransfer')
|
|
2907
|
+
international_bank_transfer = DictField(api_name='InternationalBankTransfer')
|
|
2908
|
+
pending_user_action = PendingUserActionField(api_name='PendingUserAction')
|
|
2909
|
+
recipient_verification_of_payee = VerificationOfPayeeField(api_name='RecipientVerificationOfPayee')
|
|
2910
|
+
sca_context = CharField(api_name='ScaContext')
|
|
2911
|
+
|
|
2912
|
+
class Meta:
|
|
2913
|
+
verbose_name = 'recipient'
|
|
2914
|
+
verbose_name_plural = 'recipients'
|
|
2915
|
+
|
|
2916
|
+
url = {
|
|
2917
|
+
InsertQuery.identifier: '/users/%(user_id)s/recipients',
|
|
2918
|
+
SelectQuery.identifier: '/recipients',
|
|
2919
|
+
UpdateQuery.identifier: '/recipients',
|
|
2920
|
+
'GET_USER_RECIPIENTS': '/users/%(user_id)s/recipients',
|
|
2921
|
+
'VALIDATE': '/users/%(user_id)s/recipients/validate'
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
def create(self, user_id, idempotency_key=None, **kwargs):
|
|
2925
|
+
path_params = {'user_id': user_id}
|
|
2926
|
+
insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
|
|
2927
|
+
insert.insert_query = self.get_field_dict()
|
|
2928
|
+
return insert.execute()
|
|
2929
|
+
|
|
2930
|
+
def validate(self, user_id, idempotency_key=None, **kwargs):
|
|
2931
|
+
path_params = {'user_id': user_id}
|
|
2932
|
+
insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
|
|
2933
|
+
insert.insert_query = self.get_field_dict()
|
|
2934
|
+
insert.identifier = 'VALIDATE'
|
|
2935
|
+
insert.execute()
|
|
2936
|
+
|
|
2937
|
+
@classmethod
|
|
2938
|
+
def get_user_recipients(cls, user_id, *args, **kwargs):
|
|
2939
|
+
kwargs['user_id'] = user_id
|
|
2940
|
+
select = SelectQuery(Recipient, *args, **kwargs)
|
|
2941
|
+
select.identifier = 'GET_USER_RECIPIENTS'
|
|
2942
|
+
return select.all(*args, **kwargs)
|
|
2943
|
+
|
|
2944
|
+
@classmethod
|
|
2945
|
+
def deactivate(cls, recipient_id, **kwargs):
|
|
2946
|
+
update = UpdateQuery(Recipient, recipient_id, **kwargs)
|
|
2947
|
+
return update.execute()
|
|
2948
|
+
|
|
2949
|
+
|
|
2950
|
+
class RecipientSchema(BaseModel):
|
|
2951
|
+
display_name = RecipientPropertySchemaField(api_name='DisplayName')
|
|
2952
|
+
payout_method_type = RecipientPropertySchemaField(api_name='PayoutMethodType')
|
|
2953
|
+
recipient_type = RecipientPropertySchemaField(api_name='RecipientType')
|
|
2954
|
+
currency = RecipientPropertySchemaField(api_name='Currency')
|
|
2955
|
+
country = RecipientPropertySchemaField(api_name='Country')
|
|
2956
|
+
recipient_scope = RecipientPropertySchemaField(api_name='RecipientScope')
|
|
2957
|
+
tag = RecipientPropertySchemaField(api_name='Tag')
|
|
2958
|
+
individual_recipient = IndividualRecipientPropertySchemaField(api_name='IndividualRecipient')
|
|
2959
|
+
business_recipient = BusinessRecipientPropertySchemaField(api_name='BusinessRecipient')
|
|
2960
|
+
local_bank_transfer = DictField(api_name='LocalBankTransfer')
|
|
2961
|
+
international_bank_transfer = DictField(api_name='InternationalBankTransfer')
|
|
2962
|
+
|
|
2963
|
+
class Meta:
|
|
2964
|
+
verbose_name = 'recipient_schema'
|
|
2965
|
+
verbose_name_plural = 'recipient_schemas'
|
|
2966
|
+
|
|
2967
|
+
url = {
|
|
2968
|
+
SelectQuery.identifier: '/recipients/schema?payoutMethodType=%(payout_method_type)s&recipientType=%('
|
|
2969
|
+
'recipient_type)s¤cy=%(currency)s&country=%(country)s'
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
@classmethod
|
|
2973
|
+
def get(cls, payout_method_type, recipient_type, currency, country, *args, **kwargs):
|
|
2974
|
+
kwargs['payout_method_type'] = payout_method_type
|
|
2975
|
+
kwargs['recipient_type'] = recipient_type
|
|
2976
|
+
kwargs['currency'] = currency
|
|
2977
|
+
kwargs['country'] = country
|
|
2978
|
+
select = SelectQuery(RecipientSchema, *args, **kwargs)
|
|
2979
|
+
return select.get("", *args, **kwargs)
|
|
2980
|
+
|
|
2981
|
+
|
|
2982
|
+
class PayoutMethod(BaseModel):
|
|
2983
|
+
available_payout_methods = ListField(api_name='AvailablePayoutMethods')
|
|
2984
|
+
|
|
2985
|
+
class Meta:
|
|
2986
|
+
verbose_name = 'payout_method'
|
|
2987
|
+
verbose_name_plural = 'payout_methods'
|
|
2988
|
+
|
|
2989
|
+
url = {
|
|
2990
|
+
SelectQuery.identifier: '/recipients/payout-methods?country=%(country)s¤cy=%(currency)s'
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
@classmethod
|
|
2994
|
+
def get(cls, country, currency, *args, **kwargs):
|
|
2995
|
+
kwargs['country'] = country
|
|
2996
|
+
kwargs['currency'] = currency
|
|
2997
|
+
select = SelectQuery(PayoutMethod, *args, **kwargs)
|
|
2998
|
+
return select.get("", *args, **kwargs)
|
|
2999
|
+
|
|
3000
|
+
|
|
3001
|
+
class UserDataFormatValidation(BaseModel):
|
|
3002
|
+
company_number = CompanyNumberValidationField(api_name='CompanyNumber')
|
|
3003
|
+
|
|
3004
|
+
class Meta:
|
|
3005
|
+
verbose_name = 'user_data_format_validation'
|
|
3006
|
+
verbose_name_plural = 'user_data_format_validations'
|
|
3007
|
+
|
|
3008
|
+
url = {
|
|
3009
|
+
InsertQuery.identifier: '/users/data-formats/validation'
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
|
|
3013
|
+
class PayInIntent(BaseModel):
|
|
3014
|
+
creation_date = DateTimeField(api_name='CreationDate')
|
|
3015
|
+
amount = IntegerField(api_name='Amount')
|
|
3016
|
+
available_amount_to_split = IntegerField(api_name='AvailableAmountToSplit')
|
|
3017
|
+
currency = CharField(api_name='Currency')
|
|
3018
|
+
platform_fees_amount = IntegerField(api_name='PlatformFeesAmount')
|
|
3019
|
+
status = CharField(api_name='Status')
|
|
3020
|
+
next_actions = CharField(api_name='NextActions')
|
|
3021
|
+
external_data = PayInIntentExternalDataField(api_name='ExternalData')
|
|
3022
|
+
buyer = PayInIntentBuyerField(api_name='Buyer')
|
|
3023
|
+
line_items = ListField(api_name='LineItems')
|
|
3024
|
+
captures = ListField(api_name='Captures')
|
|
3025
|
+
refunds = ListField(api_name='Refunds')
|
|
3026
|
+
disputes = ListField(api_name='Disputes')
|
|
3027
|
+
splits = ListField(api_name='Splits')
|
|
3028
|
+
settlement_id = CharField(api_name='SettlementId')
|
|
3029
|
+
|
|
3030
|
+
class Meta:
|
|
3031
|
+
verbose_name = 'pay_in_intent'
|
|
3032
|
+
verbose_name_plural = 'pay_in_intents'
|
|
3033
|
+
|
|
3034
|
+
url = {
|
|
3035
|
+
'CREATE_AUTHORIZATION': '/payins/intents',
|
|
3036
|
+
'CREATE_CAPTURE': '/payins/intents/%(intent_id)s/captures',
|
|
3037
|
+
'GET': '/payins/intents',
|
|
3038
|
+
'CANCEL': '/payins/intents/%(intent_id)s/cancel'
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
def create_authorization(self, idempotency_key=None, **kwargs):
|
|
3042
|
+
insert = InsertQuery(self, idempotency_key, **kwargs)
|
|
3043
|
+
insert.insert_query = self.get_field_dict()
|
|
3044
|
+
insert.identifier = 'CREATE_AUTHORIZATION'
|
|
3045
|
+
return insert.execute(is_v3=True)
|
|
3046
|
+
|
|
3047
|
+
def create_capture(self, intent_id, idempotency_key=None, **kwargs):
|
|
3048
|
+
path_params = {'intent_id': intent_id}
|
|
3049
|
+
insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
|
|
3050
|
+
insert.insert_query = self.get_field_dict()
|
|
3051
|
+
insert.identifier = 'CREATE_CAPTURE'
|
|
3052
|
+
return insert.execute(is_v3=True)
|
|
3053
|
+
|
|
3054
|
+
@classmethod
|
|
3055
|
+
def get(cls, pay_in_intent_id, *args, **kwargs):
|
|
3056
|
+
select = SelectQuery(PayInIntent, *args, **kwargs)
|
|
3057
|
+
select.identifier = 'GET'
|
|
3058
|
+
return select.get(pay_in_intent_id, is_v3=True, *args, **kwargs)
|
|
3059
|
+
|
|
3060
|
+
@classmethod
|
|
3061
|
+
def cancel(cls, intent_id, idempotency_key=None, **kwargs):
|
|
3062
|
+
path_params = {'intent_id': intent_id}
|
|
3063
|
+
insert = InsertQuery(PayInIntent, idempotency_key, path_params, **kwargs)
|
|
3064
|
+
insert.identifier = 'CANCEL'
|
|
3065
|
+
return insert.execute(is_v3=True)
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
class Settlement(BaseModel):
|
|
3069
|
+
settlement_id = CharField(api_name='SettlementId')
|
|
3070
|
+
status = CharField(api_name='Status')
|
|
3071
|
+
settlement_date = DateTimeField(api_name='SettlementDate')
|
|
3072
|
+
external_provider_name = CharField(api_name='ExternalProviderName')
|
|
3073
|
+
declared_intent_amount = IntegerField(api_name='DeclaredIntentAmount')
|
|
3074
|
+
external_processor_fees_amount = IntegerField(api_name='ExternalProcessorFeesAmount')
|
|
3075
|
+
actual_settlement_amount = IntegerField(api_name='ActualSettlementAmount')
|
|
3076
|
+
funds_missing_amount = IntegerField(api_name='FundsMissingAmount')
|
|
3077
|
+
|
|
3078
|
+
class Meta:
|
|
3079
|
+
verbose_name = 'settlement'
|
|
3080
|
+
verbose_name_plural = 'settlements'
|
|
3081
|
+
|
|
3082
|
+
url = {
|
|
3083
|
+
'UPLOAD': '/payins/intents/settlements',
|
|
3084
|
+
'GET': '/payins/intents/settlements',
|
|
3085
|
+
'UPDATE': '/payins/intents/settlements'
|
|
3086
|
+
}
|
|
3087
|
+
|
|
3088
|
+
@classmethod
|
|
3089
|
+
def upload(cls, file, idempotency_key=None, **kwargs):
|
|
3090
|
+
insert = InsertMultipartQuery(Settlement, file, 'settlement_file.csv', idempotency_key, **kwargs)
|
|
3091
|
+
insert.identifier = 'UPLOAD'
|
|
3092
|
+
return insert.execute(is_v3=True)
|
|
3093
|
+
|
|
3094
|
+
@classmethod
|
|
3095
|
+
def get(cls, settlement_id, *args, **kwargs):
|
|
3096
|
+
select = SelectQuery(Settlement, *args, **kwargs)
|
|
3097
|
+
select.identifier = 'GET'
|
|
3098
|
+
return select.get(settlement_id, is_v3=True, *args, **kwargs)
|
|
3099
|
+
|
|
3100
|
+
@classmethod
|
|
3101
|
+
def update_file(cls, settlement_id, file, **kwargs):
|
|
3102
|
+
update = UpdateMultipartQuery(Settlement, file, 'settlement_file.csv', settlement_id, **kwargs)
|
|
3103
|
+
update.identifier = 'UPDATE'
|
|
3104
|
+
return update.execute(is_v3=True)
|
|
3105
|
+
|
|
3106
|
+
|
|
3107
|
+
class PayInIntentSplit(BaseModel):
|
|
3108
|
+
line_item_id = CharField(api_name='LineItemId')
|
|
3109
|
+
wallet_id = CharField(api_name='WalletId')
|
|
3110
|
+
seller_id = CharField(api_name='SellerId')
|
|
3111
|
+
split_amount = IntegerField(api_name='SplitAmount')
|
|
3112
|
+
fees_amount = IntegerField(api_name='FeesAmount')
|
|
3113
|
+
description = CharField(api_name='Description')
|
|
3114
|
+
status = CharField(api_name='Status')
|
|
3115
|
+
transfer_date = DateTimeField(api_name='TransferDate')
|
|
3116
|
+
|
|
3117
|
+
class Meta:
|
|
3118
|
+
verbose_name = 'intent_split'
|
|
3119
|
+
verbose_name_plural = 'intent_splits'
|
|
3120
|
+
|
|
3121
|
+
url = {
|
|
3122
|
+
'EXECUTE': '/payins/intents/%(intent_id)s/splits/%(split_id)s/execute',
|
|
3123
|
+
'REVERSE': '/payins/intents/%(intent_id)s/splits/%(split_id)s/reverse',
|
|
3124
|
+
'GET': '/payins/intents/%(intent_id)s/splits/%(split_id)s',
|
|
3125
|
+
'UPDATE': '/payins/intents/%(intent_id)s/splits/%(split_id)s'
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
@classmethod
|
|
3129
|
+
def execute(cls, intent_id, split_id, idempotency_key=None, *args, **kwargs):
|
|
3130
|
+
path_params = {'intent_id': intent_id, 'split_id': split_id}
|
|
3131
|
+
insert = InsertQuery(PayInIntentSplit, idempotency_key, path_params, **kwargs)
|
|
3132
|
+
insert.identifier = 'EXECUTE'
|
|
3133
|
+
return insert.execute(*args, is_v3=True)
|
|
3134
|
+
|
|
3135
|
+
@classmethod
|
|
3136
|
+
def reverse(cls, intent_id, split_id, idempotency_key=None, *args, **kwargs):
|
|
3137
|
+
path_params = {'intent_id': intent_id, 'split_id': split_id}
|
|
3138
|
+
insert = InsertQuery(PayInIntentSplit, idempotency_key, path_params, **kwargs)
|
|
3139
|
+
insert.identifier = 'REVERSE'
|
|
3140
|
+
return insert.execute(*args, is_v3=True)
|
|
3141
|
+
|
|
3142
|
+
@classmethod
|
|
3143
|
+
def get(cls, intent_id, split_id, *args, **kwargs):
|
|
3144
|
+
kwargs['intent_id'] = intent_id
|
|
3145
|
+
kwargs['split_id'] = split_id
|
|
3146
|
+
select = SelectQuery(PayInIntentSplit, *args, **kwargs)
|
|
3147
|
+
select.identifier = 'GET'
|
|
3148
|
+
return select.get("", *args, is_v3=True, **kwargs)
|
|
3149
|
+
|
|
3150
|
+
@classmethod
|
|
3151
|
+
def update_split(cls, intent_id, split_id, *args, **kwargs):
|
|
3152
|
+
path_params = {'intent_id': intent_id, 'split_id': split_id}
|
|
3153
|
+
update = UpdateQuery(PayInIntentSplit, "", path_params=path_params, **kwargs)
|
|
3154
|
+
update.identifier = 'UPDATE'
|
|
3155
|
+
return update.execute(*args, is_v3=True)
|
|
3156
|
+
|
|
3157
|
+
|
|
3158
|
+
class PayInIntentSplits(BaseModel):
|
|
3159
|
+
splits = ListField(api_name='Splits')
|
|
3160
|
+
|
|
3161
|
+
class Meta:
|
|
3162
|
+
verbose_name = 'pay_in_intent_split'
|
|
3163
|
+
verbose_name_plural = 'pay_in_intent_splits'
|
|
3164
|
+
|
|
3165
|
+
url = {
|
|
3166
|
+
'CREATE': '/payins/intents/%(intent_id)s/splits'
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
def create(self, intent_id, idempotency_key=None, **kwargs):
|
|
3170
|
+
path_params = {'intent_id': intent_id}
|
|
3171
|
+
insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
|
|
3172
|
+
insert.insert_query = self.get_field_dict()
|
|
3173
|
+
insert.identifier = 'CREATE'
|
|
3174
|
+
return insert.execute(is_v3=True)
|
|
3175
|
+
|
|
3176
|
+
|
|
3177
|
+
@python_2_unicode_compatible
|
|
3178
|
+
class ClientBankWireDirectPayIn(PayIn):
|
|
3179
|
+
author = ForeignKeyField(User, api_name='AuthorId')
|
|
3180
|
+
credited_wallet_id = CharField(api_name='CreditedWalletId', required=True)
|
|
3181
|
+
declared_debited_funds = MoneyField(api_name='DeclaredDebitedFunds', required=True)
|
|
3182
|
+
declared_fees = MoneyField(api_name='DeclaredFees')
|
|
3183
|
+
wire_reference = CharField(api_name='WireReference')
|
|
3184
|
+
bank_account = CharField(api_name='BankAccount')
|
|
3185
|
+
debited_funds = MoneyField(api_name='DebitedFunds')
|
|
3186
|
+
fees = MoneyField(api_name='Fees')
|
|
3187
|
+
|
|
3188
|
+
class Meta:
|
|
3189
|
+
verbose_name = 'payin'
|
|
3190
|
+
verbose_name_plural = 'payins'
|
|
3191
|
+
url = {
|
|
3192
|
+
InsertQuery.identifier: '/clients/payins/bankwire/direct',
|
|
3193
|
+
SelectQuery.identifier: '/payins'
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
|
|
3197
|
+
class PayPalDataCollection(BaseModel):
|
|
3198
|
+
# since the properties needed by PayPal are different depending on the use-case,
|
|
3199
|
+
# use Dict as payload and response for Create and Get. The cast to PayPalDataCollection model is skipped.
|
|
3200
|
+
class Meta:
|
|
3201
|
+
verbose_name = 'paypal_data_collection'
|
|
3202
|
+
verbose_name_plural = 'paypal_data_collections'
|
|
3203
|
+
url = {
|
|
3204
|
+
'CREATE': '/payins/payment-methods/paypal/data-collection',
|
|
3205
|
+
'GET': '/payins/payment-methods/paypal/data-collection'
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
@classmethod
|
|
3209
|
+
def create(cls, idempotency_key=None, handler=None, **kwargs):
|
|
3210
|
+
insert = InsertQuery(PayPalDataCollection, idempotency_key, None, **kwargs)
|
|
3211
|
+
insert.insert_query = kwargs
|
|
3212
|
+
insert.identifier = 'CREATE'
|
|
3213
|
+
return insert.execute(handler=handler, strict_dict_parsing=False)
|
|
3214
|
+
|
|
3215
|
+
@classmethod
|
|
3216
|
+
def get(cls, data_collection_id, *args, **kwargs):
|
|
3217
|
+
select = SelectQuery(PayPalDataCollection, *args, **kwargs)
|
|
3218
|
+
select.identifier = 'GET'
|
|
3219
|
+
return select.get(data_collection_id, strict_dict_parsing=False, **kwargs)
|