Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Refatoração em juros, multa e desconto! (#106)
Browse files Browse the repository at this point in the history
* adiciona Fine

* adiciona args no teste

* refatora BillingConfiguration em diversos tipos

* corrige algumas importações

* fmt

* refatora um pouco a base!

* corrige teste

* corrige stubs

* fmt

* corrige exemplo!

* Update zoop_wrapper/models/invoice.py

Co-authored-by: PedroRegisPOAR <pedroalencarregis@hotmail.com>

* Update tests/models/invoice/test_billing_instructions.py

Co-authored-by: PedroRegisPOAR <pedroalencarregis@hotmail.com>

* fmt

* flexibiliza configurações

* fmt

* pip upgrade

* adiciona bdd's

* Update tests/models/invoice/test_billing_instructions.py

Co-authored-by: PedroRegisPOAR <pedroalencarregis@hotmail.com>

* Update tests/models/invoice/test_billing_instructions.py

Co-authored-by: PedroRegisPOAR <pedroalencarregis@hotmail.com>

* Update tests/models/invoice/test_billing_instructions.py

Co-authored-by: PedroRegisPOAR <pedroalencarregis@hotmail.com>

* Update tests/models/invoice/test_billing_instructions.py

Co-authored-by: PedroRegisPOAR <pedroalencarregis@hotmail.com>

* altera um pouco a parametrização de boleto!

Co-authored-by: PedroRegisPOAR <pedroalencarregis@hotmail.com>
  • Loading branch information
rodrigondec and PedroRegisPOAR authored Sep 14, 2020
1 parent bd0da7c commit 71cbd3b
Show file tree
Hide file tree
Showing 21 changed files with 648 additions and 508 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pip.install:
pip install -r requirements-dev.txt
pip install -U -r requirements-dev.txt

pip.install.build:
pip install -r requirements-build.txt
pip install -U -r requirements-build.txt

config.env:
cp .env.sample .env

test:
python -m unittest
python -m unittest $(args)

fmt:
black .
Expand Down
73 changes: 39 additions & 34 deletions examples/data/add_transaction_invoice.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "85b71fbeaa1346169a634e4af5bb86cd",
"id": "9d4f1054607447798e9ce61e2a42d948",
"resource": "transaction",
"status": "pending",
"amount": "10.00",
"original_amount": "10.00",
"amount": "30.00",
"original_amount": "30.00",
"currency": "BRL",
"description": "meu boleto gerado para teste",
"payment_type": "boleto",
Expand All @@ -15,52 +15,57 @@
"discounts": null,
"pre_authorization": null,
"sales_receipt": null,
"on_behalf_of": "27e17b778b404a83bf8e25ec995e2ffe",
"customer": "e7eec0f640c14e21b35d20d58b49b584",
"statement_descriptor": "IMOBANCO BANCO DE COBRANCA IMOBILIARIA LTDA - EPP",
"on_behalf_of": "0e084bb6a60f47e8ac45949d5040eb92",
"customer": "ffe4b7a1f19c4a9da85b6d72c0b6201c",
"statement_descriptor": "Mateus Satiro",
"payment_method": {
"id": "38a2932a929444a699a1a5b97ea0d2fb",
"id": "e77a3d54fc5d4dd9a4741bf6dc8b3c37",
"zoop_boleto_id": null,
"resource": "boleto",
"description": "meu boleto gerado para teste",
"reference_number": "3360906",
"document_number": "3360906",
"expiration_date": "2020-06-20T00:00:00+00:00",
"payment_limit_date": "2020-06-30T00:00:00+00:00",
"recipient": "IMOBANCO BANCO DE COBRANCA IMOBILIARIA LTDA - EPP",
"reference_number": "6199780",
"document_number": "6199780",
"expiration_date": "2020-11-20T00:00:00+00:00",
"payment_limit_date": "2020-11-30T00:00:00+00:00",
"recipient": "Mateus Satiro",
"bank_code": "109",
"customer": "e7eec0f640c14e21b35d20d58b49b584",
"customer": "ffe4b7a1f19c4a9da85b6d72c0b6201c",
"address": null,
"sequence": "63864",
"url": "https://api-boleto-production.s3.amazonaws.com/foo/27e17b778b404a83bf8e25ec995e2ffe/5e8cfef73d502008309b4779.html",
"sequence": "93211",
"url": "https://api-boleto-production.s3.amazonaws.com/foo/0e084bb6a60f47e8ac45949d5040eb92/5f5a5e000d93d708cff3f646.html",
"accepted": false,
"printed": false,
"downloaded": false,
"fingerprint": null,
"paid_at": null,
"uri": "/v1/marketplaces/foo/boletos/38a2932a929444a699a1a5b97ea0d2fb",
"barcode": "34191090323609068893231339210002482920000001000",
"uri": "/v1/marketplaces/foo/boletos/e77a3d54fc5d4dd9a4741bf6dc8b3c37",
"barcode": "34191090651997807893931339210002184450000003000",
"metadata": {},
"created_at": "2020-04-07T19:30:15+00:00",
"updated_at": "2020-04-07T22:30:15+00:00",
"created_at": "2020-09-10T14:10:24+00:00",
"updated_at": "2020-09-10T17:10:24+00:00",
"status": "not_paid",
"billing_instructions": {
"late_fee": {
"mode": "PERCENTAGE",
"start_date": "2020-06-20",
"percentage": "50"
},
"discount": [
{
"mode": "FIXED",
"limit_date": "2020-06-20",
"limit_date": "2020-11-10",
"amount": "200"
},
{
"mode": "FIXED",
"limit_date": "2020-11-20",
"amount": "100"
}
],
"late_fee": {
"mode": "FIXED",
"start_date": null,
"amount": "300"
},
"interest": {
"mode": "MONTHLY_PERCENTAGE",
"start_date": "2020-06-20",
"percentage": "50.5556"
"start_date": null,
"percentage": "1"
}
}
},
Expand All @@ -77,17 +82,17 @@
"fee_details": null,
"location_latitude": null,
"location_longitude": null,
"uri": "/v1/marketplaces/foo/transactions/85b71fbeaa1346169a634e4af5bb86cd",
"uri": "/v1/marketplaces/foo/transactions/9d4f1054607447798e9ce61e2a42d948",
"metadata": {},
"expected_on": "1970-01-01T00:00:00+00:00",
"created_at": "2020-04-07T22:30:14+00:00",
"updated_at": "2020-04-07T22:30:15+00:00",
"created_at": "2020-09-10T17:10:23+00:00",
"updated_at": "2020-09-10T17:10:24+00:00",
"payment_authorization": null,
"history": [
{
"id": "ebd31542e48b44a596fe0cabdaa44f78",
"transaction": "85b71fbeaa1346169a634e4af5bb86cd",
"amount": "10.00",
"id": "a2002ebd3e444ce2bd0ab8b0373af0bc",
"transaction": "9d4f1054607447798e9ce61e2a42d948",
"amount": "30.00",
"operation_type": "created",
"status": "succeeded",
"response_code": null,
Expand All @@ -97,7 +102,7 @@
"authorization_nsu": null,
"gatewayResponseTime": null,
"authorizer": null,
"created_at": "2020-04-07 22:30:14"
"created_at": "2020-09-10 17:10:23"
}
]
}
4 changes: 2 additions & 2 deletions examples/data/retrieve_buyer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"neighborhood": "fooofoo",
"city": "Natal",
"state": "RN",
"postal_code": "59100000",
"postal_code": "59150000",
"country_code": "BR"
},
"delinquent": false,
"payment_methods": null,
"default_debit": null,
"default_credit": null,
"default_receipt_delivery_method": null,
"uri": "/v1/marketplaces/foo/buyers/ffe4b7a1f19c4a9da85b6d72c0b6201c",
"uri": "/v1/marketplaces/d77c2258b51d49269191502695f939f4/buyers/ffe4b7a1f19c4a9da85b6d72c0b6201c",
"metadata": {},
"created_at": "2020-05-04T19:52:02+00:00",
"updated_at": "2020-05-04T19:52:02+00:00"
Expand Down
37 changes: 21 additions & 16 deletions examples/data/retrieve_seller.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"id": "0e084bb6a60f47e8ac45949d5040eb92",
"status": "pending",
"status": "active",
"resource": "seller",
"type": "individual",
"account_balance": "0.00",
"current_balance": "0.00",
"first_name": "foo",
"last_name": "foo",
"email": "foo@bar.com",
"first_name": "Mateus",
"last_name": "Satiro",
"email": "mateus@teste.com.br",
"description": null,
"taxpayer_id": "13543402480",
"phone_number": "+55 84 99999-9999",
"phone_number": "84959595559",
"birthdate": "1994-12-27",
"website": null,
"facebook": null,
"twitter": null,
"address": {
"line1": "foo",
"line1": "Rua Jundia\u00ed",
"line2": "123",
"line3": "barbar",
"neighborhood": "fooofoo",
"line3": "apartamento 200",
"neighborhood": "Tirol",
"city": "Natal",
"state": "RN",
"postal_code": "59100000",
"postal_code": "59020120",
"country_code": "BR"
},
"statement_descriptor": null,
Expand All @@ -33,13 +33,18 @@
"decline_on_fail_zipcode": false,
"delinquent": false,
"payment_methods": null,
"default_debit": null,
"default_debit": "4abf4010cc93414ca585463fdc7b44d6",
"default_credit": null,
"merchant_code": null,
"terminal_code": null,
"uri": "/v1/marketplaces/foo/sellers/individuals/0e084bb6a60f47e8ac45949d5040eb92",
"marketplace_id": "foo",
"metadata": {},
"merchant_code": "GT0000CC",
"terminal_code": "012000021220006",
"uri": "/v1/marketplaces/d77c2258b51d49269191502695f939f4/sellers/individuals/0e084bb6a60f47e8ac45949d5040eb92",
"marketplace_id": "d77c2258b51d49269191502695f939f4",
"metadata": {
"service": "imopay",
"id": "dc12498a-7e81-4fdc-8028-55ab6cc2f92b",
"imopay_id": "31ab5f46-2343-4389-a29a-733ed29da66d"
},
"created_at": "2020-04-27T19:35:55+00:00",
"updated_at": "2020-04-27T19:35:55+00:00"
"updated_at": "2020-06-08T18:50:16+00:00",
"payout_option": "CP"
}
38 changes: 20 additions & 18 deletions examples/transaction/add_transaction_invoice.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os

