Rename the module for publish on odoo marketplace. (#12)
* Rename the module for publish on odoo marketplace. * More renaming needed.
This commit is contained in:
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
## Accept bitcoin payments on Odoo 16 and 17
|
## 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.
|
This odoo addon allows you to accept bitcoin and Lightning Network (and other cryptocurrency) payments in your Odoo e-commerce store.
|
||||||

|

|
||||||
|
|
||||||
## How to install
|
## How to install
|
||||||
|
|
||||||
Please find the installation instructions here:
|
Please find the installation instructions here:
|
||||||
- [Odoo 17 documentation](https://github.com/btcpayserver/odoo/blob/17.0/payment_btcpay/README.md)
|
- [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_btcpay/README.md)
|
- [Odoo 16 documentation](https://github.com/btcpayserver/odoo/blob/16.0/payment_btcpayserver/README.md)
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<odoo noupdate="1">
|
|
||||||
|
|
||||||
<record id="payment_method_btcpay" model="payment.method">
|
|
||||||
<field name="name">Pay with Bitcoin / Lightning Network</field>
|
|
||||||
<field name="code">btcpay</field>
|
|
||||||
<field name="active">True</field>
|
|
||||||
<field name="image" type="base64" file="payment_btcpay/static/description/icon.png"/>
|
|
||||||
<field name="support_tokenization">False</field>
|
|
||||||
<field name="support_express_checkout">False</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="payment_provider_btcpay" model="payment.provider">
|
|
||||||
<field name="name">BTCPay payments</field>
|
|
||||||
<field name="code">btcpay</field>
|
|
||||||
<field name="image_128" type="base64" file="payment_btcpay/static/description/icon.png"/>
|
|
||||||
<field name="redirect_form_view_id" ref="redirect_form"/>
|
|
||||||
<field name="module_id" ref="base.module_payment_btcpay"/>
|
|
||||||
<field name="payment_method_ids"
|
|
||||||
eval="[Command.set([
|
|
||||||
ref('payment_btcpay.payment_method_btcpay'),
|
|
||||||
])]"
|
|
||||||
/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
## This is the module to connect Odoo 17 and BTCPay Server
|
## 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.
|
This module allows you to accept bitcoin (and other cryptocurrency) payments in your Odoo e-commerce store.
|
||||||

|

|
||||||
|
|
||||||
:::tip
|
:::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
|
## 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)
|
* 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
|
* 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
|
* Place the `payment_btcpayserver` directory in your Odoo addons directory
|
||||||
* Install dependencies by running `pip install -r requirements.txt` (from inside the `payment_btcpay` directory)
|
* Install dependencies by running `pip install -r requirements.txt` (from inside the `payment_btcpayserver` directory)
|
||||||
* Restart Odoo
|
* Restart Odoo
|
||||||
* Go to Apps -> Update Apps List
|
* Go to Apps -> Update Apps List
|
||||||
* Remove the "Apps" filter and search for "btcpay"
|
* 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.
|
Congrats, all done. Do some testing to be sure all works.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## How does the payment page look?
|
## 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.
|
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.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
## Transaction BTCPay Details
|
## 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
|
* Invoice Id: the id of the invoice for which you want to fetch an event token
|
||||||
* Transaction Status: That indicates state of transaction
|
* Transaction Status: That indicates state of transaction
|
||||||
|
|
||||||

|

