diff --git a/speid/tasks/transactions.py b/speid/tasks/transactions.py index a6374d4..01fa7bd 100644 --- a/speid/tasks/transactions.py +++ b/speid/tasks/transactions.py @@ -215,7 +215,13 @@ def apply_missing_deposits(fecha_operacion: dt.date) -> List[str]: tipo=TipoTransaccion.deposito, fecha_operacion=fecha_operacion ) claves = {t.clave_rastreo for t in transactions} - missing = [d for d in stp_deposits if d.claveRastreo not in claves] + missing = [ + d + for d in stp_deposits + if d.claveRastreo not in claves + and d.tipoPago not in REFUNDS_PAYMENTS_TYPES + and d.estado in STP_VALID_DEPOSITS_STATUSES + ] for orden in missing: apply_stp_deposit(orden.claveRastreo, fecha_operacion) return [m.claveRastreo for m in missing] diff --git a/tests/tasks/cassettes/test_task_apply_missing_deposits.yaml b/tests/tasks/cassettes/test_task_apply_missing_deposits.yaml index fb48ec2..b0804ae 100644 --- a/tests/tasks/cassettes/test_task_apply_missing_deposits.yaml +++ b/tests/tasks/cassettes/test_task_apply_missing_deposits.yaml @@ -48,88 +48,6 @@ interactions: status: code: 200 message: OK -- request: - body: '{"empresa": "TAMIZI", "claveRastreo": "PruebaDevolucion1", "tipoOrden": - "R", "fechaOperacion": "20231106", "firma": "UosxA4L6RMJ8UevJw7mYleOCYd+rTKiTRaCv07cbyVnVu0JWBjGuDwaFyTEc3rQzK0VDZrcZEmqhL1d4iuK/tdrd0zmdEpT8HbDGM+frs6KBmVrqYxHDAJZ9FBn/698lHl99aB0BAu46EFoH7nzVqRNj2prAYRRiUfIJbPBB350="}' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '291' - Content-Type: - - application/json - User-Agent: - - stpmex-python/3.14.0.dev3 - method: POST - uri: https://efws-dev.stpmex.com/efws/API/consultaOrden - response: - body: - string: '{"estado":0,"mensaje":"Datos consultados correctamente","respuesta":{"idEF":14643667,"claveRastreo":"PruebaDevolucion1","conceptoPago":"Pago - de prueba","cuentaBeneficiario":"646180157018877012","cuentaOrdenante":"646180117200000019","empresa":"TAMIZI","estado":"TCL","fechaOperacion":20231106,"institucionContraparte":90646,"institucionOperante":90646,"medioEntrega":3,"monto":0.01,"nombreBeneficiario":"Beneficiario","nombreOrdenante":"AXEL - SERNA MANRIQUEZ","nombreCep":null,"rfcCep":"TCU200828RX8","sello":null,"rfcCurpBeneficiario":"ND","referenciaNumerica":1234567,"rfcCurpOrdenante":"HESJ871014NZ5","tipoCuentaBeneficiario":40,"tipoCuentaOrdenante":40,"tipoPago":1,"tsCaptura":1699305268142,"tsLiquidacion":1699305273297,"causaDevolucion":16,"urlCEP":null}}' - headers: - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Mon, 06 Nov 2023 21:44:37 GMT - Server: - - nginx - Transfer-Encoding: - - chunked - Vary: - - Origin - - Access-Control-Request-Method - - Access-Control-Request-Headers - status: - code: 200 - message: OK -- request: - body: '{"empresa": "TAMIZI", "claveRastreo": "PruebaDevolucion2", "tipoOrden": - "R", "fechaOperacion": "20231106", "firma": "UbTfWtykquA0ZkoP43h1w7GyexHAQb73l0DGXieule7GkhkKH5qUcKTHbpXcMT9Cp8BAhCowmcqFjqWsPdc96bLuqf6/6i4yF1bP+UOqGdS8V/8Pf3A99daB5nRz2uShYeymxW5wtwsz2SLRxEZqSySnW0W7jwsfOu1qPVOFT/4="}' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '291' - Content-Type: - - application/json - User-Agent: - - stpmex-python/3.14.0.dev3 - method: POST - uri: https://efws-dev.stpmex.com/efws/API/consultaOrden - response: - body: - string: '{"estado":0,"mensaje":"Datos consultados correctamente","respuesta":{"idEF":14643668,"claveRastreo":"PruebaDevolucion2","conceptoPago":"Pago - de prueba","cuentaBeneficiario":"646180157018877012","cuentaOrdenante":"646180117200000019","empresa":"TAMIZI","estado":"TCL","fechaOperacion":20231106,"institucionContraparte":90646,"institucionOperante":90646,"medioEntrega":3,"monto":10.00,"nombreBeneficiario":"Beneficiario","nombreOrdenante":"AXEL - SERNA MANRIQUEZ","nombreCep":null,"rfcCep":"TCU200828RX8","sello":null,"rfcCurpBeneficiario":"ND","referenciaNumerica":1234567,"rfcCurpOrdenante":"HESJ871014NZ5","tipoCuentaBeneficiario":40,"tipoCuentaOrdenante":40,"tipoPago":1,"tsCaptura":1699305322440,"tsLiquidacion":1699305329288,"causaDevolucion":16,"urlCEP":null}}' - headers: - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Mon, 06 Nov 2023 21:44:38 GMT - Server: - - nginx - Transfer-Encoding: - - chunked - Vary: - - Origin - - Access-Control-Request-Method - - Access-Control-Request-Headers - status: - code: 200 - message: OK - request: body: '{"empresa": "TAMIZI", "claveRastreo": "PruebaLiquidacion", "tipoOrden": "R", "fechaOperacion": "20231106", "firma": "FsSYICoZcp7K5dzh/ZHCYKY4Yhww7xuXcR26A49gl2Ts9eEsu5zinhE8d5D4vv/QW4sErCGQaqSh/E0P2FyrFc31onu/MOlfNMScpQNqpqdyDtOtgSWPiUAnZzJa4FCchEee7ipXXcjrLmYYqMNQ2cxtAjJCRLyj3xh0AwY+OnA="}' diff --git a/tests/tasks/cassettes/test_task_apply_missing_deposits_from_the_day_before.yaml b/tests/tasks/cassettes/test_task_apply_missing_deposits_from_the_day_before.yaml index c9ff332..b166004 100644 --- a/tests/tasks/cassettes/test_task_apply_missing_deposits_from_the_day_before.yaml +++ b/tests/tasks/cassettes/test_task_apply_missing_deposits_from_the_day_before.yaml @@ -87,88 +87,6 @@ interactions: status: code: 200 message: OK -- request: - body: '{"empresa": "TAMIZI", "claveRastreo": "PruebaDevolucion1", "tipoOrden": - "R", "fechaOperacion": "20231106", "firma": "UosxA4L6RMJ8UevJw7mYleOCYd+rTKiTRaCv07cbyVnVu0JWBjGuDwaFyTEc3rQzK0VDZrcZEmqhL1d4iuK/tdrd0zmdEpT8HbDGM+frs6KBmVrqYxHDAJZ9FBn/698lHl99aB0BAu46EFoH7nzVqRNj2prAYRRiUfIJbPBB350="}' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '291' - Content-Type: - - application/json - User-Agent: - - stpmex-python/3.14.0.dev3 - method: POST - uri: https://efws-dev.stpmex.com/efws/API/consultaOrden - response: - body: - string: '{"estado":0,"mensaje":"Datos consultados correctamente","respuesta":{"idEF":14643667,"claveRastreo":"PruebaDevolucion1","conceptoPago":"Pago - de prueba","cuentaBeneficiario":"646180157018877012","cuentaOrdenante":"646180117200000019","empresa":"TAMIZI","estado":"TCL","fechaOperacion":20231106,"institucionContraparte":90646,"institucionOperante":90646,"medioEntrega":3,"monto":0.01,"nombreBeneficiario":"Beneficiario","nombreOrdenante":"AXEL - SERNA MANRIQUEZ","nombreCep":null,"rfcCep":"TCU200828RX8","sello":null,"rfcCurpBeneficiario":"ND","referenciaNumerica":1234567,"rfcCurpOrdenante":"HESJ871014NZ5","tipoCuentaBeneficiario":40,"tipoCuentaOrdenante":40,"tipoPago":1,"tsCaptura":1699305268142,"tsLiquidacion":1699305273297,"causaDevolucion":16,"urlCEP":null}}' - headers: - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 07 Nov 2023 00:30:30 GMT - Server: - - nginx - Transfer-Encoding: - - chunked - Vary: - - Origin - - Access-Control-Request-Method - - Access-Control-Request-Headers - status: - code: 200 - message: OK -- request: - body: '{"empresa": "TAMIZI", "claveRastreo": "PruebaDevolucion2", "tipoOrden": - "R", "fechaOperacion": "20231106", "firma": "UbTfWtykquA0ZkoP43h1w7GyexHAQb73l0DGXieule7GkhkKH5qUcKTHbpXcMT9Cp8BAhCowmcqFjqWsPdc96bLuqf6/6i4yF1bP+UOqGdS8V/8Pf3A99daB5nRz2uShYeymxW5wtwsz2SLRxEZqSySnW0W7jwsfOu1qPVOFT/4="}' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '291' - Content-Type: - - application/json - User-Agent: - - stpmex-python/3.14.0.dev3 - method: POST - uri: https://efws-dev.stpmex.com/efws/API/consultaOrden - response: - body: - string: '{"estado":0,"mensaje":"Datos consultados correctamente","respuesta":{"idEF":14643668,"claveRastreo":"PruebaDevolucion2","conceptoPago":"Pago - de prueba","cuentaBeneficiario":"646180157018877012","cuentaOrdenante":"646180117200000019","empresa":"TAMIZI","estado":"TCL","fechaOperacion":20231106,"institucionContraparte":90646,"institucionOperante":90646,"medioEntrega":3,"monto":10.00,"nombreBeneficiario":"Beneficiario","nombreOrdenante":"AXEL - SERNA MANRIQUEZ","nombreCep":null,"rfcCep":"TCU200828RX8","sello":null,"rfcCurpBeneficiario":"ND","referenciaNumerica":1234567,"rfcCurpOrdenante":"HESJ871014NZ5","tipoCuentaBeneficiario":40,"tipoCuentaOrdenante":40,"tipoPago":1,"tsCaptura":1699305322440,"tsLiquidacion":1699305329288,"causaDevolucion":16,"urlCEP":null}}' - headers: - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 07 Nov 2023 00:30:31 GMT - Server: - - nginx - Transfer-Encoding: - - chunked - Vary: - - Origin - - Access-Control-Request-Method - - Access-Control-Request-Headers - status: - code: 200 - message: OK - request: body: '{"empresa": "TAMIZI", "claveRastreo": "PruebaLiquidacion", "tipoOrden": "R", "fechaOperacion": "20231106", "firma": "FsSYICoZcp7K5dzh/ZHCYKY4Yhww7xuXcR26A49gl2Ts9eEsu5zinhE8d5D4vv/QW4sErCGQaqSh/E0P2FyrFc31onu/MOlfNMScpQNqpqdyDtOtgSWPiUAnZzJa4FCchEee7ipXXcjrLmYYqMNQ2cxtAjJCRLyj3xh0AwY+OnA="}'