from zoop_wrapper import (
BillingConfiguration,
Fine,
Interest,
Discount,
BillingInstructions,
Invoice,
Transaction,
Expand All @@ -24,9 +26,10 @@
buyer_or_seller_id = buyer_id


quantia_em_centavos = "1000"
vencimento = "2020-08-20"
limite = "2020-08-30"
quantia_em_centavos = "3000"
vencimento = "2020-11-20"
pre_vencimento = "2020-11-10"
limite = "2020-11-30"

t = Transaction(
amount=quantia_em_centavos,
Expand All @@ -39,22 +42,21 @@
expiration_date=vencimento,
payment_limit_date=limite,
billing_instructions=BillingInstructions(
late_fee=BillingConfiguration(
mode=BillingConfiguration.PERCENTAGE_MODE,
percentage=50,
start_date=vencimento,
late_fee=Fine(
mode=Fine.PERCENTAGE,
percentage=2,
),
interest=BillingConfiguration(
mode=BillingConfiguration.MONTHLY_PERCENTAGE_MODE,
percentage=50.5555555555,
start_date=vencimento,
),
discount=BillingConfiguration(
amount=100,
is_discount=True,
limit_date=vencimento,
mode=BillingConfiguration.FIXED_MODE,
interest=Interest(
mode=Interest.MONTHLY_PERCENTAGE,
percentage=1,
),
discount=[
Discount(
amount=200,
limit_date=pre_vencimento,
mode=Discount.FIXED,
),
],
),
),
)
Expand Down
Loading

0 comments on commit 71cbd3b

Please sign in to comment.