|
||||||
@@ -7,8 +7,8 @@ from odoo.addons.payment import setup_provider, reset_payment_provider
|
|||||||
|
|
||||||
|
|
||||||
def post_init_hook(env):
|
def post_init_hook(env):
|
||||||
setup_provider(env, 'btcpay')
|
setup_provider(env, 'btcpayserver')
|
||||||
|
|
||||||
|
|
||||||
def uninstall_hook(env):
|
def uninstall_hook(env):
|
||||||
reset_payment_provider(env, 'btcpay')
|
reset_payment_provider(env, 'btcpayserver')
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# PAYMENT BTCPAY FOR ODOO
|
# PAYMENT BTCPAY SERVER FOR ODOO
|
||||||
#
|
#
|
||||||
# Copyright (C) 2024 Susanna Fort <susannafm@gmail.com>, ndeet
|
# Copyright (C) 2024 Susanna Fort <susannafm@gmail.com>, 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',
|
'summary': 'This module integrates BTCPAY - pay with Bitcoin - with Odoo v17.0',
|
||||||
'author': 'Vandekul, ndeet',
|
'author': 'Vandekul, ndeet',
|
||||||
'website': 'https://github.com/btcpayserver/odoo',
|
'website': 'https://github.com/btcpayserver/odoo',
|
||||||
'category': 'Accounting/Payment Providers',
|
'category': 'Accounting/Payment Providers',
|
||||||
'version': '17.0.1.1',
|
'version': '17.0.2.0',
|
||||||
'license': 'GPL-3',
|
'license': 'GPL-3',
|
||||||
'currency': 'USD',
|
'currency': 'USD',
|
||||||
'application': False,
|
'application': False,
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
'depends': ['base', 'account', 'payment'],
|
'depends': ['base', 'account', 'payment'],
|
||||||
'data': [
|
'data': [
|
||||||
'views/payment_btcpay_templates.xml',
|
'views/payment_btcpayserver_templates.xml',
|
||||||
'views/payment_provider_views.xml',
|
'views/payment_provider_views.xml',
|
||||||
'views/payment_transaction_views.xml',
|
'views/payment_transaction_views.xml',
|
||||||
'data/payment_provider_data.xml',
|
'data/payment_provider_data.xml',
|
||||||
@@ -48,7 +48,7 @@ class BTCPayController(http.Controller):
|
|||||||
def checkout(self, **data):
|
def checkout(self, **data):
|
||||||
|
|
||||||
_logger.info("CHECKOUT: notification received from BTCPay with data:\n%s", pprint.pformat(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
|
provider = tx_sudo.provider_id
|
||||||
notification_url = str(data.get('notify_url')).replace("http://", "https://")
|
notification_url = str(data.get('notify_url')).replace("http://", "https://")
|
||||||
base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||||
@@ -82,7 +82,7 @@ class BTCPayController(http.Controller):
|
|||||||
notification_data = {"reference": data['data']['orderId'],
|
notification_data = {"reference": data['data']['orderId'],
|
||||||
"invoiceID": data['data']['id']}
|
"invoiceID": data['data']['id']}
|
||||||
# Check the origin and integrity of the notification
|
# 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
|
provider = tx_sudo.provider_id
|
||||||
client = BTCPayClient(host=provider.btcpay_location, pem=provider.btcpay_privateKey,
|
client = BTCPayClient(host=provider.btcpay_location, pem=provider.btcpay_privateKey,
|
||||||
tokens={provider.btcpay_facade: provider.btcpay_token})
|
tokens={provider.btcpay_facade: provider.btcpay_token})
|
||||||
@@ -96,7 +96,7 @@ class BTCPayController(http.Controller):
|
|||||||
"txid": fetched_invoice['url']}
|
"txid": fetched_invoice['url']}
|
||||||
|
|
||||||
# Handle the notification data
|
# 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
|
except ValidationError: # Acknowledge the notification to avoid getting spammed
|
||||||
_logger.exception("Unable to handle the notification data; skipping to acknowledge")
|
_logger.exception("Unable to handle the notification data; skipping to acknowledge")
|
||||||
return ''
|
return ''
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo noupdate="1">
|
||||||
|
|
||||||
|
<record id="payment_method_btcpayserver" model="payment.method">
|
||||||
|
<field name="name">Pay with Bitcoin / Lightning Network</field>
|
||||||
|
<field name="code">btcpayserver</field>
|
||||||
|
<field name="active">True</field>
|
||||||
|
<field name="image" type="base64" file="payment_btcpayserver/static/description/icon.png"/>
|
||||||
|
<field name="support_tokenization">False</field>
|
||||||
|
<field name="support_express_checkout">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="payment_provider_btcpayserver" model="payment.provider">
|
||||||
|
<field name="name">BTCPay Server payments</field>
|
||||||
|
<field name="code">btcpayserver</field>
|
||||||
|
<field name="image_128" type="base64" file="payment_btcpayserver/static/description/icon.png"/>
|
||||||
|
<field name="redirect_form_view_id" ref="redirect_form"/>
|
||||||
|
<field name="module_id" ref="base.module_payment_btcpayserver"/>
|
||||||
|
<field name="payment_method_ids"
|
||||||
|
eval="[Command.set([
|
||||||
|
ref('payment_btcpayserver.payment_method_btcpayserver'),
|
||||||
|
])]"
|
||||||
|
/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
+5
-5
@@ -11,7 +11,7 @@ class PaymentProvider(models.Model):
|
|||||||
_inherit = 'payment.provider'
|
_inherit = 'payment.provider'
|
||||||
|
|
||||||
code = fields.Selection(
|
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_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')
|
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')
|
btcpay_facade = fields.Char(string='Facade', help='Token facade type: merchant/pos/payroll. Keep merchant', default='merchant')
|
||||||
|
|
||||||
def create(self, values_list):
|
def create(self, values_list):
|
||||||
if self.code == 'btcpay':
|
if self.code == 'btcpayserver':
|
||||||
values_list['btcpay_privateKey'] = crypto.generate_privakey()
|
values_list['btcpay_privateKey'] = crypto.generate_privakey()
|
||||||
|
|
||||||
return super(PaymentProvider, self).create(values_list)
|
return super(PaymentProvider, self).create(values_list)
|
||||||
|
|
||||||
@api.onchange('btcpay_pairingCode')
|
@api.onchange('btcpay_pairingCode')
|
||||||
def _onchange_pairingCode(self):
|
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)
|
#_logger.info("ONCHANGE PAIRING CODE***SELF: %s %s %s", self.btcpay_location, self.btcpay_privateKey, self.btcpay_pairingCode)
|
||||||
self.btcpay_privateKey = crypto.generate_privkey()
|
self.btcpay_privateKey = crypto.generate_privkey()
|
||||||
client = BTCPayClient(host=self.btcpay_location, pem=self.btcpay_privateKey)
|
client = BTCPayClient(host=self.btcpay_location, pem=self.btcpay_privateKey)
|
||||||
@@ -37,14 +37,14 @@ class PaymentProvider(models.Model):
|
|||||||
|
|
||||||
@api.onchange('btcpay_token')
|
@api.onchange('btcpay_token')
|
||||||
def _onchange_token(self):
|
def _onchange_token(self):
|
||||||
if self.code == 'btcpay':
|
if self.code == 'btcpayserver':
|
||||||
self.btcpay_pairingCode = ''
|
self.btcpay_pairingCode = ''
|
||||||
#_logger.info("ONCHANGE TOKEN")
|
#_logger.info("ONCHANGE TOKEN")
|
||||||
|
|
||||||
|
|
||||||
@api.onchange('btcpay_location')
|
@api.onchange('btcpay_location')
|
||||||
def _onchange_location(self):
|
def _onchange_location(self):
|
||||||
if self.code == 'btcpay':
|
if self.code == 'btcpayserver':
|
||||||
self.btcpay_token = ''
|
self.btcpay_token = ''
|
||||||
#_logger.info("ONCHANGE LOCATION ***SELF: %s %s %s", self.btcpay_location, self.btcpay_privateKey, self.btcpay_pairingCode)
|
#_logger.info("ONCHANGE LOCATION ***SELF: %s %s %s", self.btcpay_location, self.btcpay_privateKey, self.btcpay_pairingCode)
|
||||||
self.btcpay_privateKey = ''
|
self.btcpay_privateKey = ''
|
||||||
+4
-4
@@ -32,7 +32,7 @@ class PaymentTransaction(models.Model):
|
|||||||
|
|
||||||
res = super()._get_specific_rendering_values(processing_values)
|
res = super()._get_specific_rendering_values(processing_values)
|
||||||
|
|
||||||
if self.provider_code != 'btcpay':
|
if self.provider_code != 'btcpayserver':
|
||||||
return res
|
return res
|
||||||
|
|
||||||
base_url = self.provider_id.get_base_url()
|
base_url = self.provider_id.get_base_url()
|
||||||
@@ -68,11 +68,11 @@ class PaymentTransaction(models.Model):
|
|||||||
"""
|
"""
|
||||||
tx = super()._get_tx_from_notification_data(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))
|
_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
|
return tx
|
||||||
|
|
||||||
reference = notification_data.get('reference')
|
reference = notification_data.get('reference')
|
||||||
tx = self.search([('reference', '=', reference), ('provider_code', '=', 'btcpay')])
|
tx = self.search([('reference', '=', reference), ('provider_code', '=', 'btcpayserver')])
|
||||||
if not tx:
|
if not tx:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"BTCPay: " + _("No transaction found matching reference %s.", reference)
|
"BTCPay: " + _("No transaction found matching reference %s.", reference)
|
||||||
@@ -102,7 +102,7 @@ class PaymentTransaction(models.Model):
|
|||||||
:raise: ValidationError if inconsistent data were received
|
:raise: ValidationError if inconsistent data were received
|
||||||
"""
|
"""
|
||||||
super()._process_notification_data(notification_data)
|
super()._process_notification_data(notification_data)
|
||||||
if self.provider_code != 'btcpay':
|
if self.provider_code != 'btcpayserver':
|
||||||
return
|
return
|
||||||
|
|
||||||
_logger.info("_process_notification_data %s", pprint.pformat(notification_data))
|
_logger.info("_process_notification_data %s", pprint.pformat(notification_data))
|
||||||
+2
-2
@@ -26,8 +26,8 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Clone our [repository](https://github.com/btcpayserver/odoo) or download the .zip from the [releases page](https://github.com/btcpayserver/odoo/releases)
|
<li>Clone our [repository](https://github.com/btcpayserver/odoo) or download the .zip from the [releases page](https://github.com/btcpayserver/odoo/releases)
|
||||||
<li>Make sure you are on branch `17.0` or downloaded a release tagged with version v17.x
|
<li>Make sure you are on branch `17.0` or downloaded a release tagged with version v17.x
|
||||||
<li>Place the `payment_btcpay` directory in your Odoo addons directory
|
<li>Place the `payment_btcpayserver` directory in your Odoo addons directory
|
||||||
<li>Install dependencies by running `pip install -r requirements.txt` (from inside the `payment_btcpay` directory)
|
<li>Install dependencies by running `pip install -r requirements.txt` (from inside the `payment_btcpayserver` directory)
|
||||||
<li>Restart Odoo
|
<li>Restart Odoo
|
||||||
<li>Go to Apps -> Update Apps List
|
<li>Go to Apps -> Update Apps List
|
||||||
<li>Remove the "Apps" filter and search for "btcpay"
|
<li>Remove the "Apps" filter and search for "btcpay"
|
||||||
+2
-2
@@ -7,11 +7,11 @@
|
|||||||
<field name="inherit_id" ref="payment.payment_provider_form"/>
|
<field name="inherit_id" ref="payment.payment_provider_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<group name="provider_credentials" position='inside'>
|
<group name="provider_credentials" position='inside'>
|
||||||
<group invisible="code != 'btcpay'">
|
<group invisible="code != 'btcpayserver'">
|
||||||
<field name="btcpay_location"/>
|
<field name="btcpay_location"/>
|
||||||
<field name="btcpay_pairingCode"/>
|
<field name="btcpay_pairingCode"/>
|
||||||
</group>
|
</group>
|
||||||
<group invisible="code != 'btcpay'">
|
<group invisible="code != 'btcpayserver'">
|
||||||
<field name="btcpay_token"/>
|
<field name="btcpay_token"/>
|
||||||
<field name="btcpay_privateKey"/>
|
<field name="btcpay_privateKey"/>
|
||||||
<field name="btcpay_facade"/>
|
<field name="btcpay_facade"/>
|
||||||
Reference in New Issue
Block a user