Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Api#create_transaction_for by improving the transaction ID generator #168

Open
benjaminwil opened this issue Feb 23, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@benjaminwil
Copy link
Member

In our extensions's Api#create_transaction_for(order) method, we noticed that we need to call OrderTransaction.latest_for(order)&.transaction_id in order to check if we already have a transaction reported.

We think that we can optimize our TransactionIdGenerator.next_transaction_id method to just always call `OrderTransaction.latest_for(order)&.transaction_id so that our API wrapper doesn't need to know about it.

Before:

  latest_transaction_id =
    OrderTransaction.latest_for(order)&.transaction_id

  transaction_id = TransactionIdGenerator.next_transaction_id(
    order: order,
    current_transaction_id: latest_transaction_id
  )

After:

  transaction_id =
    TransactionIdGenerator.next_transaction_id(order: order)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant