diff --git a/payment_btcpay/static/description/index.html b/payment_btcpay/static/description/index.html deleted file mode 100644 index cb97259..0000000 --- a/payment_btcpay/static/description/index.html +++ /dev/null @@ -1,87 +0,0 @@ - - - -
-
-

BTCPay Gateway

-

This is the module to connect Odoo 16.0 and Btcpay

-
-
- -
-
-
-

- This module allow you to create an easily way to accept Bitcoins -

-
-
-
- -
-
-

Configure Payment Provider

-
-

-

    -
  • Install BTCPay Module -> Website -> eCommerce -> Payment Acquirers -> BTCPay
  • -
  • Put your facace. Best option is 'merchant'.
  • -
  • Put the location as test or live url. Test example url: https://testnet.demo.btcpayserver.org
  • -
  • Put the Confirmation URL where BTCpay will return after payment.
  • -
  • Put your "Pairing Code" if you want that system get the "Token", after that "Pairing Code" will be deleted and the "Token" will appear in the corresponding field. You must safe the changes in order that this happens. NOTE: if you want to get new "Token" throw new "Pairing Code", please remove the "Token" field. Keep in mind that "Token" field must be in blank if you want to get throw the API.
  • -
  • Put your "Token" if you have it and don't want to use Pairing Code to get it. Remember, if you want to get throw API please don't write anything here.
  • -
  • If you have a Private Key you can write here otherwise system will get when you safe the Payment Provider
  • -
  • Remember to Publish On Website
  • -
-

-
-
-
- -
-
-
-
- -
-
-

How it looks like?

-
-
- -
-
-
-

-

    - In payment webpage where payment methods appear, you will find new payment method called BTCPay. - If you click on it you will be redirect to the server that you indicate in location field. -
-

-
-
-
- -
-
-

Transaction BTCPay Details

-
-

-

    - In transaction object, you will find more technical information about this method of payment: -
  • Transaction Id: cryptocurrency transaction hash for the executed payout.
  • -
  • Invoice Id: the id of the invoice for which you want to fetch an event token
  • -
  • Transaction Status: That indicates state of transaction
  • -
-

