Skip to content

Commit

Permalink
Add in receipt for skip payment bug - Small EFT tweak for pay-queue (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 authored Dec 12, 2024
1 parent 958f1c3 commit f5bedd9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pay-api/src/pay_api/services/payment_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Service class to control all the operations related to Payment."""
import uuid
from datetime import datetime, timezone
from decimal import Decimal
from threading import Thread
from typing import Any, Dict, Tuple
Expand All @@ -20,6 +22,7 @@

from pay_api.exceptions import BusinessException
from pay_api.factory.payment_system_factory import PaymentSystemFactory
from pay_api.models.receipt import Receipt
from pay_api.utils.constants import EDIT_ROLE
from pay_api.utils.enums import InvoiceReferenceStatus, InvoiceStatus, LineItemStatus, PaymentMethod, PaymentStatus
from pay_api.utils.errors import Error
Expand Down Expand Up @@ -166,6 +169,12 @@ def _handle_invoice(cls, invoice, invoice_reference, pay_service, skip_payment):
invoice_reference = InvoiceReference.create(invoice.id, generate_transaction_number(invoice.id), None)
invoice_reference.status_code = InvoiceReferenceStatus.COMPLETED.value
invoice_reference.save()
Receipt(
receipt_number=f"SP-{uuid.uuid4()}",
receipt_amount=invoice.total,
invoice_id=invoice_reference.invoice_id,
receipt_date=datetime.now(tz=timezone.utc),
).save()
Payment.create(
payment_method=pay_service.get_payment_method_code(),
payment_system=pay_service.get_payment_system_code(),
Expand Down
3 changes: 3 additions & 0 deletions pay-queue/src/pay_queue/services/payment_reconciliations.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ def _process_unconsolidated_invoices(row, error_messages: List[Dict[str, any]])
if (target_txn := _get_row_value(row, Column.TARGET_TXN)) == TargetTransaction.INV.value:
inv_number = _get_row_value(row, Column.TARGET_TXN_NO)

if _get_row_value(row, Column.SOURCE_TXN) == SourceTransaction.EFT_WIRE.value:
return has_errors

inv_references: List[InvoiceReferenceModel] = (
db.session.query(InvoiceReferenceModel)
.filter(InvoiceReferenceModel.status_code == InvoiceReferenceStatus.ACTIVE.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ def test_pad_reversal_reconciliations(session, app, client):
assert ReceiptModel.find_by_id(receipt_id2) is None


@pytest.mark.skip(reason="This is handled in the eft-job, similar to routing slips.")
@pytest.mark.asyncio
async def test_eft_wire_reconciliations(session, app, client):
"""Test Reconciliations worker."""
Expand Down

0 comments on commit f5bedd9

Please sign in to comment.