|
@@ -360,9 +360,9 @@ where
|
|
|
query(
|
|
query(
|
|
|
r#"
|
|
r#"
|
|
|
INSERT INTO transactions
|
|
INSERT INTO transactions
|
|
|
- (id, mint_url, direction, unit, amount, fee, ys, timestamp, memo, metadata, quote_id, payment_request, payment_proof)
|
|
|
|
|
|
|
+ (id, mint_url, direction, unit, amount, fee, ys, timestamp, memo, metadata, quote_id, payment_request, payment_proof, payment_method)
|
|
|
VALUES
|
|
VALUES
|
|
|
- (:id, :mint_url, :direction, :unit, :amount, :fee, :ys, :timestamp, :memo, :metadata, :quote_id, :payment_request, :payment_proof)
|
|
|
|
|
|
|
+ (:id, :mint_url, :direction, :unit, :amount, :fee, :ys, :timestamp, :memo, :metadata, :quote_id, :payment_request, :payment_proof, :payment_method)
|
|
|
ON CONFLICT(id) DO UPDATE SET
|
|
ON CONFLICT(id) DO UPDATE SET
|
|
|
mint_url = excluded.mint_url,
|
|
mint_url = excluded.mint_url,
|
|
|
direction = excluded.direction,
|
|
direction = excluded.direction,
|
|
@@ -374,7 +374,8 @@ where
|
|
|
metadata = excluded.metadata,
|
|
metadata = excluded.metadata,
|
|
|
quote_id = excluded.quote_id,
|
|
quote_id = excluded.quote_id,
|
|
|
payment_request = excluded.payment_request,
|
|
payment_request = excluded.payment_request,
|
|
|
- payment_proof = excluded.payment_proof
|
|
|
|
|
|
|
+ payment_proof = excluded.payment_proof,
|
|
|
|
|
+ payment_method = excluded.payment_method
|
|
|
;
|
|
;
|
|
|
"#,
|
|
"#,
|
|
|
)?
|
|
)?
|
|
@@ -394,6 +395,7 @@ where
|
|
|
.bind("quote_id", transaction.quote_id)
|
|
.bind("quote_id", transaction.quote_id)
|
|
|
.bind("payment_request", transaction.payment_request)
|
|
.bind("payment_request", transaction.payment_request)
|
|
|
.bind("payment_proof", transaction.payment_proof)
|
|
.bind("payment_proof", transaction.payment_proof)
|
|
|
|
|
+ .bind("payment_method", transaction.payment_method.map(|pm| pm.to_string()))
|
|
|
.execute(&self.inner)
|
|
.execute(&self.inner)
|
|
|
.await?;
|
|
.await?;
|
|
|
|
|
|
|
@@ -1251,7 +1253,8 @@ where
|
|
|
metadata,
|
|
metadata,
|
|
|
quote_id,
|
|
quote_id,
|
|
|
payment_request,
|
|
payment_request,
|
|
|
- payment_proof
|
|
|
|
|
|
|
+ payment_proof,
|
|
|
|
|
+ payment_method
|
|
|
FROM
|
|
FROM
|
|
|
transactions
|
|
transactions
|
|
|
WHERE
|
|
WHERE
|
|
@@ -1288,7 +1291,8 @@ where
|
|
|
metadata,
|
|
metadata,
|
|
|
quote_id,
|
|
quote_id,
|
|
|
payment_request,
|
|
payment_request,
|
|
|
- payment_proof
|
|
|
|
|
|
|
+ payment_proof,
|
|
|
|
|
+ payment_method
|
|
|
FROM
|
|
FROM
|
|
|
transactions
|
|
transactions
|
|
|
"#,
|
|
"#,
|
|
@@ -1516,7 +1520,8 @@ fn sql_row_to_transaction(row: Vec<Column>) -> Result<Transaction, Error> {
|
|
|
metadata,
|
|
metadata,
|
|
|
quote_id,
|
|
quote_id,
|
|
|
payment_request,
|
|
payment_request,
|
|
|
- payment_proof
|
|
|
|
|
|
|
+ payment_proof,
|
|
|
|
|
+ payment_method
|
|
|
) = row
|
|
) = row
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -1542,6 +1547,10 @@ fn sql_row_to_transaction(row: Vec<Column>) -> Result<Transaction, Error> {
|
|
|
quote_id: column_as_nullable_string!(quote_id),
|
|
quote_id: column_as_nullable_string!(quote_id),
|
|
|
payment_request: column_as_nullable_string!(payment_request),
|
|
payment_request: column_as_nullable_string!(payment_request),
|
|
|
payment_proof: column_as_nullable_string!(payment_proof),
|
|
payment_proof: column_as_nullable_string!(payment_proof),
|
|
|
|
|
+ payment_method: column_as_nullable_string!(payment_method)
|
|
|
|
|
+ .map(|v| PaymentMethod::from_str(&v))
|
|
|
|
|
+ .transpose()
|
|
|
|
|
+ .map_err(Error::from)?,
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|