-
-
-
- -
-
-
-
- - - \ No newline at end of file diff --git a/payment_btcpay/LICENSE.txt b/payment_btcpayserver/LICENSE.txt similarity index 100% rename from payment_btcpay/LICENSE.txt rename to payment_btcpayserver/LICENSE.txt diff --git a/payment_btcpay/README.md b/payment_btcpayserver/README.md similarity index 82% rename from payment_btcpay/README.md rename to payment_btcpayserver/README.md index 8bc09c1..6bb14f3 100644 --- a/payment_btcpay/README.md +++ b/payment_btcpayserver/README.md @@ -2,13 +2,13 @@ ## This is the module to connect Odoo 16 and BTCPay Server This module allows you to accept bitcoin (and other cryptocurrency) payments in your Odoo e-commerce store. -![BTCPay Server Banner](../payment_btcpay/static/description/BTCPay-Odoo-16-featured.png) +![BTCPay Server Banner](../payment_btcpayserver/static/description/BTCPay-Odoo-16-featured.png) ## Install the module * Clone our [repository](https://github.com/btcpayserver/odoo) or download the .zip from the [releases page](https://github.com/btcpayserver/odoo/releases) * Make sure you are on branch `16.0` or downloaded a release tagged with version v16.x -* Place the `payment_btcpay` directory in your Odoo addons directory -* Install dependencies by running `pip install -r requirements.txt` (from inside the `payment_btcpay` directory) +* Place the `payment_btcpayserver` directory in your Odoo addons directory +* Install dependencies by running `pip install -r requirements.txt` (from inside the `payment_btcpayserver` directory) * Restart Odoo * Go to Apps -> Update Apps List * Remove the "Apps" filter and search for "btcpay" @@ -36,13 +36,13 @@ On the tab "Configuration": * Set field "Payment Journal" to "Bank", you can click the dropdown and click on the suggestion "Bank" * Now you can **save** the settings -![Payment Provider Settings](../payment_btcpay/static/description/BTCPayPaymentSettings.png) +![Payment Provider Settings](../payment_btcpayserver/static/description/BTCPayPaymentSettings.png) ## How does the payment page look? During the checkout the customers will have the option to select the payment method "Pay with Bitcoin / Lightning Network". After selecting they will be redirected to the BTCPay checkout page as shown below. -![Payment Provider](../payment_btcpay/static/description/BTCPayLooksLike.png) +![Payment Provider](../payment_btcpayserver/static/description/BTCPayLooksLike.png) ## Transaction BTCPay Details @@ -51,4 +51,4 @@ In transaction object, you will find more technical information about this metho * Invoice Id: the id of the invoice for which you want to fetch an event token * Transaction Status: That indicates state of transaction -![Transaction Btcpay Details](../payment_btcpay/static/description/BtcpayTxDetails.png) +![Transaction Btcpay Details](../payment_btcpayserver/static/description/BtcpayTxDetails.png) diff --git a/payment_btcpay/__init__.py b/payment_btcpayserver/__init__.py similarity index 71% rename from payment_btcpay/__init__.py rename to payment_btcpayserver/__init__.py index a20ed67..b657a28 100644 --- a/payment_btcpay/__init__.py +++ b/payment_btcpayserver/__init__.py @@ -7,8 +7,8 @@ def post_init_hook(cr, registry): - setup_provider(cr, registry, 'btcpay') + setup_provider(cr, registry, 'btcpayserver') def uninstall_hook(cr, registry): - reset_payment_provider(cr, registry, 'btcpay') \ No newline at end of file + reset_payment_provider(cr, registry, 'btcpayserver') \ No newline at end of file diff --git a/payment_btcpay/__manifest__.py b/payment_btcpayserver/__manifest__.py similarity index 79% rename from payment_btcpay/__manifest__.py rename to payment_btcpayserver/__manifest__.py index 185d047..5ecae97 100644 --- a/payment_btcpay/__manifest__.py +++ b/payment_btcpayserver/__manifest__.py @@ -1,7 +1,7 @@ #****************************************************************************** -# PAYMENT BTCPAY FOR ODOO +# PAYMENT BTCPAY SERVER FOR ODOO # -# Copyright (C) 2023 Susanna Fort +# Copyright (C) 2023 Susanna Fort , ndeet # #****************************************************************************** # @@ -20,23 +20,25 @@ #****************************************************************************** { - 'name': 'Payment Provider: BTCPay', + 'name': 'Payment Provider: BTCPay Server', 'summary': 'This module integrates BTCPAY - pay with Bitcoin - with Odoo v16.0', - 'author': 'Vandekul', + 'author': 'BTCPay Server team and contributors', 'website': 'https://github.com/btcpayserver/odoo', 'category': 'Accounting/Payment Providers', - 'version': '16.0.1.1', + 'version': '16.0.2.0', 'license': 'GPL-3', + 'currency': 'USD', 'application': False, 'installable': True, 'auto_install': False, 'depends': ['base', 'account', 'payment'], 'data': [ - 'views/payment_btcpay_templates.xml', + 'views/payment_btcpayserver_templates.xml', 'views/payment_provider_views.xml', 'views/payment_transaction_views.xml', 'data/payment_provider_data.xml', ], + 'images': ['static/description/BTCPay-Odoo-16-featured.png'], 'external_dependencies': { 'python': ['btcpay-python'] }, diff --git a/payment_btcpay/controllers/__init__.py b/payment_btcpayserver/controllers/__init__.py similarity index 100% rename from payment_btcpay/controllers/__init__.py rename to payment_btcpayserver/controllers/__init__.py diff --git a/payment_btcpay/controllers/main.py b/payment_btcpayserver/controllers/main.py similarity index 96% rename from payment_btcpay/controllers/main.py rename to payment_btcpayserver/controllers/main.py index 974a96f..f16e4ec 100644 --- a/payment_btcpay/controllers/main.py +++ b/payment_btcpayserver/controllers/main.py @@ -48,7 +48,7 @@ class BTCPayController(http.Controller): def checkout(self, **data): _logger.info("CHECKOUT: notification received from BTCPay with data:\n%s", pprint.pformat(data)) - tx_sudo = request.env['payment.transaction'].sudo()._get_tx_from_notification_data('btcpay', data) + tx_sudo = request.env['payment.transaction'].sudo()._get_tx_from_notification_data('btcpayserver', data) provider = tx_sudo.provider_id notification_url = str(data.get('notify_url')).replace("http://", "https://") base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url') @@ -82,7 +82,7 @@ def btcpay_ipn(self, **post): notification_data = {"reference": data['data']['orderId'], "invoiceID": data['data']['id']} # Check the origin and integrity of the notification - tx_sudo = request.env['payment.transaction'].sudo()._get_tx_from_notification_data('btcpay', notification_data) + tx_sudo = request.env['payment.transaction'].sudo()._get_tx_from_notification_data('btcpayserver', notification_data) provider = tx_sudo.provider_id client = BTCPayClient(host=provider.btcpay_location, pem=provider.btcpay_privateKey, tokens={provider.btcpay_facade: provider.btcpay_token}) @@ -96,7 +96,7 @@ def btcpay_ipn(self, **post): "txid": fetched_invoice['url']} # Handle the notification data - tx_sudo._handle_notification_data('btcpay', notification_data) + tx_sudo._handle_notification_data('btcpayserver', notification_data) except ValidationError: # Acknowledge the notification to avoid getting spammed _logger.exception("Unable to handle the notification data; skipping to acknowledge") return '' diff --git a/payment_btcpay/data/payment_provider_data.xml b/payment_btcpayserver/data/payment_provider_data.xml similarity index 59% rename from payment_btcpay/data/payment_provider_data.xml rename to payment_btcpayserver/data/payment_provider_data.xml index 78e7bfe..4407477 100644 --- a/payment_btcpay/data/payment_provider_data.xml +++ b/payment_btcpayserver/data/payment_provider_data.xml @@ -1,12 +1,12 @@ - + BTCPay payments Pay with Bitcoin / Lightning Network - btcpay - - + btcpayserver + + diff --git a/payment_btcpay/models/__init__.py b/payment_btcpayserver/models/__init__.py similarity index 100% rename from payment_btcpay/models/__init__.py rename to payment_btcpayserver/models/__init__.py diff --git a/payment_btcpay/models/libs/__init__.py b/payment_btcpayserver/models/libs/__init__.py similarity index 100% rename from payment_btcpay/models/libs/__init__.py rename to payment_btcpayserver/models/libs/__init__.py diff --git a/payment_btcpay/models/libs/client.py b/payment_btcpayserver/models/libs/client.py similarity index 100% rename from payment_btcpay/models/libs/client.py rename to payment_btcpayserver/models/libs/client.py diff --git a/payment_btcpay/models/libs/crypto.py b/payment_btcpayserver/models/libs/crypto.py similarity index 100% rename from payment_btcpay/models/libs/crypto.py rename to payment_btcpayserver/models/libs/crypto.py diff --git a/payment_btcpay/models/payment_provider.py b/payment_btcpayserver/models/payment_provider.py similarity index 87% rename from payment_btcpay/models/payment_provider.py rename to payment_btcpayserver/models/payment_provider.py index c85b69b..4ddc059 100644 --- a/payment_btcpay/models/payment_provider.py +++ b/payment_btcpayserver/models/payment_provider.py @@ -11,7 +11,7 @@ class PaymentProvider(models.Model): _inherit = 'payment.provider' code = fields.Selection( - selection_add=[('btcpay', "BTCPay")], ondelete={'btcpay': 'set default'}) + selection_add=[('btcpayserver', "BTCPay")], ondelete={'btcpayserver': 'set default'}) btcpay_location = fields.Char(string='BTCPay Server URL', size=64, help='URL where your BTCPay Server instance is reachable (where you log into your BTCPay Server).', default='https://testnet.demo.btcpayserver.org') btcpay_pairingCode = fields.Char(string='Pairing Code', help='Create paring Code in your BTCPay server and put here') @@ -21,14 +21,14 @@ class PaymentProvider(models.Model): btcpay_facade = fields.Char(string='Facade', help='Token facade type: merchant/pos/payroll. Keep merchant', default='merchant') def create(self, values_list): - if self.code == 'btcpay': + if self.code == 'btcpayserver': values_list['btcpay_privateKey'] = crypto.generate_privakey() return super(PaymentProvider, self).create(values_list) @api.onchange('btcpay_pairingCode') def _onchange_pairingCode(self): - if not self.btcpay_token and self.code == 'btcpay' and not self.btcpay_pairingCode == '': + if not self.btcpay_token and self.code == 'btcpayserver' and not self.btcpay_pairingCode == '': #_logger.info("ONCHANGE PAIRING CODE***SELF: %s %s %s", self.btcpay_location, self.btcpay_privateKey, self.btcpay_pairingCode) self.btcpay_privateKey = crypto.generate_privkey() client = BTCPayClient(host=self.btcpay_location, pem=self.btcpay_privateKey) @@ -37,14 +37,14 @@ def _onchange_pairingCode(self): @api.onchange('btcpay_token') def _onchange_token(self): - if self.code == 'btcpay': + if self.code == 'btcpayserver': self.btcpay_pairingCode = '' #_logger.info("ONCHANGE TOKEN") @api.onchange('btcpay_location') def _onchange_location(self): - if self.code == 'btcpay': + if self.code == 'btcpayserver': self.btcpay_token = '' #_logger.info("ONCHANGE LOCATION ***SELF: %s %s %s", self.btcpay_location, self.btcpay_privateKey, self.btcpay_pairingCode) self.btcpay_privateKey = '' diff --git a/payment_btcpay/models/payment_transaction.py b/payment_btcpayserver/models/payment_transaction.py similarity index 96% rename from payment_btcpay/models/payment_transaction.py rename to payment_btcpayserver/models/payment_transaction.py index ad94b57..e74640a 100644 --- a/payment_btcpay/models/payment_transaction.py +++ b/payment_btcpayserver/models/payment_transaction.py @@ -32,7 +32,7 @@ def _get_specific_rendering_values(self, processing_values): res = super()._get_specific_rendering_values(processing_values) - if self.provider_code != 'btcpay': + if self.provider_code != 'btcpayserver': return res base_url = self.provider_id.get_base_url() @@ -68,11 +68,11 @@ def _get_tx_from_notification_data(self, provider_code, notification_data): """ tx = super()._get_tx_from_notification_data(provider_code, notification_data) _logger.info('GET TX FROM NOTIFICATION Notification_data %s', pprint.pformat(notification_data)) - if provider_code != 'btcpay' or len(tx) == 1: + if provider_code != 'btcpayserver' or len(tx) == 1: return tx reference = notification_data.get('reference') - tx = self.search([('reference', '=', reference), ('provider_code', '=', 'btcpay')]) + tx = self.search([('reference', '=', reference), ('provider_code', '=', 'btcpayserver')]) if not tx: raise ValidationError( "BTCPay: " + _("No transaction found matching reference %s.", reference) @@ -102,7 +102,7 @@ def _process_notification_data(self, notification_data): :raise: ValidationError if inconsistent data were received """ super()._process_notification_data(notification_data) - if self.provider_code != 'btcpay': + if self.provider_code != 'btcpayserver': return _logger.info("_process_notification_data %s", pprint.pformat(notification_data)) diff --git a/payment_btcpay/requirements.txt b/payment_btcpayserver/requirements.txt similarity index 100% rename from payment_btcpay/requirements.txt rename to payment_btcpayserver/requirements.txt diff --git a/payment_btcpay/static/description/BTCPay-Odoo-16-featured.png b/payment_btcpayserver/static/description/BTCPay-Odoo-16-featured.png similarity index 100% rename from payment_btcpay/static/description/BTCPay-Odoo-16-featured.png rename to payment_btcpayserver/static/description/BTCPay-Odoo-16-featured.png diff --git a/payment_btcpay/static/description/BTCPayLooksLike.png b/payment_btcpayserver/static/description/BTCPayLooksLike.png similarity index 100% rename from payment_btcpay/static/description/BTCPayLooksLike.png rename to payment_btcpayserver/static/description/BTCPayLooksLike.png diff --git a/payment_btcpay/static/description/BTCPayPaymentSettings.png b/payment_btcpayserver/static/description/BTCPayPaymentSettings.png similarity index 100% rename from payment_btcpay/static/description/BTCPayPaymentSettings.png rename to payment_btcpayserver/static/description/BTCPayPaymentSettings.png diff --git a/payment_btcpay/static/description/BTCPayServer_org.png b/payment_btcpayserver/static/description/BTCPayServer_org.png similarity index 100% rename from payment_btcpay/static/description/BTCPayServer_org.png rename to payment_btcpayserver/static/description/BTCPayServer_org.png diff --git a/payment_btcpay/static/description/BtcpayTxDetails.png b/payment_btcpayserver/static/description/BtcpayTxDetails.png similarity index 100% rename from payment_btcpay/static/description/BtcpayTxDetails.png rename to payment_btcpayserver/static/description/BtcpayTxDetails.png diff --git a/payment_btcpay/static/description/icon.png b/payment_btcpayserver/static/description/icon.png similarity index 100% rename from payment_btcpay/static/description/icon.png rename to payment_btcpayserver/static/description/icon.png diff --git a/payment_btcpayserver/static/description/index.html b/payment_btcpayserver/static/description/index.html new file mode 100644 index 0000000..b6b40d2 --- /dev/null +++ b/payment_btcpayserver/static/description/index.html @@ -0,0 +1,194 @@ + + + +
+
+

BTCPay Server Gateway

+

This module allows you to accept Bitcoin / Lightning Network (and other cryptocurrency) payments in your Odoo e-commerce store.

+
+
+ +
+
+
+
+

+ BTCPay Server for Odoo is a revolutionary, self-hosted, open-source payment gateway to accept Bitcoin payments. Our seamless integration with Odoo allows you to connect your self-hosted BTCPay Server and start accepting Bitcoin payments in just a few simple steps. +

+
+
+ +
+
+

Features

+
+

+

    +
  • Zero fees: Enjoy a payment gateway with no fees. Yes, really!
  • +
  • Fully automated system: BTCPay takes care of payments, invoice management and refunds automatically.
  • +
  • Display Bitcoin QR code at checkout: Enhance customer experience with an easy and secure payment option.
  • +
  • No middlemen or KYC: +
      +
    • Direct, P2P payments (going directly to your wallet)
    • +
    • Say goodbye to intermediaries and tedious paperwork
    • +
    • Transaction information is only shared between you and your customer
    • +
    +
  • +
  • Self-hosted infrastructure: Maintain full control over your payment gateway.
  • +
  • Direct wallet payments: Be your own bank with a self-custodial service.
  • +
  • Lightning Network integrated out of the box – instant, fast and low cost payments and payouts
  • +
  • Reporting and accounting – CSV exports
  • +
  • Advanced invoice management and refunding integrated in the WooCommerce UI
  • +
  • Real-time exchange price tracking for correct payment amounts
  • +
  • Versatile plugin system: +
      +
    • Extend functionality according to your needs
    • +
    • Accept payments in altcoins through various plugins
    • +
    +
  • +
  • Elegant checkout design: Compatible with all Bitcoin wallets and enhanced with your store’s logo and branding for a unique UX.
  • +
  • Point-of-sale integration – Accept payments in your physical shops
  • +
  • Multilingual ready: Serve a global audience right out of the box.
  • +
  • Top-notch privacy and security: Protect your and your customers’ data.
  • +
  • Community-driven support: Get responsive assistance from our dedicated community (Mattermost or Telegram).
  • +
+

+
+
+
+ + + +
+
+

Requirements

+
+

+

+

+
+
+
+ +
+
+

Install the module

+
+

+

    +
  • Clone our [repository](https://github.com/btcpayserver/odoo) or download the .zip from the [releases page](https://github.com/btcpayserver/odoo/releases) +
  • Make sure you are on branch `16.0` or downloaded a release tagged with version v16.x +
  • Place the `payment_btcpayserver` directory in your Odoo addons directory +
  • Install dependencies by running `pip install -r requirements.txt` (from inside the `payment_btcpayserver` directory) +
  • Restart Odoo +
  • Go to Apps -> Update Apps List +
  • Remove the "Apps" filter and search for "btcpay" +
  • Click **Activate** button +
+

+
+
+
+ +
+
+

Configure BTCPay as payment provider

+
+

+

    +
  • Go to Website -> Configuration -> Payment Providers
  • +
  • Search for BTCPay and click on button Activate
  • +
+ +

In the BTCPay settings form, tab "Credentials":

+
    +
  • Set field "State" to enabled
  • +
  • Set field "BTCPay Server URL" as test or live URL including https://. Example URL: https://testnet.demo.btcpayserver.org
  • +
  • Get a pairing code from your BTCPay Server store: Settings -> Access Tokens +
      +
    • Click on "Create Token" button
    • +
    • Label: enter e.g. "My odoo store"
    • +
    • Public Key: leave empty
    • +
    • Click on "Request Pairing" button, on next page click "Approve" button
    • +
    • At the top copy the code next to "Server initiated pairing code", e.g. "hg7z8wN"
    • +
    +
  • +
  • Back in Odoo, paste the code into "Pairing Code" field
  • +
  • Hit Tab key on your keyboard (or click on another field) and the pairing process will start automatically
  • +
  • When the pairing is successful the "Token" and "Private Key" field will be filled automatically
  • +
  • Field Facade, keep default 'merchant'.
  • +
+ +

On the tab "Configuration":

+
    +
  • Make sure field "Payment Journal" is set to "Bank", otherwise you can click the dropdown and click on the suggestion "Bank"
  • +
  • Now you can save the settings
  • +
+ +

Check the payment method is enabled:

+
    +
  • Go to Website -> Configuration -> Payment Methods
  • +
  • Make sure "Pay with Bitcoin / Lightning Network" is active
  • +
+ +

Congrats, all done. Do some testing to be sure all works.

+ +

+
+
+
+ +
+
+
+
+ +
+
+

How it looks like?

+
+
+ +
+
+
+

+

    + In payment webpage where payment methods appear, you will find new payment method called BTCPay. + If you click on it you will be redirect to the server that you indicate in location field. +
+

+
+
+
+ +
+
+

Transaction BTCPay Details

+
+

+

    + In transaction object, you will find more technical information about this method of payment: +
  • Transaction Id: cryptocurrency transaction hash for the executed payout.
  • +
  • Invoice Id: the id of the invoice for which you want to fetch an event token
  • +
  • Transaction Status: That indicates state of transaction
  • +
+

+
+
+
+ +
+
+
+
+ + + \ No newline at end of file diff --git a/payment_btcpay/views/payment_btcpay_templates.xml b/payment_btcpayserver/views/payment_btcpayserver_templates.xml similarity index 100% rename from payment_btcpay/views/payment_btcpay_templates.xml rename to payment_btcpayserver/views/payment_btcpayserver_templates.xml diff --git a/payment_btcpay/views/payment_provider_views.xml b/payment_btcpayserver/views/payment_provider_views.xml similarity index 96% rename from payment_btcpay/views/payment_provider_views.xml rename to payment_btcpayserver/views/payment_provider_views.xml index 0ce6079..254d7a1 100644 --- a/payment_btcpay/views/payment_provider_views.xml +++ b/payment_btcpayserver/views/payment_provider_views.xml @@ -7,11 +7,11 @@ - + - + diff --git a/payment_btcpay/views/payment_transaction_views.xml b/payment_btcpayserver/views/payment_transaction_views.xml similarity index 100% rename from payment_btcpay/views/payment_transaction_views.xml rename to payment_btcpayserver/views/payment_transaction_views.xml