Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Commit

Permalink
Add more BTCPAY metadata on order creation
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Dec 30, 2017
1 parent 0572b73 commit c49c6f7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/class-wc-gateway-bitpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -719,12 +719,16 @@ public function process_payment($order_id)
);
}

$responseData = json_decode($client->getResponse()->getBody());

update_post_meta($order_id, 'BTCPay_redirect', $invoice->getUrl());
update_post_meta($order_id, 'BTCPay_id', $invoice->getId());
update_post_meta($order_id, 'BTCPay_rate', $invoice->getRate());
$formattedRate = number_format($invoice->getRate(), wc_get_price_decimals(), wc_get_price_decimal_separator(), wc_get_price_thousand_separator());
update_post_meta($order_id, 'BTCPay_formatted_rate', $formattedRate);

$this->update_btcpay($order_id, $responseData);

// Reduce stock levels
//$order->reduce_order_stock();
wc_reduce_stock_levels($order_id);
Expand Down

0 comments on commit c49c6f7

Please sign in to comment.