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 of non 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 Or Individual Model

It has dynamic types!

Can be Business or Individual.

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 is BUSINESS_TYPE then call get_business_required_fields() and get_business_non_required_fields()

else type is INDIVIDUAL_TYPE! then call get_individual_required_fields() and get_individual_non_required_fields()

Retorna:set of all fields
classmethod get_business_non_required_fields()[código fonte]

get set of non required fields for BUSINESS_TYPE.

Retorna:set of fields
classmethod get_business_required_fields()[código fonte]

get set of required fields for BUSINESS_TYPE

Retorna:set of fields
classmethod get_individual_non_required_fields()[código fonte]

get set of non required fields for INDIVIDUAL_TYPE

Retorna:set of fields
classmethod get_individual_required_fields()[código fonte]

get set of required fields for INDIVIDUAL_TYPE

Retorna:set of fields
get_type()[código fonte]

get the dynamic type from instance

Retorna:BUSINESS_TYPE or INDIVIDUAL_TYPE
get_type_uri()[código fonte]

get the dynamic type uri for instance based on get_type()

Retorna:uri string for type from URI
get_validation_fields()[código fonte]

Get validation fields for instance.

if type is BUSINESS_TYPE then call get_business_required_fields()

else type is INDIVIDUAL_TYPE! then call get_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 from Seller.init_custom_fields() and BankAccount.init_custom_fields() without getting taxpayer_id or ein 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 of non 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 some marketplace from Zoop.

marketplace_id

identifier string

classmethod get_non_required_fields()[código fonte]

get set of non 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 of non required fields

Retorna:set of fields
init_custom_fields(address=None, **kwargs)[código fonte]

initialize address with Address

Parâmetros:
  • address – dict of data or Address
  • **kwargs – dic of kwargs
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 person

Retorna:string with the full name
classmethod get_non_required_fields()[código fonte]

get set of non required fields

Retorna:set of fields
classmethod get_required_fields()[código fonte]

get set of required fields

Retorna:set of fields
init_custom_fields(address=None, **kwargs)[código fonte]

Initialize address with Address

Parâmetros:
  • address – dict of data or Address
  • **kwargs
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 of non 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 of non 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 of required 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 from get_all_fields() as attributes from kwargs 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 from dict

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 for None

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 um ZoopOject.

Verifica se data já é uma instância da classse ZoopObject or uma subclasse.

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 e Token.

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 of non 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 of required 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 e Token.

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__() are dict's or variables.

Parâmetros:**kwargs – dictionary of args
static is_value_empty(value)[código fonte]

Verify if value passed is considered empty!

value may be None. As we set on __init__():

value = kwargs.get(field_name, None)

value may be {} if it was a ZoopObject with allow_empty!

value may be [{}] if it was a list of ZoopObject’s with allow_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 is None create a new empty dict.

data may be None for the cases we are explicitly calling with allow_empty=True on init_custom_fields() for some custom ZoopObject 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 dict

Retorna: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 campo obrigatório está faltando ou ocorreu algum erro no validate_custom_fields()) e raise_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 against resource!

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 of non required fields

Retorna:set of fields
classmethod get_required_fields()[código fonte]

get set of required fields

Retorna:set of fields
init_custom_fields(type=None, address=None, verification_checklist=None, **kwargs)[código fonte]

Initialize address as Address.

Initialize verification_checklist as BankAccountVerificationModel.

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 – when type is not in TYPES
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 of required 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 against resource!

default_receipt_delivery_method

?

RESOURCE = 'buyer'
classmethod get_non_required_fields()[código fonte]

get set of non 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 against resource!

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 of non required fields

Retorna:set of fields
classmethod get_required_fields()[código fonte]

get set of required fields

Retorna:set of fields
init_custom_fields(verification_checklist=None, **kwargs)[código fonte]

Initialize verification_checklist as CardVerificationChecklist

Parâmetros:
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 of required 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 of required 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 e Token.

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 no get_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 of required 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 of non 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 of non 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 of non required fields

Retorna:set of fields
classmethod get_required_fields()[código fonte]

get set of required fields

Retorna:set of fields
init_custom_fields(billing_instructions=None, **kwargs)[código fonte]

initialize billing_instructions with BillingInstructions

Parâmetros:

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 against resource!

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_address

Optional value

Type:Address
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
owner

Optional value

Type:Person
RESOURCE = 'seller'
full_name

Get full name for the Seller.

If dynamic type is BUSINESS_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 of non required fields for BUSINESS_TYPE

Retorna:set of fields
classmethod get_business_required_fields()[código fonte]

Get set of required fields for BUSINESS_TYPE

Retorna:``set` `of fields
classmethod get_individual_non_required_fields()[código fonte]

Get set of non required fields for INDIVIDUAL_TYPE

Retorna:set of fields
classmethod get_individual_required_fields()[código fonte]

Get set of required fields for INDIVIDUAL_TYPE

Retorna:set of fields
classmethod get_non_required_fields()[código fonte]

get set of non required fields

Retorna:set of fields
classmethod get_required_fields()[código fonte]

get set of required fields

Retorna:set of fields
init_custom_fields(business_address=None, owner=None, **kwargs)[código fonte]

If dynamic type is BUSINESS_TYPE then initialize owner with Person and initialize business_address with Address.

