6. models¶
6.1. zoop_wrapper.models.base module¶
-
class
zoop_wrapper.models.base.
Address
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Represents a physical
address
.-
line1
¶ complete street name
-
line2
¶ number
-
line3
¶ complement
-
neighborhood
¶ neighborhood
-
city
¶ city
-
state
¶ Código ISO 3166-2 para o estado
-
postal_code
¶ postal code
-
country_code
¶ ISO 3166-1 alpha-2 - códigos de país de duas letras
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.base.
BusinessOrIndividualModel
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.MarketPlaceModel
Represents a
Business
OrIndividual
ModelIt has
dynamic types
!Can be
Business
orIndividual
.-
taxpayer_id
¶ cpf válido para
type
INDIVIDUAL_TYPE
-
ein
¶ cnpj para
type
BUSINESS_TYPE
-
BUSINESS_IDENTIFIER
= 'ein'¶
-
BUSINESS_TYPE
= 'business'¶
-
INDIVIDUAL_IDENTIFIER
= 'taxpayer_id'¶
-
INDIVIDUAL_TYPE
= 'individual'¶
-
URI
= {'business': 'businesses', 'individual': 'individuals'}¶
-
get_all_fields
()[código fonte]¶ get
all fields
for instance.if
type
isBUSINESS_TYPE
then callget_business_required_fields()
andget_business_non_required_fields()
else
type
isINDIVIDUAL_TYPE
! then callget_individual_required_fields()
andget_individual_non_required_fields()
Retorna: set
of all fields
-
classmethod
get_business_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
forBUSINESS_TYPE
.Retorna: set
of fields
-
classmethod
get_business_required_fields
()[código fonte]¶ get
set
ofrequired fields
forBUSINESS_TYPE
Retorna: set
of fields
-
classmethod
get_individual_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
forINDIVIDUAL_TYPE
Retorna: set
of fields
-
classmethod
get_individual_required_fields
()[código fonte]¶ get
set
ofrequired fields
forINDIVIDUAL_TYPE
Retorna: set
of fields
-
get_type
()[código fonte]¶ get the
dynamic type
from instanceRetorna: BUSINESS_TYPE
orINDIVIDUAL_TYPE
-
get_type_uri
()[código fonte]¶ get the
dynamic type uri
for instance based onget_type()
Retorna: uri string for type from URI
-
get_validation_fields
()[código fonte]¶ Get
validation fields
for instance.if
type
isBUSINESS_TYPE
then callget_business_required_fields()
else
type
isINDIVIDUAL_TYPE
! then callget_individual_required_fields()
Retorna: set
of fields to be used on validation
-
init_custom_fields
(taxpayer_id=None, ein=None, **kwargs)[código fonte]¶ Chama
set_identifier()
.Parâmetros: - taxpayer_id – cpf value
- ein – cnpj value
- **kwargs – dict of kwargs
-
set_identifier
(taxpayer_id=None, ein=None, **kwargs)[código fonte]¶ Declara os atributos
taxpayer_id
ou (ou exclusivo)ein
. Exatamente um deles deve ser passado e válido, e não os dois.kwargs
are there to be called fromSeller.init_custom_fields()
andBankAccount.init_custom_fields()
without gettingtaxpayer_id
orein
variables.Parâmetros: - taxpayer_id – cpf
- ein – cnpj
- **kwargs – kwarg
-
classmethod
validate_identifiers
(taxpayer_id, ein)[código fonte]¶ Valida tupla de valores de identificação.
Raises: ValidationError
quando é passado os dois, ou nenhum, ou quando o identificador passado é inválido # noqa
-
-
class
zoop_wrapper.models.base.
FinancialModel
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Have financial attributes.
-
status
¶ pending or active string
-
account_balance
¶ amount of balance
-
current_balance
¶ curent amount of balance
-
description
¶ description
-
delinquent
¶ bolean of verification
-
payment_methods
¶ ?
-
default_debit
¶ ?
-
default_credit
¶ ?
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.base.
MarketPlaceModel
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ResourceModel
This class represents a
ResourceModel
which belongs to somemarketplace
fromZoop
.-
marketplace_id
¶ identifier string
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.base.
PaymentMethod
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ResourceModel
Have some payment method attributes
-
description
¶ text description
-
customer
¶ uuid id
-
address
¶ Address Model
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
init_custom_fields
(address=None, **kwargs)[código fonte]¶ initialize
address
withAddress
Parâmetros: - address – dict of data or
Address
- **kwargs – dic of kwargs
- address – dict of data or
-
-
class
zoop_wrapper.models.base.
Person
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Represents a
person
.-
address
¶ Address model
-
birthdate
¶ birthdate
-
email
¶ email
-
first_name
¶ first name
-
last_name
¶ last name
-
phone_number
¶ phone number
-
taxpayer_id
¶ cpf válido
-
full_name
¶ get
full name
of the personRetorna: string with the full name
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
init_custom_fields
(address=None, **kwargs)[código fonte]¶ Initialize
address
withAddress
Parâmetros: - address – dict of data or
Address
- **kwargs –
- address – dict of data or
-
validate_custom_fields
(**kwargs)[código fonte]¶ O
taxpayer_id
precisa ser um CPF válido. Então verificamos isso.Parâmetros: - raise_exception – Quando algum campo está faltando ou CPF é inválido
- **kwargs –
-
-
class
zoop_wrapper.models.base.
ResourceModel
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Represents a Model that is a
resource
.-
id
¶ identifier string
-
resource
¶ type string
-
uri
¶ uri string
-
created_at
¶ date of creation
-
updated_at
¶ date of update
-
metadata
¶ dict with metadata
-
RESOURCE
= None¶
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.base.
SocialModel
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Have social sites uri’s
-
facebook
¶ facebook profile url?
-
twitter
¶ twitter profile url?
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.base.
VerificationModel
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Have some verification attributes.
-
postal_code_check
¶ boolean of verification
-
address_line1_check
¶ boolean of verification
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.base.
ZoopObject
(allow_empty=False, **kwargs)[código fonte]¶ Base:
object
This class represent a bare Zoop object.
-
_allow_empty
¶ boolean
-
__init__
(allow_empty=False, **kwargs)[código fonte]¶ initialize
all fields
fromget_all_fields()
asattributes
fromkwargs
on instance.Then call
validate_fields()
.Parâmetros: - allow_empty – boolean which disable validation of required fields
- **kwargs – dictionary of args
-
classmethod
from_dict
(data, allow_empty=False, **kwargs)[código fonte]¶ to construct a instance of this
class
fromdict
Parâmetros: - data – dict of data
- allow_empty – boolean
- **kwargs – kwargs
- data – dict of data may be None
- allow_empty – boolean
- **kwargs – kwargs
Raises: ValidationError
– se data não for do tipo``dict`` ou forNone
Retorna: instance initialized of cls
-
classmethod
from_dict_or_instance
(data, **kwargs)[código fonte]¶ Esse método existe para fazer um tratamento dos inputs de dados.
O atributo
data
pode ser um dict ou umZoopOject
.Verifica se
data
já é uma instância da classseZoopObject
or umasubclasse
.Se não for, chama
from_dict()
.Parâmetros: - data – dict of data or instance
- **kwargs – kwargs
Retorna: instance initialized of
cls
-
get_all_fields
()[código fonte]¶ Método para pegar todos os campos!
Isso é necessário para classes/instances com diferentes campos obrigatórios definidos por um tipo dinâmico!
Tais como
Seller
,BankAccount
,Fine
eToken
.O padrão é
get_validation_fields()
+get_non_required_fields()
.Retorna: set
de todos os campos
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
get_original_different_fields_mapping
()[código fonte]¶ Método de mapeamento de nomes diferentes de atributo => API zoop a ser estendido.
Retorna: Dicionário de nome_custom => nome_oringial
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
get_validation_fields
()[código fonte]¶ Método para pegar os campos de validação!
Isso é necessário para classes/instances com diferentes campos obrigatórios definidos por um tipo dinâmico!
Tais como
Seller
,BankAccount
,Fine
eToken
.O padrão é
get_required_fields()
.Retorna: set
de campos para serem utilizados na validação
-
init_custom_fields
(**kwargs)[código fonte]¶ this method exists to set custom attributes such as
ZoopObject
instances. Since all attributes set on__init__()
aredict's
orvariables
.Parâmetros: **kwargs – dictionary of args
-
static
is_value_empty
(value)[código fonte]¶ Verify if
value
passed is consideredempty
!value
may beNone
. As we set on__init__()
:value = kwargs.get(field_name, None)
value
may be{}
if it was aZoopObject
with allow_empty!value
may be[{}]
if it was alist
ofZoopObject
’s withallow_empty
!!Parâmetros: value – Value to be verified Retorna: boolean
-
static
make_data_copy_with_kwargs
(data, **kwargs)[código fonte]¶ make a new data dict from previous data dict with added
kwargs
if
data
isNone
create anew empty dict
.data
may beNone
for the cases we are explicitly calling withallow_empty=True
oninit_custom_fields()
for some customZoopObject
instance set. Such as:instance = ZoopObject() setattr( instance, 'address', Address.from_dict_or_instance(None, allow_empty=True) )
Parâmetros: - data – dict of data may be None
- **kwargs – dict of kwargs
Retorna: new dict of data
-
to_dict
()[código fonte]¶ serialize
self
to dictRetorna: dict of instance
-
validate_custom_fields
(**kwargs)[código fonte]¶ Método de validação a ser estendido para fazer uma validação especializada.
Esse método originalmente retorna uma lista vazia pois ele serve para ser sobreescrito pelas calsses especializadas adicionando comportamento de validação!
Retorna: Lista de erros a serem levantados.
-
validate_fields
(raise_exception=True, **kwargs)[código fonte]¶ Valida na instância os campos retornados do conjunto
get_validation_fields()
.Se
_allow_empty
éTrue
não validar!Esse método deve chamar o
validate_custom_fields()
para praticidade de extensão e especialização!Parâmetros: raise_exception – flag que dita se a exceção deve ser lançada ou não Raises: ValidationError
se (algum campoobrigatório
está faltando ou ocorreu algum erro novalidate_custom_fields()
) eraise_exception==True
# noqa
-
6.2. zoop_wrapper.models.bank_account module¶
-
class
zoop_wrapper.models.bank_account.
BankAccount
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.BusinessOrIndividualModel
Represent a Bank Account. https://docs.zoop.co/reference#conta-banc%C3%A1ria
The
RESOURCE
is used to identify this Model. Used to check againstresource
!-
account_number
¶ account number
-
bank_code
¶ code of bank
-
holder_name
¶ name of owner
-
routing_number
¶ agency code in BR
-
type
¶ type of account
-
address
¶ Address model
-
bank_name
¶ name of bank
-
country_code
¶ country code
-
customer
¶ id of owner
-
description
¶ description
-
debitable
¶ boolean of verification
-
fingerprint
¶ ?
-
is_active
¶ boolean of verification
-
is_verified
¶ boolean of verification
-
last4_digits
¶ last 4 digits of account number
-
phone_number
¶ phone number
-
verification_checklist
¶ VerificationCheckList model
-
CHECKING_TYPE
= 'Checking'¶
-
RESOURCE
= 'bank_account'¶
-
SAVING_TYPE
= 'Savings'¶
-
TYPES
= {'Checking', 'Savings'}¶
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
init_custom_fields
(type=None, address=None, verification_checklist=None, **kwargs)[código fonte]¶ Initialize
address
asAddress
.Initialize
verification_checklist
asBankAccountVerificationModel
.Parâmetros: - type (str) – value containing type
- address (dict or
Address
) – address - verification_checklist (dict or
BankAccountVerificationModel
) – verifications # noqa - **kwargs –
-
classmethod
validate_type
(type)[código fonte]¶ Validate bank account
type
Parâmetros: type (str) – value of type to be validated Raises: ValidationError
– whentype
is not inTYPES
-
-
class
zoop_wrapper.models.bank_account.
BankAccountVerificationModel
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.VerificationModel
Have some bank account verification attributes.
-
deposit_check
¶ boolean of verification
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
6.3. zoop_wrapper.models.buyer module¶
-
class
zoop_wrapper.models.buyer.
Buyer
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.MarketPlaceModel
,zoop_wrapper.models.base.Person
,zoop_wrapper.models.base.SocialModel
,zoop_wrapper.models.base.FinancialModel
Represent a buyer. https://docs.zoop.co/reference#comprador-1
The
RESOURCE
is used to identify this Model. Used to check againstresource
!-
default_receipt_delivery_method
¶ ?
-
RESOURCE
= 'buyer'¶
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
validate_custom_fields
(**kwargs)[código fonte]¶ O
taxpayer_id
precisa ser um CPF ou CNPJ válido. Então verificamos isso.Parâmetros: **kwargs –
-
6.4. zoop_wrapper.models.card module¶
-
class
zoop_wrapper.models.card.
Card
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.PaymentMethod
Represent a Card. https://docs.zoop.co/reference#cart%C3%A3o
The
RESOURCE
is used to identify this Model. Used to check againstresource
!-
card_brand
¶ company name
-
expiration_month
¶ month of expiration
-
expiration_year
¶ year of expiration
-
fingerprint
¶ unique card identifier from company of card ?
-
first4_digits
¶ first 4 digits of card
-
holder_name
¶ owner name
-
is_active
¶ boolean of verification
-
is_valid
¶ boolean of verification
-
is_verified
¶ boolean of verification
-
last4_digits
¶ last 4 digits of card
-
verification_checklist
¶ CardVerificationChecklist model
-
RESOURCE
= 'card'¶
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
init_custom_fields
(verification_checklist=None, **kwargs)[código fonte]¶ Initialize
verification_checklist
asCardVerificationChecklist
Parâmetros: - verification_checklist – dict of data or
CardVerificationChecklist
- **kwargs – kwargs
- verification_checklist – dict of data or
-
-
class
zoop_wrapper.models.card.
CardVerificationChecklist
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.VerificationModel
Represent a credit card verification
-
security_code_check
¶ boolean of verification
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
6.5. zoop_wrapper.models.invoice module¶
-
class
zoop_wrapper.models.invoice.
BaseModeObject
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Um objeto base que possui modos de quantia e porcentagem
-
MODES
= {}¶
-
classmethod
get_fixed_required_fields
()[código fonte]¶
-
get_mode_required_fields_mapping
()[código fonte]¶
-
classmethod
get_percentage_required_fields
()[código fonte]¶
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
get_validation_fields
()[código fonte]¶ Método para pegar os campos de validação!
Isso é necessário para classes/instances com diferentes campos obrigatórios definidos por um tipo dinâmico!
Tais como
Seller
,BankAccount
,Fine
eToken
.O padrão é
get_required_fields()
.Retorna: set
de campos para serem utilizados na validação
-
init_custom_fields
(mode=None, **kwargs)[código fonte]¶ É necessário configurar o
mode
antes pois ele influência noget_validation_fields()
-
-
class
zoop_wrapper.models.invoice.
BillingInstructions
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Represents billing instructions (fine, interest and discount)
-
discount
¶ list of optional discount rules # noqa
Type: list of BillingConfiguration
-
interest
¶ optional interest rules
Type: BillingConfiguration
-
late_fee
¶ optional fine rules
Type: BillingConfiguration
-
classmethod
get_non_required_fields
()[código fonte]¶ Conjunto de campos não obrigatórios
Retorna: set
de campos
-
init_custom_fields
(late_fee=None, interest=None, discount=None, **kwargs)[código fonte]¶ Inicializa late_fee, interest e discount.
Parâmetros: - discount – dict or instance of BillingConfiguration model
- interest – dict or instance of BillingConfiguration model
- late_fee – dict or instance of BillingConfiguration model
- **kwargs – kwargs
-
-
class
zoop_wrapper.models.invoice.
Discount
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.invoice.BaseModeObject
Representa um desconto!
https://docs.zoop.co/docs/multa-juros-e-descontos#descontos
-
FIXED
= 'FIXED'¶
-
MODES
= {'FIXED', 'PERCENTAGE'}¶
-
PERCENTAGE
= 'PERCENTAGE'¶
-
get_mode_required_fields_mapping
()[código fonte]¶
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.invoice.
Fine
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.invoice.BaseModeObject
Representa a multa!
https://docs.zoop.co/docs/multa-juros-e-descontos#multa
-
FIXED
= 'FIXED'¶
-
MODES
= {'FIXED', 'PERCENTAGE'}¶
-
PERCENTAGE
= 'PERCENTAGE'¶
-
get_mode_required_fields_mapping
()[código fonte]¶
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.invoice.
Interest
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.invoice.BaseModeObject
Representa um juros!
https://docs.zoop.co/docs/multa-juros-e-descontos#juros
-
DAILY_AMOUNT
= 'DAILY_AMOUNT'¶
-
DAILY_PERCENTAGE
= 'DAILY_PERCENTAGE'¶
-
MODES
= {'DAILY_AMOUNT', 'DAILY_PERCENTAGE', 'MONTHLY_PERCENTAGE'}¶
-
MONTHLY_PERCENTAGE
= 'MONTHLY_PERCENTAGE'¶
-
get_mode_required_fields_mapping
()[código fonte]¶
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.invoice.
Invoice
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.PaymentMethod
Represents a invoice (‘boleto’ in BR). https://docs.zoop.co/reference#boleto
-
billing_instructions
¶ optional billing instructions # noqa
Type: BillingInstructions
-
security_code_check
¶ verification of security code
Type: bool
-
RESOURCE
= 'boleto'¶
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
init_custom_fields
(billing_instructions=None, **kwargs)[código fonte]¶ initialize
billing_instructions
withBillingInstructions
Parâmetros: - billing_instructions (dict or
BillingInstructions
) – data - **kwargs –
- billing_instructions (dict or
-
6.6. zoop_wrapper.models.seller module¶
-
class
zoop_wrapper.models.seller.
Seller
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.BusinessOrIndividualModel
,zoop_wrapper.models.base.Person
,zoop_wrapper.models.base.FinancialModel
,zoop_wrapper.models.base.SocialModel
Represent a seller. https://docs.zoop.co/reference#vendedor-1
The
RESOURCE
is used to identify this Model. Used to check againstresource
!-
decline_on_fail_security_code
¶ value of verification
Type: bool
-
decline_on_fail_zipcode
¶ value of verification
Type: bool
-
is_mobile
¶ value of verification
Type: bool
-
mcc
¶ ?
-
merchant_code
¶ ?
-
show_profile_online
¶ ?
-
statement_descriptor
¶ ?
-
terminal_code
¶ ?
-
type
¶ individual or business string
Type: str
-
taxpayer_id
¶ Optional value
Type: str
-
website
¶ Optional value
Type: str
-
business_description
¶ optional value
Type: str
-
business_email
¶ optional value
Type: str
-
business_facebook
¶ optional value
Type: str
-
business_name
¶ optional value
Type: str
-
business_opening_date
¶ optional value
Type: str
-
business_phone
¶ optional value
Type: str
-
business_twitter
¶ optional value
Type: str
-
business_website
¶ optional value
Type: str
-
ein
¶ optional value
Type: str
-
RESOURCE
= 'seller'¶
-
full_name
¶ Get
full name
for theSeller
.If
dynamic type
isBUSINESS_TYPE
it will have the owner attribute.Else dynamic type` is
INDIVIDUAL_TYPE
. So we call the super() which will find the method on Person class.Retorna: string with the full name
-
classmethod
get_business_non_required_fields
()[código fonte]¶ Get
set
ofnon required fields
forBUSINESS_TYPE
Retorna: set
of fields
-
classmethod
get_business_required_fields
()[código fonte]¶ Get
set
ofrequired fields
forBUSINESS_TYPE
Retorna: ``set` `of fields
-
classmethod
get_individual_non_required_fields
()[código fonte]¶ Get
set
ofnon required fields
forINDIVIDUAL_TYPE
Retorna: set
of fields
-
classmethod
get_individual_required_fields
()[código fonte]¶ Get
set
ofrequired fields
forINDIVIDUAL_TYPE
Retorna: set
of fields
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
init_custom_fields
(business_address=None, owner=None, **kwargs)[código fonte]¶ If
dynamic type
isBUSINESS_TYPE
then initializeowner
withPerson
and initializebusiness_address
withAddress
.Else
dynamic type
isINDIVIDUAL_TYPE
! Then initializeself
withPerson
.Parâmetros:
-
validate_custom_fields
(**kwargs)[código fonte]¶ Caso o vendedor seja
BUSINESS_TYPE
precisamos validar os campos peloBusinessOrIndividualModel
.Caso o vendedor seja
INDIVIDUAL_TYPE
precisamos validar os campos peloPerson
.Parâmetros: **kwargs –
-
6.7. zoop_wrapper.models.token module¶
-
class
zoop_wrapper.models.token.
Token
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ResourceModel
Token is a resource used to link a
BankAccount
OrCard
and aSeller
orBuyer
. https://docs.zoop.co/reference#token-1The
RESOURCE
is used to identify this Model. Used to check againstresource
!It has
dynamic types
!It can be
CARD_TYPE
orBANK_ACCOUNT_TYPE
.But before
creation
it won’t have attributetype
. So we need to verify byother attributes
. Aftercreated
on Zoop it will havetype
.-
token_type
¶ value for identified token
type
Type: str
-
type
¶ optional
BANK_ACCOUNT_TYPE
orCARD_TYPE
. It has collision with ofBankAccount.type
. So we need the abovetoken_type
.Type: str
-
used
¶ optional value of verification
Type: bool
-
bank_account
¶ optional value (for
created
token of ‘bank_account’ type)Type: BankAccount
-
holder_name
¶ owner name (for both token of ‘bank_account’ and ‘card’ type)
Type: str
-
account_number
¶ account number for
BANK_ACCOUNT_TYPE
Type: str
-
taxpayer_id
¶ identifier for
BANK_ACCOUNT_TYPE
ofINDIVIDUAL_TYPE
Type: str
-
ein
¶ identifier for
BANK_ACCOUNT_TYPE
ofBUSINESS_TYPE
Type: str
-
bank_code
¶ bank code for
BANK_ACCOUNT_TYPE
Type: str
-
routing_number
¶ agency code in BR for
BANK_ACCOUNT_TYPE
Type: str
-
BANK_ACCOUNT_IDENTIFIER
= 'bank_code'¶
-
BANK_ACCOUNT_TYPE
= 'bank_account'¶
-
CARD_IDENTIFIER
= 'card_number'¶
-
CARD_TYPE
= 'card'¶
-
IDENTIFIERS
= {'bank_code', 'card_number'}¶
-
RESOURCE
= 'token'¶
-
TYPES
= {'bank_account', 'card'}¶
-
get_all_fields
()[código fonte]¶ Get
all fields
for instance.fields
isget_validation_fields()
if
token_type
isCARD_TYPE
returnfields
unionget_card_non_required_fields()
.else
token_type
isBANK_ACCOUNT_TYPE
returnfields
unionget_bank_account_non_required_fields()
.Retorna: set
of all fields
-
classmethod
get_bank_account_non_required_fields
()[código fonte]¶ Get
set
ofnon required fields
forBANK_ACCOUNT_TYPE
Retorna: set
of fields
-
classmethod
get_bank_account_required_fields
()[código fonte]¶ get
set
ofrequired fields
forBANK_ACCOUNT_TYPE
Retorna: set
of fields
-
get_bank_account_type
()[código fonte]¶ Get
bank account type
forcreation token
of :class:`.BankAccount.Raises: TypeError
– when called from a token not from ‘bank_account’ typeRetorna: value with bank_account type
-
classmethod
get_card_non_required_fields
()[código fonte]¶ Get
set
ofnon required fields
forCARD_TYPE
.Retorna: set
of fields
-
classmethod
get_card_required_fields
()[código fonte]¶ Get
set
ofrequired fields
forCARD_TYPE
.Retorna: set
of fields
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
get_validation_fields
()[código fonte]¶ Get
validation fields
for instance.if
token_type
isCARD_TYPE
card returnget_card_required_fields()
.else
token_type
isBANK_ACCOUNT_TYPE
!fields
isget_bank_account_required_fields()
.if
bank account type
isINDIVIDUAL_TYPE
returnfields
unionget_individual_required_fields()
.else
bank account type
isBUSINESS_TYPE
returnfields
unionget_business_required_fields()
.Retorna: set
of fields to be validated
-
init_custom_fields
(type=None, card=None, bank_account=None, **kwargs)[código fonte]¶ if
type
isBANK_ACCOUNT_TYPE
orCARD_TYPE
token iscreated
!set
card
orbank_account
attributes accordingly.else token is
not created
!We must identify token type from attr’s passed searching for
CARD_IDENTIFIER
orBANK_ACCOUNT_IDENTIFIER
. After identifyingtype
if it wasBANK_ACCOUNT_TYPE
setbusiness
orindividual
identifier fromBankAccount
method (which is fromBusinessOrIndividualModel
).Parâmetros: - bank_account (dict or
BankAccount
) – data - card (dict or
Card
) – data - type (str) – type for
token
orbank account
- **kwargs – kwargs
- bank_account (dict or
-
validate_custom_fields
(**kwargs)[código fonte]¶ Valida campos do token.
Se for um token de cartão, valida o
card_number
.Parâmetros: **kwargs – Retorna: Lista com os erros ocorridos (se tiver algum!)
-
6.8. zoop_wrapper.models.transaction module¶
-
class
zoop_wrapper.models.transaction.
History
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Represents a update for
Transaction
-
amount
¶ amount value for the update
??
??
??
??
-
created_at
¶ datetime for the update
-
gatewayResponseTime
¶ ??
-
id
¶ uuid identifier
-
operation_type
¶ type for the update
-
response_code
¶ ??
-
response_message
¶ ??
-
status
¶ status for the update
-
transaction
¶ transaction uuid identifier
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.transaction.
InstallmentPlan
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
-
INSTALLMENT_PLAN_MODES
= {'interest_free', 'with_interest'}¶
-
INTEREST_FREE_MODE
= 'interest_free'¶
-
WITH_INTEREST_MODE
= 'with_interest'¶
-
classmethod
_validate_number_installments
(number_installments)[código fonte]¶ - Esse método verifica se:
- number_installments é inteiro
- number_installments é um valor inteiro entre 1 e 12 incluindo as bordas
Retorna: bool
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
validate_custom_fields
(**kwargs)[código fonte]¶ Método de validação a ser estendido para fazer uma validação especializada.
Esse método originalmente retorna uma lista vazia pois ele serve para ser sobreescrito pelas calsses especializadas adicionando comportamento de validação!
Retorna: Lista de erros a serem levantados.
-
-
class
zoop_wrapper.models.transaction.
PointOfSale
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
Represents something (?)
-
entry_mode
¶ ??
-
identification_number
¶ ??
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
-
class
zoop_wrapper.models.transaction.
Source
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObject
-
CARD_NOT_PRESENT_TYPE
= 'card_not_present_type'¶
-
CARD_PRESENT_TYPE
= 'card_present_type'¶
-
SOURCE_TYPES
= {'card_not_present_type', 'card_present_type'}¶
-
get_all_fields
()[código fonte]¶ Pega
todos os campos
da instância.Retorna: set
de todos os campos
-
classmethod
get_card_not_present_required_fields
()[código fonte]¶ Método get do
set
derequired fields
paraCARD_TYPE
quando o cartão é presente.Retorna: set
de campos
-
classmethod
get_card_present_required_fields
()[código fonte]¶ Método get do
set
denon required fields
paraCARD_TYPE
.Retorna: set
de campos
-
classmethod
get_non_required_fields
() → set[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
get_validation_fields
()[código fonte]¶ Pega
campos de validação
da instâcia.O conjunto de campos é construído com base no
card_type
.Se for
CARD_PRESENT_TYPE
utiliza oget_card_present_required_fields()
.Se não, utiliza o
get_card_not_present_required_fields()
.Retorna: set
de campos para ser validados
-
init_custom_fields
(card=None, type='card', currency='BRL', installment_plan=None, **kwargs)[código fonte]¶ this method exists to set custom attributes such as
ZoopObject
instances. Since all attributes set on__init__()
aredict's
orvariables
.Parâmetros: **kwargs – dictionary of args
-
-
class
zoop_wrapper.models.transaction.
Transaction
(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ResourceModel
Represents a transaction https://docs.zoop.co/reference#transa%C3%A7%C3%A3o
The
RESOURCE
is used to identify this Model. Used to check againstresource
!-
amount
¶ integer amount value in ‘centavos’
Type: int
-
app_transaction_uid
¶ ??
-
business
¶ ??
-
capture
¶ flag que designa se será uma transação simples {true} ou uma composta (com pre autorização) {false} # noqa
Type: bool
-
captured
¶ flag indica se a transação foi capturada ou não
Type: bool
-
confirmed
¶ value of cofirmation
Type: str
-
currency
¶ coin currency string
Type: str
-
customer
¶ customer uuid identifier
Type: str
-
description
¶ value description
Type: str
-
discounts
¶ ??
-
expected_on
¶ datetime string
Type: str
-
fee_details
¶ ??
-
fees
¶ ??
??
-
individual
¶ ??
-
installment_plan
¶ ??
-
location_latitude
¶ ??
-
location_longitude
¶ ??
-
on_behalf_of
¶ seller uuid identifier
Type: str
-
original_amount
¶ original amount value
Type: int
-
payment_type
¶ payment type
Type: str
-
point_of_sale
¶ ??
Type: PointOfSale
??
-
reference_id
¶ ??
-
refunded
¶ boolean of verification
Type: bool
-
refunds
¶ ??
-
rewards
¶ ??
-
sales_receipt
¶
-
statement_descriptor
¶ value description
Type: str
-
status
¶ value for status
Type: str
-
transaction_number
¶ ??
-
voided
¶ boolean of verification
Type: bool
-
BOLETO_TYPE
= 'boleto'¶
-
CARD_TYPE
= 'credit'¶
-
PAYMENT_TYPES
= {'boleto', 'credit'}¶
-
RESOURCE
= 'transaction'¶
-
get_all_fields
()[código fonte]¶ Pega
todos os campos
para instância.O conjunto de campos é construído com base no
get_validation_fields()
com a união doget_non_required_fields()
.Retorna: set
de todos os campos
-
classmethod
get_boleto_required_fields
()[código fonte]¶
-
classmethod
get_card_required_fields
()[código fonte]¶
-
classmethod
get_non_required_fields
()[código fonte]¶ get
set
ofnon required fields
Retorna: set
of fields
-
classmethod
get_required_fields
()[código fonte]¶ get
set
ofrequired fields
Retorna: set
of fields
-
get_validation_fields
()[código fonte]¶ Pega os
campos de validação
para uma instância.O conjunto de campos é feito com base no
payment_type
.Se for
CARD_TYPE
utiliza oget_card_required_fields()
.Se não, ele é
payment_type
éBOLETO_TYPE
! Utiliza oget_boleto_required_fields()
.Retorna: set
de campos para serem validados
-
init_custom_fields
(amount=None, currency='BRL', history=None, id=None, payment_method=None, payment_type=None, point_of_sale=None, source=None, **kwargs)[código fonte]¶ Initialize
payment_method
asCard
orInvoice
based on data.Initialize
point_of_sale
asPointOfSale
.Initialize
history
as list ofHistory
.Parâmetros: - currency (str) – default currency is ‘BRL’. So users may not need to pass currency!
- history (dict or
History
or list of either) – history data. May be a list of dict or list ofHistory
# noqa - payment_method (dict or
Card
orInvoice
) – payment method data # noqa - payment_type (str) – value for payment type
- point_of_sale (dict or
PointOfSale
) – point of sale data - **kwargs – kwargs
-
6.9. zoop_wrapper.models.utils module¶
-
zoop_wrapper.models.utils.
_get_model_class_from_resource
(resource)[código fonte]¶ Get
model class
fromresource
Exemplos
>>> _get_model_class_from_resource('seller') Seller >>> _get_model_class_from_resource('bank_account') BankAccount
Parâmetros: resource (str) – value of resource Raises: ValueError
– when theresource
is not identifiedRetorna: ResourceModel
subclass
-
zoop_wrapper.models.utils.
get_instance_from_data
(data)[código fonte]¶ Factory Pattern
forResourceModel
subclassesExemplos
>>> data = {'resource': 'seller'} >>> get_instance_from_data(data) Seller.from_dict(data) >>> data = {'resource': 'bank_account'} >>> get_instance_from_data(data) BankAccount.from_dict(data)
Parâmetros: data (dict) – data Retorna: ResourceModel
subclass orNone