Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2372, 23508 - redirect to direct pay, API and UI updates #282

Merged
merged 4 commits into from
Oct 30, 2024

Conversation

hfekete
Copy link
Collaborator

@hfekete hfekete commented Oct 30, 2024

Issue #:2372 /bcgov/entity#2372
Issue #:23508 /bcgov/entity#23508

Description of changes:
API updates:

  • removed check for user being mandatory premium
  • updated return from handler and from endpoint to include data about payment and invoice id (needed for cc)

UI updates:

  • added ability to understand additional API return values
  • redirecting UI to direct pay when payment is required

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the PPR license (Apache 2.0).

@hfekete hfekete self-assigned this Oct 30, 2024
@hfekete hfekete requested a review from kialj876 October 30, 2024 03:42
Copy link
Collaborator

@kialj876 kialj876 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, this looks good 👍

@@ -126,7 +126,8 @@ def json(self):
'submissionDate': self.submission_date.isoformat(),
'expiryDate': self.expiry_date.isoformat() if self.expiry_date else None,
'outputFileKey': self._output_file_key,
'submitter': self.submitter.display_name if self.submitter else None
'submitter': self.submitter.display_name if self.submitter else None,
'paymentToken': self.payment_token
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you just add a comment here that this is the 'invoice id' from the pay db

@pytest.mark.parametrize('test_name,mock_response,is_payment_completion_date_expected', [
('test_pad_invoice', {'id': 123, 'paymentMethod': 'PAD'}, True),
('test_pad_invoice', {'id': 123, 'paymentMethod': 'DIRECT_PAY'}, False)])
def test_create_invoice(client, session, jwt, mocker, test_name, mock_response, is_payment_completion_date_expected):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@@ -70,18 +70,22 @@ def create_invoice(document_access_request: DocumentAccessRequest, user_jwt: Jwt
header, business_json)

if payment_response.status_code in (HTTPStatus.OK, HTTPStatus.CREATED):
payment_completion_date = datetime.utcnow()
is_pad = payment_response.json().get('paymentMethod') == 'PAD'
today_utc = datetime.utcnow()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datetime.now(tz=timezone.utc)
datetime.utcnow() = depreciated

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, pycharm shows the same !
I wasn't sure about updating it in just one place, but you are right. When changing the code, update it in place I changed if it does not break everything else :D

@@ -37,10 +37,6 @@ def validate_document_access_request(document_access_request_json: dict, account
if not account_org:
validation_errors.append({'error': 'Invalid Account'})

if account_org.get('orgType') != 'PREMIUM':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo!

Copy link
Contributor

@seeker25 seeker25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hfekete hfekete merged commit edf7ce8 into bcgov:main Oct 30, 2024
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants