Skip to content

Refactor modules#9

Open
bosd wants to merge 38 commits intomonero-integrations:14.0from
bosd:14.0
Open

Refactor modules#9
bosd wants to merge 38 commits intomonero-integrations:14.0from
bosd:14.0

Conversation

@bosd
Copy link
Copy Markdown

@bosd bosd commented Jul 29, 2022

Creating this PR her, did a lot of refactoring.
as described in: #6

@bosd
Copy link
Copy Markdown
Author

bosd commented Mar 13, 2024

Not all of the Todo is covered yet.
Not sure if I can do that all within a short timeframe.

Since there is new interest in this module.
Maybe better to merge this refactor as is.

So improvements can be handled in later pr's and migration of this module and it dependents can continue.

Therefore marking this pr as ready.

@bosd bosd marked this pull request as ready for review March 14, 2024 12:19
@bosd bosd changed the title [WIP] Refactor modules Refactor modules Mar 16, 2024
@bosd bosd force-pushed the 14.0 branch 2 times, most recently from 07d62c8 to 3bc37ce Compare March 17, 2024 15:03
niyid added a commit to niyid/moneroodoo that referenced this pull request Mar 16, 2026
models/monero_daemon.py:
- get_daemon_status_summary: order by last_checked desc not id desc (monero-integrations#1)
- cleanup_old_records: order by last_checked desc not id desc (monero-integrations#2)

models/monero_payment.py:
- Replace hmac.new() with hmac.HMAC().hexdigest() (monero-integrations#4)

models/monero_transaction.py:
- confirmations field: store=False so value is always live from
  daemon cache, never stale after block_height is set (monero-integrations#9)

models/payment_provider.py:
- Remove duplicate inline 'import time' inside _fetch_xmr_rate (monero-integrations#12)
- Replace 1e12 float with integer 1_000_000_000_000 in piconero
  conversion (monero-integrations#13)
- Remove unused provider param from _generate_subaddress (monero-integrations#14)

controllers/main.py:
- Add missing 'import base64' — critical NameError fix (monero-integrations#15)
- Replace _verify_access_token() with _validate_order_access() for
  Odoo 18 compatibility (monero-integrations#16)
- Log swallowed exception in monero_payment_processor before
  redirecting to error page (monero-integrations#17)

tests/test_sales_order.py:
- Fix invalid state assertion: 'done'/'paid' are not valid
  monero.payment states, only 'confirmed' is (monero-integrations#20)
- Replace datetime.utcnow() with datetime.now(tz=timezone.utc) (monero-integrations#21)
- Fix MAX(payment_id) on Char field to MAX(id) on integer PK (monero-integrations#22)
- Replace warnings.warn() with proper skip pattern (monero-integrations#23)
- Add assertions to address reuse scenario (monero-integrations#24)

tests/test_payment_provider.py:
- Fix _payment_confirmed(payment, {...}) to _payment_confirmed({...})
  matching the fixed single-arg signature (#25)
- Fix _generate_subaddress(self.provider, ...) to _generate_subaddress(...)
  matching the fixed no-provider-param signature
niyid added a commit to niyid/moneroodoo that referenced this pull request Mar 16, 2026
…n documentation

models/monero_payment.py:
- amount: add IEEE 754 / sub-piconero precision warning to help text
- amount_received: same
- amount_due: same
- original_amount: same
- exchange_rate: same

All other 14 v3 review issues were already applied in the uploaded version:
- monero-integrations#1  is_confirmed store=False (non-stored dep cannot trigger stored recompute)
- monero-integrations#2  _order = 'create_date desc' (timestamp is nullable)
- monero-integrations#3  monero_payment.confirmations store=False (cross-model non-stored dep)
- monero-integrations#4  _get_status_message: provider.confirmation_threshold guarded against empty recordset
- monero-integrations#5  check_payment_status: explicit UserError when no provider configured
- monero-integrations#7  _validate_and_lock_order uses hmac.compare_digest
- monero-integrations#8  access_token forwarding documented in controller
- monero-integrations#9  comment documenting status vs state key name difference
- monero-integrations#11 payment_form_monero.js includes access_token in RPC payload
- monero-integrations#13 monero.daemon record created in test setUp for confirmation tests
- monero-integrations#14 selective env.ref mock in test_payment_confirmed_posts_message
- monero-integrations#15 unused import warnings removed from test_sales_order.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants