Skip to content

Paypal Authentication migration to gem#165

Merged
praweb merged 21 commits intomasterfrom
feature/migrate_paypal_polling_to_gem
Apr 16, 2019
Merged

Paypal Authentication migration to gem#165
praweb merged 21 commits intomasterfrom
feature/migrate_paypal_polling_to_gem

Conversation

@praweb
Copy link
Copy Markdown
Contributor

@praweb praweb commented Nov 29, 2018

This PR handles first part of https://github.com/shiftcommerce/matalan-rails-site/issues/2388#issuecomment-442129990

We have migrated the auth and order creation process to the gem. We also have introduced retries around the paypal process, as we know the Paypal Auth process is most time taking one, and the possibility of timeouts around it is more.

@praweb praweb changed the title Integrate auth process with paypal express - WIP Paypal Authentication migration to gem - WIP Nov 29, 2018
@praweb praweb self-assigned this Nov 29, 2018
@praweb praweb changed the title Paypal Authentication migration to gem - WIP Paypal Authentication migration to gem Dec 10, 2018
end

def do_express_checkout_payment
Retry.call(rescue_errors: ::ActiveMerchant::ConnectionError) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are any connection errors, this method will be retried. By default it will retry twice.



def do_authorization(response)
Retry.call(rescue_errors: ::ActiveMerchant::ConnectionError) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Any connection errors will be retried twice.

lib/retry.rb Outdated
retry if total_attempts < no_of_retries
ensure
if total_attempts == no_of_retries
# notity logging/monitoring system here
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need addressing?

end

def is_user_error?(response)
(USER_ERRORS.keys & response_error_codes(response)).present?
Copy link
Copy Markdown
Contributor

@RichardWatkins1 RichardWatkins1 Dec 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this conditional. Surely USER_ERRORS.keys will always return an array of keys so there's no point in checking if it's present?. the & will combine the arrays.

@praweb praweb merged commit 0b858fe into master Apr 16, 2019
@RichardWatkins1 RichardWatkins1 deleted the feature/migrate_paypal_polling_to_gem branch April 24, 2019 08:29
@praweb praweb restored the feature/migrate_paypal_polling_to_gem branch August 22, 2019 09:53
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