Skip to main content

Wirecard API v2 Wrapper

Project description

Wirecard API v2 Wrapper - Python3

Integração com a API v2 de pagamentos e notificações da Wirecard utilizando requests.

Consulte a documentação oficial e as referências API v2 Wirecard

Instalação

Instalação utilizando Pip

pip install py3wirecard

Git/Clone

git clone https://github.com/robertons/py3wirecard
cd py3wirecard
pip install -r requirements.txt
python setup.py install

Configuração

import py3wirecard

WireCard("API TOKEN", "API KEY",sandbox=True)

Cliente

Cadastro

cliente = Customer()
cliente.ownId = "1201"
cliente.fullname = "Fulando da Silva"
cliente.email = "fulano@email.com"
cliente.birthDate = datetime(1980,1,1)
cliente.taxDocument = TaxDocument(type="CPF", number = "000000000")
cliente.shippingAddress = Address(street= "Nome da Rua", streetNumber="01", complement="SN", district="Bairro", city="Cidade", state="UF", zipCode=00000000, country="BRA")
cliente.phone = Phone(countryCode=55, areaCode=11, number=999999999)
cliente.create()

Consulta

cliente = Customer().get("CUS-PCVTIJ37EWBZ")

Atualização

Para atualizar um cliente basta criar um novo pedido com os dados do cliente existente informando seu id ou ownId.

Pedido

Cadastro

compra = Order()
compra.ownId = "1234"
compra.amount = Amount()
compra.items.append(Product(product="Nome Produto", detail="Descrição Produto", quantity=1, price=23999))
compra.customer = Customer()
compra.customer.ownId = "1201"
compra.customer.fullname = "Fulando da Silva"
compra.customer.email = "fulano@email.com"
compra.customer.birthDate = datetime(1980,1,1)
compra.customer.taxDocument = TaxDocument(type="CPF", number = "000000000")
compra.customer.shippingAddress = Address(street= "Nome da Rua", streetNumber="01", complement="SN", district="Bairro", city="Cidade", state="UF", zipCode=00000000, country="BRA")
compra.customer.phone = Phone(countryCode=55, areaCode=11, number=999999999)
compra.shippingAddress = Address(street= "Nome da Rua", streetNumber="01", complement="SN", district="Bairro", city="Cidade", state="UF", zipCode=00000000, country="BRA")
compra.create()

Consulta

compra = Order().get("ORD-01KHBJSQ9QB0")

Pagamento

pagamento = Payment()
pagamento.fundingInstrument = FundingInstrument(method = "CREDIT_CARD")

Cartão de Crédito (hash)

pagamento.fundingInstrument.creditCard = CreditCard(hash = "HASH...", holder = Holder(fullname = "Fulando da Silva", TaxDocument(type="CPF", number = "000000000"), phone =  Phone(countryCode=55, areaCode=11, number=999999999), birthdate =  datetime(1980,1,1)))

Cartão de Crédito (dados) (Necessário certificação PCI)

pagamento.fundingInstrument.creditCard = CreditCard(number="5555666677778884", expirationMonth="06", expirationYear="2022", cvc="123", holder = Holder(fullname = "Fulando da Silva", TaxDocument(type="CPF", number = "000000000"), phone =  Phone(countryCode=55, areaCode=11, number=999999999), birthdate =  datetime(1980,1,1)))

Envio do Pagamento

pagamento.create(order_id="ORD-01F0UADQ9QB0")

Consulta

pagamento = Payment().get("PAY-1A24BB9K8DX4")

Reembolso

Completo de Pagamento

reembolso = Refund().create("PAY-1W24IB9J0DX4")

Parcial de Pagamento

reembolso = Refund().create("PAY-U67EYCMPR8C4", amount=1000)

Completo de Compra

reembolso = Refund().create("ORD-01F8CQ9QB0")

Parcial de Compra

reembolso = Refund().create("ORD-01F8CQ9QB0", amount=1000)

Consulta

reembolso = Refund().get("REF-VRK1K0N6GOXA")

Notificações

Cadastro de Preferências de Notificações

notificacoes.events = [
            "ORDER.*",
            "PAYMENT.AUTHORIZED",
            "PAYMENT.CANCELLED"
            ]
notificacoes.target = "https://myapi.com/notifications"
notificacoes.media = "WEBHOOK"
notificacoes.create()

Consulta

notificacao = Notification().get("NPR-S1VEAS06KBAXA")

Lista Preferências de Notificações

notificacoes = Notification().list()

Excluir Preferências de Notificações

Notification().delete("NPR-U18BA1ME2MTB")

Webhooks

Consultar Webhooks enviados com Código Identificador do Evento

webhooks = WebHooks().get("ORD-01F0UJSQ9QB0")

Consultar Todos Webhooks enviados

webhooks = WebHooks().get()

Reenviar Webhook

webhook = WebHooks().resend(resource_id="PAY-U67EYHGCR8C4", event="PAYMENT.AUTHORIZED")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py3wirecard-0.0.2.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file py3wirecard-0.0.2.tar.gz.

File metadata

  • Download URL: py3wirecard-0.0.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for py3wirecard-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ab9b308e8904be401cc1efc9cba51c54120ea49ca7a68135520ca28c1672ac7e
MD5 cd7013bf2a3d505d5d42cb2bfca3c20a
BLAKE2b-256 24ce6dd4c835966429a8582b66076c133e3de188da35921a646be77eead6de1a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page