286 lines
18 KiB
Python
286 lines
18 KiB
Python
def generate_response(invoice_line_ids):
|
|
assert len(invoice_line_ids) == 1, "the mocked response is for 1 line"
|
|
|
|
for i, line in enumerate(RESPONSE['lines']):
|
|
line['lineCode'] = invoice_line_ids[i].id
|
|
return RESPONSE
|
|
|
|
|
|
RESPONSE = {'header': {'accountId': 'xxxxx',
|
|
'amountCalcType': 'gross',
|
|
'companyLocation': 'xxxxx',
|
|
'documentCode': 'account.move_722',
|
|
'eDocCreatorPerspective': True,
|
|
'eDocCreatorType': 'self',
|
|
'enableCitationWarnings': False,
|
|
'goods': {'class': 'DEVOLUÇÃO DE VENDA',
|
|
'goal': 'Return',
|
|
'idDest': 1,
|
|
'tpImp': '1'},
|
|
'invoicesRefs': [{'documentCode': 'account.move_721',
|
|
'found': True,
|
|
'type': 'documentCode'}],
|
|
'locations': {'entity': {'activitySector': {'code': 'industry'},
|
|
'address': {'cityCode': 4106902,
|
|
'cityName': 'Curitiba',
|
|
'country': 'BRA',
|
|
'countryCode': '0',
|
|
'state': 'PR',
|
|
'zipcode': '80010-010'},
|
|
'federalTaxId': '46044913001778',
|
|
'name': 'DHL Curitiba',
|
|
'suframa': '',
|
|
'taxRegime': 'realProfit',
|
|
'taxesSettings': {'icmsTaxPayer': True},
|
|
'type': 'business'},
|
|
'establishment': {'activitySector': {'ActivitySector_CNAE': {'code': '0111301'},
|
|
'code': 'service'},
|
|
'address': {'cityCode': 4106902,
|
|
'cityName': 'Curitiba',
|
|
'country': 'BRA',
|
|
'countryCode': '0',
|
|
'state': 'PR',
|
|
'zipcode': '80010-010'},
|
|
'federalTaxId': '49.233.848/0001-50',
|
|
'name': 'edu-localizacao18sclo',
|
|
'suframa': '',
|
|
'taxRegime': 'estimatedProfit',
|
|
'taxesSettings': {'cofinsSubjectTo': 'T',
|
|
'csllSubjectTo': 'T',
|
|
'enableCprb': False,
|
|
'icmsTaxPayer': True,
|
|
'pCredSN': 0,
|
|
'pisCofinsAssetCalcBase': 'D',
|
|
'pisCofinsIcmsTaxCreditRelief': False,
|
|
'pisCofinsIcmsTaxCreditReliefMode': {'icms': False,
|
|
'icmsDifaDest': False,
|
|
'icmsDifaDestFcp': False,
|
|
'icmsFcp': False},
|
|
'pisCofinsIcmsTaxRelief': True,
|
|
'pisCofinsIcmsTaxReliefMode': {'icms': True,
|
|
'icmsDifaDest': False,
|
|
'icmsDifaDestFcp': False,
|
|
'icmsFcp': False},
|
|
'pisCofinsReliefZF': False,
|
|
'pisSubjectTo': 'T',
|
|
'reduceIcmsTaxReliefToIPIBase': False},
|
|
'type': 'business'}},
|
|
'messageType': 'goods',
|
|
'operationType': 'salesReturn',
|
|
'subscriptionId': 'xxxxx',
|
|
'transactionDate': '2021-01-01'},
|
|
'input': {'header': {'accountId': 'xxxxx',
|
|
'amountCalcType': 'gross',
|
|
'companyLocation': 'xxxxx',
|
|
'documentCode': 'account.move_722',
|
|
'eDocCreatorPerspective': True,
|
|
'eDocCreatorType': 'self',
|
|
'enableCitationWarnings': False,
|
|
'goods': {},
|
|
'invoicesRefs': [{'documentCode': 'account.move_721',
|
|
'found': True,
|
|
'type': 'documentCode'}],
|
|
'locations': {'entity': {'activitySector': {'code': 'industry'},
|
|
'address': {'cityCode': 4106902,
|
|
'cityName': 'Curitiba',
|
|
'country': 'BRA',
|
|
'countryCode': '0',
|
|
'state': 'PR',
|
|
'zipcode': '80010-010'},
|
|
'federalTaxId': '46044913001778',
|
|
'name': 'DHL Curitiba',
|
|
'suframa': '',
|
|
'taxRegime': 'realProfit',
|
|
'taxesSettings': {'icmsTaxPayer': True},
|
|
'type': 'business'},
|
|
'establishment': {'activitySector': {'ActivitySector_CNAE': {'code': '0111301'},
|
|
'code': 'service'},
|
|
'address': {'cityCode': 4106902,
|
|
'cityName': 'Curitiba',
|
|
'country': 'BRA',
|
|
'countryCode': '0',
|
|
'state': 'PR',
|
|
'zipcode': '80010-010'},
|
|
'federalTaxId': '49.233.848/0001-50',
|
|
'name': 'edu-localizacao18sclo',
|
|
'suframa': '',
|
|
'taxRegime': 'estimatedProfit',
|
|
'taxesSettings': {'cofinsSubjectTo': 'T',
|
|
'csllSubjectTo': 'T',
|
|
'enableCprb': False,
|
|
'icmsTaxPayer': True,
|
|
'pCredSN': 0,
|
|
'pisCofinsAssetCalcBase': 'D',
|
|
'pisCofinsIcmsTaxCreditRelief': False,
|
|
'pisCofinsIcmsTaxCreditReliefMode': {'icms': False,
|
|
'icmsDifaDest': False,
|
|
'icmsDifaDestFcp': False,
|
|
'icmsFcp': False},
|
|
'pisCofinsIcmsTaxRelief': True,
|
|
'pisCofinsIcmsTaxReliefMode': {'icms': True,
|
|
'icmsDifaDest': False,
|
|
'icmsDifaDestFcp': False,
|
|
'icmsFcp': False},
|
|
'pisCofinsReliefZF': False,
|
|
'pisSubjectTo': 'T',
|
|
'reduceIcmsTaxReliefToIPIBase': False},
|
|
'type': 'business'}},
|
|
'messageType': 'goods',
|
|
'operationType': 'salesReturn',
|
|
'subscriptionId': 'xxxxx',
|
|
'transactionDate': '2026-02-05'},
|
|
'lines': [{'freightAmount': 0,
|
|
'goods': {},
|
|
'insuranceAmount': 0,
|
|
'itemCode': '4a4a4a',
|
|
'itemDescriptor': {'cean': '',
|
|
'cest': '',
|
|
'cnae': '0111301',
|
|
'description': '[4a4a4a] Batata frita',
|
|
'hsCode': '02062990',
|
|
'productType': 'FOR PRODUCT',
|
|
'source': '0'},
|
|
'lineAmount': 800,
|
|
'lineCode': 3326,
|
|
'lineTaxedDiscount': 0,
|
|
'lineUnitPrice': 800,
|
|
'numberOfItems': 1,
|
|
'otherCostAmount': 0,
|
|
'overwrite': 'no',
|
|
'referencedItem': {'documentCode': 'account.move_721',
|
|
'lineCode': 3320},
|
|
'useType': 'production'}],
|
|
'version': '3'},
|
|
'lines': [{'cfop': 1201,
|
|
'freightAmount': 0,
|
|
'goods': {'entityIcmsStSubstitute': 'default',
|
|
'subjectToIPIonInbound': True},
|
|
'insuranceAmount': 0,
|
|
'itemCode': '4a4a4a',
|
|
'itemDescriptor': {'cean': '',
|
|
'cest': '',
|
|
'cnae': '0111301',
|
|
'description': '[4a4a4a] Batata frita',
|
|
'hsCode': '02062990',
|
|
'productType': 'FOR PRODUCT',
|
|
'source': '0'},
|
|
'lineAdditionalInfo': '',
|
|
'lineAmount': 800,
|
|
'lineCode': 3326,
|
|
'lineNetFigure': 704,
|
|
'lineTaxedDiscount': 0,
|
|
'lineUnitPrice': 800,
|
|
'numberOfItems': 1,
|
|
'operationType': 'salesReturn',
|
|
'otherCostAmount': 0,
|
|
'overwrite': 'proportional',
|
|
'referencedItem': {'documentCode': 'account.move_721',
|
|
'lineCode': 3320},
|
|
'taxDetails': [{'calcMode': 'rate',
|
|
'cst': '98',
|
|
'exemptionCode': '',
|
|
'jurisdictionName': 'Brazil',
|
|
'jurisdictionType': 'Country',
|
|
'rate': 0,
|
|
'subtotalTaxable': 704,
|
|
'tax': 0,
|
|
'taxImpact': {'accounting': 'none',
|
|
'impactOnFinalPrice': 'Included',
|
|
'impactOnNetAmount': 'Included'},
|
|
'taxType': 'cofins'},
|
|
{'cst': '00',
|
|
'exemptionCode': '',
|
|
'jurisdictionName': 'Paraná',
|
|
'jurisdictionType': 'State',
|
|
'modBC': '3',
|
|
'rate': 12,
|
|
'source': '0',
|
|
'subtotalTaxable': 800,
|
|
'tax': 96,
|
|
'taxImpact': {'accounting': 'asset',
|
|
'impactOnFinalPrice': 'Included',
|
|
'impactOnNetAmount': 'Included'},
|
|
'taxType': 'icms'},
|
|
{'calcMode': 'rate',
|
|
'cst': '01',
|
|
'exemptionCode': '',
|
|
'isCustomCitation': False,
|
|
'jurisdictionName': 'Brazil',
|
|
'jurisdictionType': 'Country',
|
|
'legalTaxClass': 999,
|
|
'rate': 0,
|
|
'subtotalTaxable': 800,
|
|
'tax': 0,
|
|
'taxImpact': {'accounting': 'asset',
|
|
'impactOnFinalPrice': 'Add',
|
|
'impactOnNetAmount': 'Add'},
|
|
'taxType': 'ipiReturned',
|
|
'traceCode': 'C006'},
|
|
{'calcMode': 'rate',
|
|
'cst': '98',
|
|
'exemptionCode': '',
|
|
'jurisdictionName': 'Brazil',
|
|
'jurisdictionType': 'Country',
|
|
'rate': 0,
|
|
'subtotalTaxable': 704,
|
|
'tax': 0,
|
|
'taxImpact': {'accounting': 'none',
|
|
'impactOnFinalPrice': 'Included',
|
|
'impactOnNetAmount': 'Included'},
|
|
'taxType': 'pis'}],
|
|
'useType': 'production'}],
|
|
'processingInfo': {'authMS': 7.7254,
|
|
'calculationMS': 6.5874,
|
|
'duration': '6.587',
|
|
'env': 'sbx',
|
|
'invoiceSubmitMS': 0.0118,
|
|
'retrieveDataMS': 22.106,
|
|
'taxDiscoveryMS': 1.1248,
|
|
'totalMS': 40.2139,
|
|
'versionId': '26.2.1'},
|
|
'summary': {'numberOfLines': 1,
|
|
'taxByType': {'cofins': {'jurisdictions': [{'jurisdictionName': 'Brazil',
|
|
'jurisdictionType': 'Country',
|
|
'tax': 0}],
|
|
'subtotalTaxable': 704,
|
|
'tax': 0},
|
|
'icms': {'jurisdictions': [{'jurisdictionName': 'Paraná',
|
|
'jurisdictionType': 'State',
|
|
'tax': 96}],
|
|
'subtotalTaxable': 800,
|
|
'tax': 96},
|
|
'ipiReturned': {'jurisdictions': [{'jurisdictionName': 'Brazil',
|
|
'jurisdictionType': 'Country',
|
|
'tax': 0}],
|
|
'subtotalTaxable': 800,
|
|
'tax': 0},
|
|
'pis': {'jurisdictions': [{'jurisdictionName': 'Brazil',
|
|
'jurisdictionType': 'Country',
|
|
'tax': 0}],
|
|
'subtotalTaxable': 704,
|
|
'tax': 0}},
|
|
'taxImpactHighlights': {'added': [{'subtotalTaxable': 800,
|
|
'tax': 0,
|
|
'taxType': 'ipiReturned'}],
|
|
'included': [{'subtotalTaxable': 704,
|
|
'tax': 0,
|
|
'taxType': 'cofins'},
|
|
{'subtotalTaxable': 800,
|
|
'tax': 96,
|
|
'taxType': 'icms'},
|
|
{'subtotalTaxable': 704,
|
|
'tax': 0,
|
|
'taxType': 'pis'}],
|
|
'informative': [],
|
|
'subtracted': [],
|
|
'withheld': []},
|
|
'totalFreights': 0,
|
|
'totalInsurances': 0,
|
|
'totalInvoice': 800,
|
|
'totalLineAmounts': 800,
|
|
'totalOtherCosts': 0,
|
|
'totalTaxedDiscounts': 0,
|
|
'totalUnTaxedOtherCosts': 0,
|
|
'totalUntaxedDiscounts': 0},
|
|
'version': '3'}
|