4. Exemplos de vendedor¶
4.1. Criar vendedor empresa¶
import os
from pycpfcnpj import gen
from zoop_wrapper import ZoopWrapper, Seller, Address
from examples.utils import dump_response
"""
Nesse momento as constantes podem ser criadas no arquivo .py.
Mas é recomendado utilizar como variável de ambiente em um '.env'
"""
from zoop_wrapper.constants import MARKETPLACE_ID, ZOOP_KEY
client = ZoopWrapper(marketplace_id=MARKETPLACE_ID, key=ZOOP_KEY)
s = Seller(
business_address=Address(
city="Natal",
country_code="BR",
line1="foo",
line2="123",
line3="barbar",
neighborhood="fooofoo",
postal_code="59100000",
state="RN",
),
business_email="foo",
business_name="foo",
business_opening_date="foo",
business_phone="foo",
business_website="foo",
ein=gen.cnpj(),
)
response = client.add_seller(s)
dump_response(response, os.path.basename(__file__).split(".")[0])
4.2. Criar vendedor PF¶
import os
from pycpfcnpj import gen
from zoop_wrapper import ZoopWrapper, Seller, Address
from examples.utils import dump_response
"""
Nesse momento as constantes podem ser criadas no arquivo .py.
Mas é recomendado utilizar como variável de ambiente em um '.env'
"""
from zoop_wrapper.constants import MARKETPLACE_ID, ZOOP_KEY
client = ZoopWrapper(marketplace_id=MARKETPLACE_ID, key=ZOOP_KEY)
s = Seller(
address=Address(
city="Natal",
country_code="BR",
line1="foo",
line2="123",
line3="barbar",
neighborhood="fooofoo",
postal_code="59100000",
state="RN",
),
birthdate="1994-12-27",
email="foo@bar.com",
first_name="foo",
last_name="foo",
phone_number="+55 84 99999-9999",
taxpayer_id=gen.cpf(),
)
response = client.add_seller(s)
dump_response(response, os.path.basename(__file__).split(".")[0])
4.3. Listar vendedores¶
import os
from zoop_wrapper import ZoopWrapper
from examples.utils import dump_response
"""
Nesse momento as constantes podem ser criadas no arquivo .py.
Mas é recomendado utilizar como variável de ambiente em um '.env'
"""
from zoop_wrapper.constants import MARKETPLACE_ID, ZOOP_KEY
client = ZoopWrapper(marketplace_id=MARKETPLACE_ID, key=ZOOP_KEY)
response = client.list_sellers()
dump_response(response, os.path.basename(__file__).split(".")[0])
4.4. Pegar vendedor¶
import os
from zoop_wrapper import ZoopWrapper
from examples.utils import dump_response
"""
Nesse momento as constantes podem ser criadas no arquivo .py.
Mas é recomendado utilizar como variável de ambiente em um '.env'
"""
from zoop_wrapper.constants import MARKETPLACE_ID, ZOOP_KEY
client = ZoopWrapper(marketplace_id=MARKETPLACE_ID, key=ZOOP_KEY)
seller_id = "0e084bb6a60f47e8ac45949d5040eb92"
response = client.retrieve_seller(seller_id)
dump_response(response, os.path.basename(__file__).split(".")[0])
4.5. Atualizar vendedor¶
import os
from zoop_wrapper import ZoopWrapper, Seller, Address
from examples.utils import dump_response
"""
Nesse momento as constantes podem ser criadas no arquivo .py.
Mas é recomendado utilizar como variável de ambiente em um '.env'
"""
from zoop_wrapper.constants import MARKETPLACE_ID, ZOOP_KEY
client = ZoopWrapper(marketplace_id=MARKETPLACE_ID, key=ZOOP_KEY)
s = Seller(
address=Address(
city="Natal",
country_code="BR",
line1="foo",
line2="123",
line3="barbar",
neighborhood="fooofoo",
postal_code="59100000",
state="RN",
),
birthdate="1994-12-27",
email="foo@bar.com",
first_name="foo",
last_name="bar 2",
phone_number="+55 84 99999-9999",
taxpayer_id="13543402480",
)
seller_id = "0e084bb6a60f47e8ac45949d5040eb92"
response = client.update_seller(seller_id, s)
dump_response(response, os.path.basename(__file__).split(".")[0])
4.6. Remover vendedor¶
import os
from zoop_wrapper import ZoopWrapper
from examples.utils import dump_response
"""
Nesse momento as constantes podem ser criadas no arquivo .py.
Mas é recomendado utilizar como variável de ambiente em um '.env'
"""
from zoop_wrapper.constants import MARKETPLACE_ID, ZOOP_KEY
client = ZoopWrapper(marketplace_id=MARKETPLACE_ID, key=ZOOP_KEY)
seller_id = "79bb6be6ac8a477cbc1d8f79236a0f75"
response = client.remove_seller(seller_id)
dump_response(response, os.path.basename(__file__).split(".")[0])
4.7. Buscar vendedor empresa¶
import os
from zoop_wrapper import ZoopWrapper
from examples.utils import dump_response
"""
Nesse momento as constantes podem ser criadas no arquivo .py.
Mas é recomendado utilizar como variável de ambiente em um '.env'
"""
from zoop_wrapper.constants import MARKETPLACE_ID, ZOOP_KEY
client = ZoopWrapper(marketplace_id=MARKETPLACE_ID, key=ZOOP_KEY)
cnpj = "44431904079819"
response = client.search_business_seller(cnpj)
dump_response(response, os.path.basename(__file__).split(".")[0])
4.8. Buscar vendedor PF¶
import os
from zoop_wrapper import ZoopWrapper
from examples.utils import dump_response
"""
Nesse momento as constantes podem ser criadas no arquivo .py.
Mas é recomendado utilizar como variável de ambiente em um '.env'
"""
from zoop_wrapper.constants import MARKETPLACE_ID, ZOOP_KEY
client = ZoopWrapper(marketplace_id=MARKETPLACE_ID, key=ZOOP_KEY)
cpf = "13543402480"
response = client.search_individual_seller(cpf)
dump_response(response, os.path.basename(__file__).split(".")[0])