Skip to content
Open
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
16 changes: 9 additions & 7 deletions modules/gateways/monero/createinvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@
$link = $GATEWAY['daemon_host'].":".$GATEWAY['daemon_port']."/json_rpc";


function monero_payment_id(){
if(!isset($_COOKIE['payment_id'])) {

function monero_payment_id($invoice_id){
$invoice_id = checkCbInvoiceID($invoice_id, "monero");
if(!isset($_COOKIE["payment_id$invoice_id"])) {
$payment_id = bin2hex(openssl_random_pseudo_bytes(8));
setcookie('payment_id', $payment_id, time()+2700);
// create cookie per invoice_id.
setcookie("payment_id$invoice_id", $payment_id, time()+2700);
Copy link
Member

Choose a reason for hiding this comment

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

I can't understand the purpose of this change. Why should you call a cookie with the invoice id?

Copy link
Member

Choose a reason for hiding this comment

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

I can't understand the purpose of this change. Why should you call a cookie with the invoice id?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the idea is if you pay more than one invoice in a short time it keeps using the first one set. I ran into that once when testing but didn't see it again so didn't try to implement this change yet

Copy link
Member

Choose a reason for hiding this comment

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

It seems fair for me.

} else {
$payment_id = $_COOKIE['payment_id'];
}
return $payment_id;

$payment_id = $_COOKIE["payment_id$invoice_id"];
}
return $payment_id;
}

$monero_daemon = new Monero_rpc($link);
Expand Down