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.ZoopObjectRepresents 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
setofnon required fieldsRetorna: setof fields
-
-
class
zoop_wrapper.models.base.BusinessOrIndividualModel(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.MarketPlaceModelRepresents a
BusinessOrIndividualModelIt has
dynamic types!Can be
BusinessorIndividual.-
taxpayer_id¶ cpf válido para
typeINDIVIDUAL_TYPE
-
ein¶ cnpj para
typeBUSINESS_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 fieldsfor instance.if
typeisBUSINESS_TYPEthen callget_business_required_fields()andget_business_non_required_fields()else
typeisINDIVIDUAL_TYPE! then callget_individual_required_fields()andget_individual_non_required_fields()Retorna: setof all fields
-
classmethod
get_business_non_required_fields()[código fonte]¶ get
setofnon required fieldsforBUSINESS_TYPE.Retorna: setof fields
-
classmethod
get_business_required_fields()[código fonte]¶ get
setofrequired fieldsforBUSINESS_TYPERetorna: setof fields
-
classmethod
get_individual_non_required_fields()[código fonte]¶ get
setofnon required fieldsforINDIVIDUAL_TYPERetorna: setof fields
-
classmethod
get_individual_required_fields()[código fonte]¶ get
setofrequired fieldsforINDIVIDUAL_TYPERetorna: setof fields
-
get_type()[código fonte]¶ get the
dynamic typefrom instanceRetorna: BUSINESS_TYPEorINDIVIDUAL_TYPE
-
get_type_uri()[código fonte]¶ get the
dynamic type urifor instance based onget_type()Retorna: uri string for type from URI
-
get_validation_fields()[código fonte]¶ Get
validation fieldsfor instance.if
typeisBUSINESS_TYPEthen callget_business_required_fields()else
typeisINDIVIDUAL_TYPE! then callget_individual_required_fields()Retorna: setof 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_idou (ou exclusivo)ein. Exatamente um deles deve ser passado e válido, e não os dois.kwargsare there to be called fromSeller.init_custom_fields()andBankAccount.init_custom_fields()without gettingtaxpayer_idoreinvariables.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: ValidationErrorquando é 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.ZoopObjectHave 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
setofnon required fieldsRetorna: setof fields
-
-
class
zoop_wrapper.models.base.MarketPlaceModel(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ResourceModelThis class represents a
ResourceModelwhich belongs to somemarketplacefromZoop.-
marketplace_id¶ identifier string
-
classmethod
get_non_required_fields()[código fonte]¶ get
setofnon required fieldsRetorna: setof fields
-
-
class
zoop_wrapper.models.base.PaymentMethod(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ResourceModelHave some payment method attributes
-
description¶ text description
-
customer¶ uuid id
-
address¶ Address Model
-
classmethod
get_non_required_fields()[código fonte]¶ get
setofnon required fieldsRetorna: setof fields
-
init_custom_fields(address=None, **kwargs)[código fonte]¶ initialize
addresswithAddressParâ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.ZoopObjectRepresents 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 nameof the personRetorna: string with the full name
-
classmethod
get_non_required_fields()[código fonte]¶ get
setofnon required fieldsRetorna: setof fields
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof fields
-
init_custom_fields(address=None, **kwargs)[código fonte]¶ Initialize
addresswithAddressParâmetros: - address – dict of data or
Address - **kwargs –
- address – dict of data or
-
validate_custom_fields(**kwargs)[código fonte]¶ O
taxpayer_idprecisa 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.ZoopObjectRepresents 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
setofnon required fieldsRetorna: setof fields
-
-
class
zoop_wrapper.models.base.SocialModel(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObjectHave social sites uri’s
-
facebook¶ facebook profile url?
-
twitter¶ twitter profile url?
-
classmethod
get_non_required_fields()[código fonte]¶ get
setofnon required fieldsRetorna: setof fields
-
-
class
zoop_wrapper.models.base.VerificationModel(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ZoopObjectHave some verification attributes.
-
postal_code_check¶ boolean of verification
-
address_line1_check¶ boolean of verification
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof fields
-
-
class
zoop_wrapper.models.base.ZoopObject(allow_empty=False, **kwargs)[código fonte]¶ Base:
objectThis class represent a bare Zoop object.
-
_allow_empty¶ boolean
-
__init__(allow_empty=False, **kwargs)[código fonte]¶ initialize
all fieldsfromget_all_fields()asattributesfromkwargson 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
classfromdictParâ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 forNoneRetorna: 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
datapode ser um dict ou umZoopOject.Verifica se
datajá é uma instância da classseZoopObjector 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,FineeToken.O padrão é
get_validation_fields()+get_non_required_fields().Retorna: setde todos os campos
-
classmethod
get_non_required_fields()[código fonte]¶ get
setofnon required fieldsRetorna: setof 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
setofrequired fieldsRetorna: setof 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,FineeToken.O padrão é
get_required_fields().Retorna: setde campos para serem utilizados na validação
-
init_custom_fields(**kwargs)[código fonte]¶ this method exists to set custom attributes such as
ZoopObjectinstances. Since all attributes set on__init__()aredict'sorvariables.Parâmetros: **kwargs – dictionary of args
-
static
is_value_empty(value)[código fonte]¶ Verify if
valuepassed is consideredempty!valuemay beNone. As we set on__init__():value = kwargs.get(field_name, None)
valuemay be{}if it was aZoopObjectwith allow_empty!valuemay be[{}]if it was alistofZoopObject’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
kwargsif
dataisNonecreate anew empty dict.datamay beNonefor the cases we are explicitly calling withallow_empty=Trueoninit_custom_fields()for some customZoopObjectinstance 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
selfto 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éTruenã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: ValidationErrorse (algum campoobrigatórioestá 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.BusinessOrIndividualModelRepresent a Bank Account. https://docs.zoop.co/reference#conta-banc%C3%A1ria
The
RESOURCEis 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
setofnon required fieldsRetorna: setof fields
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof fields
-
init_custom_fields(type=None, address=None, verification_checklist=None, **kwargs)[código fonte]¶ Initialize
addressasAddress.Initialize
verification_checklistasBankAccountVerificationModel.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
typeParâmetros: type (str) – value of type to be validated Raises: ValidationError– whentypeis not inTYPES
-
-
class
zoop_wrapper.models.bank_account.BankAccountVerificationModel(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.VerificationModelHave some bank account verification attributes.
-
deposit_check¶ boolean of verification
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof 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.FinancialModelRepresent a buyer. https://docs.zoop.co/reference#comprador-1
The
RESOURCEis used to identify this Model. Used to check againstresource!-
default_receipt_delivery_method¶ ?
-
RESOURCE= 'buyer'¶
-
classmethod
get_non_required_fields()[código fonte]¶ get
setofnon required fieldsRetorna: setof fields
-
validate_custom_fields(**kwargs)[código fonte]¶ O
taxpayer_idprecisa 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.PaymentMethodRepresent a Card. https://docs.zoop.co/reference#cart%C3%A3o
The
RESOURCEis 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
setofnon required fieldsRetorna: setof fields
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof fields
-
init_custom_fields(verification_checklist=None, **kwargs)[código fonte]¶ Initialize
verification_checklistasCardVerificationChecklistParâ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.VerificationModelRepresent a credit card verification
-
security_code_check¶ boolean of verification
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof 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.ZoopObjectUm 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
setofrequired fieldsRetorna: setof 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,FineeToken.O padrão é
get_required_fields().Retorna: setde campos para serem utilizados na validação
-
init_custom_fields(mode=None, **kwargs)[código fonte]¶ É necessário configurar o
modeantes 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.ZoopObjectRepresents 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: setde 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.BaseModeObjectRepresenta 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
setofrequired fieldsRetorna: setof fields
-
-
class
zoop_wrapper.models.invoice.Fine(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.invoice.BaseModeObjectRepresenta 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
setofnon required fieldsRetorna: setof fields
-
-
class
zoop_wrapper.models.invoice.Interest(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.invoice.BaseModeObjectRepresenta 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
setofnon required fieldsRetorna: setof fields
-
-
class
zoop_wrapper.models.invoice.Invoice(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.PaymentMethodRepresents 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
setofnon required fieldsRetorna: setof fields
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof fields
-
init_custom_fields(billing_instructions=None, **kwargs)[código fonte]¶ initialize
billing_instructionswithBillingInstructionsParâ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.SocialModelRepresent a seller. https://docs.zoop.co/reference#vendedor-1
The
RESOURCEis 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 namefor theSeller.If
dynamic typeisBUSINESS_TYPEit 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
setofnon required fieldsforBUSINESS_TYPERetorna: setof fields
-
classmethod
get_business_required_fields()[código fonte]¶ Get
setofrequired fieldsforBUSINESS_TYPERetorna: ``set` `of fields
-
classmethod
get_individual_non_required_fields()[código fonte]¶ Get
setofnon required fieldsforINDIVIDUAL_TYPERetorna: setof fields
-
classmethod
get_individual_required_fields()[código fonte]¶ Get
setofrequired fieldsforINDIVIDUAL_TYPERetorna: setof fields
-
classmethod
get_non_required_fields()[código fonte]¶ get
setofnon required fieldsRetorna: setof fields
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof fields
-
init_custom_fields(business_address=None, owner=None, **kwargs)[código fonte]¶ If
dynamic typeisBUSINESS_TYPEthen initializeownerwithPersonand initializebusiness_addresswithAddress.Else
dynamic typeisINDIVIDUAL_TYPE! Then initializeselfwithPerson.Parâmetros:
-
validate_custom_fields(**kwargs)[código fonte]¶ Caso o vendedor seja
BUSINESS_TYPEprecisamos validar os campos peloBusinessOrIndividualModel.Caso o vendedor seja
INDIVIDUAL_TYPEprecisamos 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.ResourceModelToken is a resource used to link a
BankAccountOrCardand aSellerorBuyer. https://docs.zoop.co/reference#token-1The
RESOURCEis used to identify this Model. Used to check againstresource!It has
dynamic types!It can be
CARD_TYPEorBANK_ACCOUNT_TYPE.But before
creationit won’t have attributetype. So we need to verify byother attributes. Aftercreatedon Zoop it will havetype.-
token_type¶ value for identified token
typeType: str
-
type¶ optional
BANK_ACCOUNT_TYPEorCARD_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
createdtoken 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_TYPEType: str
-
taxpayer_id¶ identifier for
BANK_ACCOUNT_TYPEofINDIVIDUAL_TYPEType: str
-
ein¶ identifier for
BANK_ACCOUNT_TYPEofBUSINESS_TYPEType: str
-
bank_code¶ bank code for
BANK_ACCOUNT_TYPEType: str
-
routing_number¶ agency code in BR for
BANK_ACCOUNT_TYPEType: 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 fieldsfor instance.fieldsisget_validation_fields()if
token_typeisCARD_TYPEreturnfieldsunionget_card_non_required_fields().else
token_typeisBANK_ACCOUNT_TYPEreturnfieldsunionget_bank_account_non_required_fields().Retorna: setof all fields
-
classmethod
get_bank_account_non_required_fields()[código fonte]¶ Get
setofnon required fieldsforBANK_ACCOUNT_TYPERetorna: setof fields
-
classmethod
get_bank_account_required_fields()[código fonte]¶ get
setofrequired fieldsforBANK_ACCOUNT_TYPERetorna: setof fields
-
get_bank_account_type()[código fonte]¶ Get
bank account typeforcreation tokenof :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
setofnon required fieldsforCARD_TYPE.Retorna: setof fields
-
classmethod
get_card_required_fields()[código fonte]¶ Get
setofrequired fieldsforCARD_TYPE.Retorna: setof fields
-
classmethod
get_non_required_fields()[código fonte]¶ get
setofnon required fieldsRetorna: setof fields
-
get_validation_fields()[código fonte]¶ Get
validation fieldsfor instance.if
token_typeisCARD_TYPEcard returnget_card_required_fields().else
token_typeisBANK_ACCOUNT_TYPE!fieldsisget_bank_account_required_fields().if
bank account typeisINDIVIDUAL_TYPEreturnfieldsunionget_individual_required_fields().else
bank account typeisBUSINESS_TYPEreturnfieldsunionget_business_required_fields().Retorna: setof fields to be validated
-
init_custom_fields(type=None, card=None, bank_account=None, **kwargs)[código fonte]¶ if
typeisBANK_ACCOUNT_TYPEorCARD_TYPEtoken iscreated!set
cardorbank_accountattributes accordingly.else token is
not created!We must identify token type from attr’s passed searching for
CARD_IDENTIFIERorBANK_ACCOUNT_IDENTIFIER. After identifyingtypeif it wasBANK_ACCOUNT_TYPEsetbusinessorindividualidentifier fromBankAccountmethod (which is fromBusinessOrIndividualModel).Parâmetros: - bank_account (dict or
BankAccount) – data - card (dict or
Card) – data - type (str) – type for
tokenorbank 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.ZoopObjectRepresents 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
setofnon required fieldsRetorna: setof 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
setofrequired fieldsRetorna: setof 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.ZoopObjectRepresents something (?)
-
entry_mode¶ ??
-
identification_number¶ ??
-
classmethod
get_non_required_fields()[código fonte]¶ get
setofnon required fieldsRetorna: setof 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 camposda instância.Retorna: setde todos os campos
-
classmethod
get_card_not_present_required_fields()[código fonte]¶ Método get do
setderequired fieldsparaCARD_TYPEquando o cartão é presente.Retorna: setde campos
-
classmethod
get_card_present_required_fields()[código fonte]¶ Método get do
setdenon required fieldsparaCARD_TYPE.Retorna: setde campos
-
classmethod
get_non_required_fields() → set[código fonte]¶ get
setofnon required fieldsRetorna: setof fields
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof fields
-
get_validation_fields()[código fonte]¶ Pega
campos de validaçãoda instâcia.O conjunto de campos é construído com base no
card_type.Se for
CARD_PRESENT_TYPEutiliza oget_card_present_required_fields().Se não, utiliza o
get_card_not_present_required_fields().Retorna: setde 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
ZoopObjectinstances. Since all attributes set on__init__()aredict'sorvariables.Parâmetros: **kwargs – dictionary of args
-
-
class
zoop_wrapper.models.transaction.Transaction(allow_empty=False, **kwargs)[código fonte]¶ Base:
zoop_wrapper.models.base.ResourceModelRepresents a transaction https://docs.zoop.co/reference#transa%C3%A7%C3%A3o
The
RESOURCEis 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 campospara instância.O conjunto de campos é construído com base no
get_validation_fields()com a união doget_non_required_fields().Retorna: setde 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
setofnon required fieldsRetorna: setof fields
-
classmethod
get_required_fields()[código fonte]¶ get
setofrequired fieldsRetorna: setof fields
-
get_validation_fields()[código fonte]¶ Pega os
campos de validaçãopara uma instância.O conjunto de campos é feito com base no
payment_type.Se for
CARD_TYPEutiliza oget_card_required_fields().Se não, ele é
payment_typeéBOLETO_TYPE! Utiliza oget_boleto_required_fields().Retorna: setde 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_methodasCardorInvoicebased on data.Initialize
point_of_saleasPointOfSale.Initialize
historyas list ofHistory.Parâmetros: - currency (str) – default currency is ‘BRL’. So users may not need to pass currency!
- history (dict or
Historyor list of either) – history data. May be a list of dict or list ofHistory# noqa - payment_method (dict or
CardorInvoice) – 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 classfromresourceExemplos
>>> _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 theresourceis not identifiedRetorna: ResourceModelsubclass
-
zoop_wrapper.models.utils.get_instance_from_data(data)[código fonte]¶ Factory PatternforResourceModelsubclassesExemplos
>>> 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: ResourceModelsubclass orNone