From 706860e35f9e2f5f35146e364b75ea0950048a3e Mon Sep 17 00:00:00 2001 From: ndeet Date: Mon, 12 Aug 2024 15:33:59 +0200 Subject: [PATCH] Rename the module for publish on odoo marketplace. (#12) * Rename the module for publish on odoo marketplace. * More renaming needed. --- README.md | 6 ++-- payment_btcpay/data/payment_provider_data.xml | 26 ------------------ .../LICENSE.txt | 0 .../README.md | 14 +++++----- .../__init__.py | 4 +-- .../__manifest__.py | 8 +++--- .../controllers/__init__.py | 0 .../controllers/main.py | 6 ++-- .../data/payment_provider_data.xml | 26 ++++++++++++++++++ .../models/__init__.py | 0 .../models/libs/__init__.py | 0 .../models/libs/client.py | 0 .../models/libs/crypto.py | 0 .../models/payment_provider.py | 10 +++---- .../models/payment_transaction.py | 8 +++--- .../requirements.txt | 0 .../description/BTCPay-Odoo-17-featured.png | Bin .../static/description/BTCPayLooksLike.png | Bin .../description/BTCPayPaymentSettings.png | Bin .../static/description/BTCPayServer_org.png | Bin .../static/description/BtcpayTxDetails.png | Bin .../static/description/icon.png | Bin .../static/description/index.html | 4 +-- .../views/payment_btcpayserver_templates.xml | 0 .../views/payment_provider_views.xml | 4 +-- .../views/payment_transaction_views.xml | 0 26 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 payment_btcpay/data/payment_provider_data.xml rename {payment_btcpay => payment_btcpayserver}/LICENSE.txt (100%) rename {payment_btcpay => payment_btcpayserver}/README.md (84%) rename {payment_btcpay => payment_btcpayserver}/__init__.py (74%) rename {payment_btcpay => payment_btcpayserver}/__manifest__.py (90%) rename {payment_btcpay => payment_btcpayserver}/controllers/__init__.py (100%) rename {payment_btcpay => payment_btcpayserver}/controllers/main.py (96%) create mode 100644 payment_btcpayserver/data/payment_provider_data.xml rename {payment_btcpay => payment_btcpayserver}/models/__init__.py (100%) rename {payment_btcpay => payment_btcpayserver}/models/libs/__init__.py (100%) rename {payment_btcpay => payment_btcpayserver}/models/libs/client.py (100%) rename {payment_btcpay => payment_btcpayserver}/models/libs/crypto.py (100%) rename {payment_btcpay => payment_btcpayserver}/models/payment_provider.py (87%) rename {payment_btcpay => payment_btcpayserver}/models/payment_transaction.py (96%) rename {payment_btcpay => payment_btcpayserver}/requirements.txt (100%) rename {payment_btcpay => payment_btcpayserver}/static/description/BTCPay-Odoo-17-featured.png (100%) rename {payment_btcpay => payment_btcpayserver}/static/description/BTCPayLooksLike.png (100%) rename {payment_btcpay => payment_btcpayserver}/static/description/BTCPayPaymentSettings.png (100%) rename {payment_btcpay => payment_btcpayserver}/static/description/BTCPayServer_org.png (100%) rename {payment_btcpay => payment_btcpayserver}/static/description/BtcpayTxDetails.png (100%) rename {payment_btcpay => payment_btcpayserver}/static/description/icon.png (100%) rename {payment_btcpay => payment_btcpayserver}/static/description/index.html (97%) rename payment_btcpay/views/payment_btcpay_templates.xml => payment_btcpayserver/views/payment_btcpayserver_templates.xml (100%) rename {payment_btcpay => payment_btcpayserver}/views/payment_provider_views.xml (86%) rename {payment_btcpay => payment_btcpayserver}/views/payment_transaction_views.xml (100%) diff --git a/README.md b/README.md index 0697843..4383888 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ ## Accept bitcoin payments on Odoo 16 and 17 This odoo addon allows you to accept bitcoin and Lightning Network (and other cryptocurrency) payments in your Odoo e-commerce store. -![BTCPay Server Banner](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/payment_btcpay/static/description/BTCPay-Odoo-17-featured.png) +![BTCPay Server Banner](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/payment_btcpayserver/static/description/BTCPay-Odoo-17-featured.png) ## How to install Please find the installation instructions here: -- [Odoo 17 documentation](https://github.com/btcpayserver/odoo/blob/17.0/payment_btcpay/README.md) -- [Odoo 16 documentation](https://github.com/btcpayserver/odoo/blob/16.0/payment_btcpay/README.md) \ No newline at end of file +- [Odoo 17 documentation](https://github.com/btcpayserver/odoo/blob/17.0/payment_btcpayserver/README.md) +- [Odoo 16 documentation](https://github.com/btcpayserver/odoo/blob/16.0/payment_btcpayserver/README.md) \ No newline at end of file diff --git a/payment_btcpay/data/payment_provider_data.xml b/payment_btcpay/data/payment_provider_data.xml deleted file mode 100644 index 6865a0b..0000000 --- a/payment_btcpay/data/payment_provider_data.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Pay with Bitcoin / Lightning Network - btcpay - True - - False - False - - - - BTCPay payments - btcpay - - - - - - - \ 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 84% rename from payment_btcpay/README.md rename to payment_btcpayserver/README.md index 254e5a9..b407258 100644 --- a/payment_btcpay/README.md +++ b/payment_btcpayserver/README.md @@ -2,17 +2,17 @@ ## This is the module to connect Odoo 17 and BTCPay Server This module allows you to accept bitcoin (and other cryptocurrency) payments in your Odoo e-commerce store. -![BTCPay Server Banner](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/payment_btcpay/static/description/BTCPay-Odoo-17-featured.png) +![BTCPay Server Banner](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/payment_btcpayserver/static/description/BTCPay-Odoo-17-featured.png) :::tip -If you use Odoo 16 you can find the documentation [here](https://github.com/btcpayserver/odoo/blob/16.0/payment_btcpay/README.md). +If you use Odoo 16 you can find the documentation [here](https://github.com/btcpayserver/odoo/blob/16.0/payment_btcpayserver/README.md). ::: ## 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 `17.0` or downloaded a release tagged with version v17.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" @@ -46,13 +46,13 @@ Check the payment method is enabled: Congrats, all done. Do some testing to be sure all works. -![Payment Provider Settings](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/payment_btcpay/static/description/BTCPayPaymentSettings.png) +![Payment Provider Settings](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/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. -![Checkout page example](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/payment_btcpay/static/description/BTCPayLooksLike.png) +![Checkout page example](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/payment_btcpayserver/static/description/BTCPayLooksLike.png) ## Transaction BTCPay Details @@ -61,4 +61,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 details of BTCPay](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/payment_btcpay/static/description/BtcpayTxDetails.png) +![Transaction details of BTCPay](https://raw.githubusercontent.com/btcpayserver/odoo/17.0/payment_btcpayserver/static/description/BtcpayTxDetails.png) diff --git a/payment_btcpay/__init__.py b/payment_btcpayserver/__init__.py similarity index 74% rename from payment_btcpay/__init__.py rename to payment_btcpayserver/__init__.py index fb28475..ac01670 100644 --- a/payment_btcpay/__init__.py +++ b/payment_btcpayserver/__init__.py @@ -7,8 +7,8 @@ def post_init_hook(env): - setup_provider(env, 'btcpay') + setup_provider(env, 'btcpayserver') def uninstall_hook(env): - reset_payment_provider(env, 'btcpay') \ No newline at end of file + reset_payment_provider(env, 'btcpayserver') \ No newline at end of file diff --git a/payment_btcpay/__manifest__.py b/payment_btcpayserver/__manifest__.py similarity index 90% rename from payment_btcpay/__manifest__.py rename to payment_btcpayserver/__manifest__.py index d3f1c58..f0b6603 100644 --- a/payment_btcpay/__manifest__.py +++ b/payment_btcpayserver/__manifest__.py @@ -1,5 +1,5 @@ #****************************************************************************** -# PAYMENT BTCPAY FOR ODOO +# PAYMENT BTCPAY SERVER FOR ODOO # # Copyright (C) 2024 Susanna Fort , ndeet # @@ -20,12 +20,12 @@ #****************************************************************************** { - 'name': 'Payment Provider: BTCPay', + 'name': 'Payment Provider: BTCPay Server', 'summary': 'This module integrates BTCPAY - pay with Bitcoin - with Odoo v17.0', 'author': 'Vandekul, ndeet', 'website': 'https://github.com/btcpayserver/odoo', 'category': 'Accounting/Payment Providers', - 'version': '17.0.1.1', + 'version': '17.0.2.0', 'license': 'GPL-3', 'currency': 'USD', 'application': False, @@ -33,7 +33,7 @@ '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', 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_btcpayserver/data/payment_provider_data.xml b/payment_btcpayserver/data/payment_provider_data.xml new file mode 100644 index 0000000..3ab611c --- /dev/null +++ b/payment_btcpayserver/data/payment_provider_data.xml @@ -0,0 +1,26 @@ + + + + + Pay with Bitcoin / Lightning Network + btcpayserver + True + + False + False + + + + BTCPay Server payments + btcpayserver + + + + + + + \ No newline at end of file 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-17-featured.png b/payment_btcpayserver/static/description/BTCPay-Odoo-17-featured.png similarity index 100% rename from payment_btcpay/static/description/BTCPay-Odoo-17-featured.png rename to payment_btcpayserver/static/description/BTCPay-Odoo-17-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_btcpay/static/description/index.html b/payment_btcpayserver/static/description/index.html similarity index 97% rename from payment_btcpay/static/description/index.html rename to payment_btcpayserver/static/description/index.html index bf4c75b..ebecff6 100644 --- a/payment_btcpay/static/description/index.html +++ b/payment_btcpayserver/static/description/index.html @@ -26,8 +26,8 @@

Install the module