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

tweaks PG #3856

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/hct_mis_api/apps/payment/services/payment_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def get_payload(self, obj: Payment) -> Dict:
destination_currency: str # "USD"
"""
return {
"amount": int(obj.entitlement_quantity * 100),
"amount": obj.entitlement_quantity,
"phone_no": str(obj.collector.phone_no),
"last_name": obj.collector.family_name,
"first_name": obj.collector.given_name,
Expand Down Expand Up @@ -145,7 +145,8 @@ class PaymentRecordData(FlexibleArgumentsDataclassMixin):
parent: str
status: str
hope_status: str
extra_data: dict
auth_code: str
payout_amount: float
fsp_code: str
message: Optional[str] = None

Expand Down Expand Up @@ -391,15 +392,14 @@ def update_payment(
_payment.reason_for_unsuccessful_payment = matching_pg_payment.message
update_fields.append("reason_for_unsuccessful_payment")

delivered_quantity = matching_pg_payment.extra_data.get("delivered_quantity", None)
delivered_quantity = matching_pg_payment.payout_amount
if _payment.status in [
Payment.STATUS_SUCCESS,
Payment.STATUS_DISTRIBUTION_SUCCESS,
Payment.STATUS_DISTRIBUTION_PARTIAL,
]:
update_fields.extend(["delivered_quantity", "delivered_quantity_usd"])
try:
delivered_quantity = int(delivered_quantity) / 100
_payment.delivered_quantity = delivered_quantity
_payment.delivered_quantity_usd = get_quantity_in_usd(
amount=Decimal(delivered_quantity),
Expand Down
2 changes: 1 addition & 1 deletion backend/hct_mis_api/config/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
),
"MATOMO_TRACKER_URL": (
str,
"",
"https://unisitetracker.unicef.io/",
),
"MATOMO_SCRIPT_URL": (
str,
Expand Down
Loading