|
@@ -440,29 +440,16 @@ impl Mint {
|
|
|
payment_amount_quote_unit
|
|
|
);
|
|
|
|
|
|
- tx.increment_mint_quote_amount_paid(
|
|
|
- &mint_quote.id,
|
|
|
- payment_amount_quote_unit,
|
|
|
- wait_payment_response.payment_id,
|
|
|
- )
|
|
|
- .await?;
|
|
|
+ let total_paid = tx
|
|
|
+ .increment_mint_quote_amount_paid(
|
|
|
+ &mint_quote.id,
|
|
|
+ payment_amount_quote_unit,
|
|
|
+ wait_payment_response.payment_id,
|
|
|
+ )
|
|
|
+ .await?;
|
|
|
|
|
|
- match mint_quote.payment_method {
|
|
|
- PaymentMethod::Bolt11 => {
|
|
|
- self.pubsub_manager
|
|
|
- .mint_quote_bolt11_status(mint_quote.clone(), MintQuoteState::Paid);
|
|
|
- }
|
|
|
- PaymentMethod::Bolt12 => {
|
|
|
- self.pubsub_manager.mint_quote_bolt12_status(
|
|
|
- mint_quote.clone(),
|
|
|
- wait_payment_response.payment_amount,
|
|
|
- Amount::ZERO,
|
|
|
- );
|
|
|
- }
|
|
|
- _ => {
|
|
|
- // We don't send ws updates for unknown methods
|
|
|
- }
|
|
|
- }
|
|
|
+ self.pubsub_manager
|
|
|
+ .mint_quote_payment(mint_quote, total_paid);
|
|
|
}
|
|
|
} else {
|
|
|
tracing::info!("Received payment notification for already seen payment.");
|
|
@@ -626,27 +613,16 @@ impl Mint {
|
|
|
)
|
|
|
.await?;
|
|
|
|
|
|
- tx.increment_mint_quote_amount_issued(&mint_request.quote, mint_request.total_amount()?)
|
|
|
+ let amount_issued = mint_request.total_amount()?;
|
|
|
+
|
|
|
+ let total_issued = tx
|
|
|
+ .increment_mint_quote_amount_issued(&mint_request.quote, amount_issued)
|
|
|
.await?;
|
|
|
|
|
|
tx.commit().await?;
|
|
|
|
|
|
- match mint_quote.payment_method {
|
|
|
- PaymentMethod::Bolt11 => {
|
|
|
- self.pubsub_manager
|
|
|
- .mint_quote_bolt11_status(mint_quote.clone(), MintQuoteState::Issued);
|
|
|
- }
|
|
|
- PaymentMethod::Bolt12 => {
|
|
|
- self.pubsub_manager.mint_quote_bolt12_status(
|
|
|
- mint_quote.clone(),
|
|
|
- Amount::ZERO,
|
|
|
- mint_request.total_amount()?,
|
|
|
- );
|
|
|
- }
|
|
|
- PaymentMethod::Custom(_) => {
|
|
|
- // We don't send ws updates for unknown methods
|
|
|
- }
|
|
|
- }
|
|
|
+ self.pubsub_manager
|
|
|
+ .mint_quote_issue(&mint_quote, total_issued);
|
|
|
|
|
|
Ok(MintResponse {
|
|
|
signatures: blind_signatures,
|