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
from py3wirecard import *
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")
Lista
clientes = Customer().list()
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.receivers.append(Receiver(type = 'SECONDARY', feePayor = False, moipAccount = MoipAccount(id='IDCONTA'), amount = Amount(fixed = 10000)))
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")
Metadata
Release files for py3wirecard 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py3wirecard-0.0.4.tar.gz | 14.3 kB | Without provenance | Details for py3wirecard-0.0.4.tar.gz |
Release files / py3wirecard-0.0.4.tar.gz
| Download URL | py3wirecard-0.0.4.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
095da0745c633850f5541272b8eab624d6ed4569bf8dc40e80bdf405dfd79458
|
|
BLAKE2b-256 checksum How to use checksums |
c31afc78d8cedca86016314f9115ac539a4a60f2101ca7595a4f5cfb401985ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for py3wirecard 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.