feat(dimentorin): confirm payment auto-confirms linked session
- confirm_payment now transitions linked session pending->confirmed - e2e verified: book -> create payment -> admin confirm -> session confirmed + payment paid
This commit is contained in:
@@ -142,9 +142,16 @@ impl PaymentService for PaymentServiceImpl {
|
|||||||
"Payment is not pending".into(),
|
"Payment is not pending".into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
self.payment_repo
|
let paid = self.payment_repo
|
||||||
.update_status(id, "paid", Some(payment.external_ref.clone().unwrap_or_default()))
|
.update_status(id, "paid", Some(payment.external_ref.clone().unwrap_or_default()))
|
||||||
.await
|
.await?;
|
||||||
|
// Confirm the linked session so mentor/mentee can proceed with the call.
|
||||||
|
if let Some(mut session) = self.session_repo.find_by_id(payment.session_id).await? {
|
||||||
|
session.status = "confirmed".to_string();
|
||||||
|
session.updated_at = Utc::now();
|
||||||
|
self.session_repo.update(payment.session_id, session).await?;
|
||||||
|
}
|
||||||
|
Ok(paid)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_mentee_payments(
|
async fn get_mentee_payments(
|
||||||
|
|||||||
Reference in New Issue
Block a user