Skip to content

Commit

Permalink
17411 - don't skip valid cases of reapply payments (#1412)
Browse files Browse the repository at this point in the history
  • Loading branch information
bolyachevets authored Sep 7, 2023
1 parent 90e6f76 commit f1961e0
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions api/namex/resources/payment/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from namex.models import State, User
from namex.resources.name_requests.abstract_nr_resource import AbstractNameRequestResource
from namex.services import EventRecorder
from namex.services.name_request.name_request_state import get_nr_state_actions
from namex.services.name_request.name_request_state import get_nr_state_actions, display_reapply_action
from namex.services.name_request.utils import get_active_payment, has_active_payment
from namex.services.payment.exceptions import PaymentServiceError, SBCPaymentError, SBCPaymentException
from namex.services.payment.models import PaymentRequest
Expand Down Expand Up @@ -403,16 +403,20 @@ def post(self, nr_id, payment_action=NameRequestActions.CREATE.value):
nr_model = self.add_records_to_network_services(nr_model, update_solr)

existing_payment = PaymentDAO.find_by_existing_nr_id(nr_id, payment_action)
if existing_payment :
if existing_payment:
# if we already have a payment record, we can request existing payment status and return it
# get the payment status from Pay API
payment_response = get_payment(existing_payment.payment_token)
return handle_payment_response(payment_action,
payment_response,
existing_payment,
nr_id,
nr_model,
nr_svc)
if payment_action == PaymentDAO.PaymentActions.REAPPLY.value and display_reapply_action(nr_model):
# skip valid cases of REAPPLY, as these potentially can have more than a single instance
pass
else:
payment_response = get_payment(existing_payment.payment_token)
return handle_payment_response(payment_action,
payment_response,
existing_payment,
nr_id,
nr_model,
nr_svc)

json_input = request.get_json()
payment_request = {}
Expand Down

0 comments on commit f1961e0

Please sign in to comment.