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

Update Purchase API v2 #122

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

jonasanker
Copy link
Member

Closes #120 , #121

@jonasanker jonasanker added the api-v2 Related to new API version 2 label Dec 28, 2022
@jonasanker jonasanker requested a review from TTA777 December 28, 2022 17:09
@jonasanker jonasanker self-assigned this Dec 28, 2022
@jonasanker jonasanker linked an issue Dec 28, 2022 that may be closed by this pull request
@sonarcloud
Copy link

sonarcloud bot commented Dec 28, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

28.0% 28.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@TTA777 TTA777 left a comment

Choose a reason for hiding this comment

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

I believe there is one severe issue

@@ -152,7 +153,26 @@ public async Task<SinglePurchaseResponse> GetPurchase(int purchaseId, User user)
$"No purchase was found by Purchase Id: {purchaseId} and User Id: {user.Id}");
}

var paymentDetails = await _mobilePayPaymentsService.GetPayment(Guid.Parse(purchase.TransactionId));
PaymentDetails paymentDetails;
if (purchase.PaymentType == null)
Copy link
Member

Choose a reason for hiding this comment

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

From my understanding, this assumes that all purchases done prior to this pull request were done using mobilePay. This however is not correct, due to us having issued vouchers as part of the datamodel. As such, I believe line 159 will result in unintended behaviour.

Copy link
Member

Choose a reason for hiding this comment

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

Looking at this again, we would also have the same problem with the older purchases issued by the ipad in analog.

For addressing my first comment, we could wrap the call to mobilepay in a try-catch, and then assign the payment details to a unknownPurchase type or something like that in the catch if mobilepay were to throw an exception.

If we wanted to assign a specific purchase type for purchases from the ipad, we could check the OrderId, since they should all have the id "Analog". Anything that haven't been matched so far, should then be vouchers, assuming no discrepancies in the datamodel.

Copy link
Member

Choose a reason for hiding this comment

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

addressed in latest commit

@TTA777
Copy link
Member

TTA777 commented May 30, 2023

@jonasanker This has been stale for quite a while. Do we want it fixed, and merged, or do we want a rework of the er model as a "proper" fix instead?

@jonasanker
Copy link
Member Author

@TTA777 Yea, I think it was lost when the focus changed to Azure. Can we maybe discuss next time or online how the new data model might look like so we can get a sense of the amount of changes?

@jonasanker jonasanker marked this pull request as draft August 15, 2023 17:21
@jonasanker
Copy link
Member Author

Awaits completion of #130

Base automatically changed from develop to main December 7, 2023 18:17
Purchase Type is currently used to distinguish between Free Purchases and MobilePay. However could be extended in the future.
PaymentType is nullable as we old purchases has no assumed payment type.
@marfavi marfavi force-pushed the feature/jonas/purchase-apiv2-fix branch from a97d595 to 52712d5 Compare September 17, 2024 14:48
@marfavi marfavi requested a review from TTA777 September 17, 2024 15:55
@marfavi
Copy link
Member

marfavi commented Sep 17, 2024

Branch is now up to date. What now❓ @jonasanker @TTA777

@marfavi marfavi self-assigned this Sep 17, 2024
@marfavi marfavi force-pushed the feature/jonas/purchase-apiv2-fix branch from f9d01aa to abc4b4b Compare September 17, 2024 17:19
Copy link

sonarcloud bot commented Sep 17, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
18.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-v2 Related to new API version 2
Projects
None yet
3 participants