Else dynamic type is INDIVIDUAL_TYPE! Then initialize self with Person.

Parâmetros:
  • business_address (dict or Address) – data
  • owner (dict or Person) – data
  • **kwargs – kwargs
validate_custom_fields(**kwargs)[código fonte]

Caso o vendedor seja BUSINESS_TYPE precisamos validar os campos pelo BusinessOrIndividualModel.

Caso o vendedor seja INDIVIDUAL_TYPE precisamos validar os campos pelo Person.

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 Or Card and a Seller or Buyer. https://docs.zoop.co/reference#token-1

The RESOURCE is used to identify this Model. Used to check against resource!

It has dynamic types!

It can be CARD_TYPE or BANK_ACCOUNT_TYPE.

But before creation it won’t have attribute type. So we need to verify by other attributes. After created on Zoop it will have type.

token_type

value for identified token type

Type:str
type

optional BANK_ACCOUNT_TYPE or CARD_TYPE. It has collision with of BankAccount.type. So we need the above token_type.

Type:str
used

optional value of verification

Type:bool
bank_account

optional value (for created token of ‘bank_account’ type)

Type:BankAccount
card

optional value (for created token of ‘card’ type)

Type:Card
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 of INDIVIDUAL_TYPE

Type:str
ein

identifier for BANK_ACCOUNT_TYPE of BUSINESS_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
card_number

card number for CARD_TYPE

Type:str
expiration_month

month of expiration for CARD_TYPE

Type:str
expiration_year

year of expiration for CARD_TYPE

Type:str
security_code

security code for CARD_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 is get_validation_fields()

if token_type is CARD_TYPE return fields union get_card_non_required_fields().

else token_type is BANK_ACCOUNT_TYPE return fields union get_bank_account_non_required_fields().

Retorna:set of all fields
classmethod get_bank_account_non_required_fields()[código fonte]

Get set of non required fields for BANK_ACCOUNT_TYPE

Retorna:set of fields
classmethod get_bank_account_required_fields()[código fonte]

get set of required fields for BANK_ACCOUNT_TYPE

Retorna:set of fields
get_bank_account_type()[código fonte]

Get bank account type for creation token of :class:`.BankAccount.

Raises:TypeError – when called from a token not from ‘bank_account’ type
Retorna:value with bank_account type
classmethod get_card_non_required_fields()[código fonte]

Get set of non required fields for CARD_TYPE.

Retorna:set of fields
classmethod get_card_required_fields()[código fonte]

Get set of required fields for CARD_TYPE.

Retorna:set of fields
classmethod get_non_required_fields()[código fonte]

get set of non required fields

Retorna:set of fields
get_validation_fields()[código fonte]

Get validation fields for instance.

if token_type is CARD_TYPE card return get_card_required_fields().

else token_type is BANK_ACCOUNT_TYPE! fields is get_bank_account_required_fields().

if bank account type is INDIVIDUAL_TYPE return fields union get_individual_required_fields().

else bank account type is BUSINESS_TYPE return fields union get_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 is BANK_ACCOUNT_TYPE or CARD_TYPE token is created!

set card or bank_account attributes accordingly.

else token is not created!

We must identify token type from attr’s passed searching for CARD_IDENTIFIER or BANK_ACCOUNT_IDENTIFIER. After identifying type if it was BANK_ACCOUNT_TYPE set business or individual identifier from BankAccount method (which is from BusinessOrIndividualModel).

Parâmetros:
  • bank_account (dict or BankAccount) – data
  • card (dict or Card) – data
  • type (str) – type for token or bank account
  • **kwargs – kwargs
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

authorization_code

??

authorization_nsu

??

authorizer

??

authorizer_id

??

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 of non 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 of required 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 of non 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 de required fields para CARD_TYPE quando o cartão é presente.

Retorna:set de campos
classmethod get_card_present_required_fields()[código fonte]

Método get do set de non required fields para CARD_TYPE.

Retorna:set de campos
classmethod get_non_required_fields() → set[código fonte]

get set of non required fields

Retorna:set of fields
classmethod get_required_fields()[código fonte]

get set of required 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 o get_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__() are dict's or variables.

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 against resource!

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

??

gateway_authorizer

??

history

transaction updates

Type:list of History
individual

??

installment_plan

??

location_latitude

??

location_longitude

??

on_behalf_of

seller uuid identifier

Type:str
original_amount

original amount value

Type:int
payment_method

payment method used

Type:Card or Invoice
payment_type

payment type

Type:str
point_of_sale

??

Type:PointOfSale
pre_authorization

??

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 do get_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 of non required fields

Retorna:set of fields
classmethod get_required_fields()[código fonte]

get set of required 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 o get_card_required_fields().

Se não, ele é payment_type é BOLETO_TYPE! Utiliza o get_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 as Card or Invoice based on data.

Initialize point_of_sale as PointOfSale.

Initialize history as list of History.

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 of History # noqa
  • payment_method (dict or Card or Invoice) – 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 from resource

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 the resource is not identified
Retorna:ResourceModel subclass
zoop_wrapper.models.utils.get_instance_from_data(data)[código fonte]

Factory Pattern for ResourceModel subclasses

Exemplos

>>> 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 or None