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

DEPRECATED: CybersourceREST - Refund | Credit #4696

Conversation

sinourain
Copy link
Contributor

@sinourain sinourain commented Feb 10, 2023

IMPORTANT NOTE: I will create a new PR because I made this based in my personal folk repository

Description

This integration support the following payment operations:

  • Refund
  • Credit

Unit test

Finished in 29.776044 seconds.
5452 tests, 77126 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Remote test

183.10 tests/s, 2590.20 assertions/s

Rubocop

760 files inspected, no offenses detected

GWI-471

CybersourceRest: adding gateway

Summary:
------------------------------
Adding CybersourceRest gateway with authorize and purchase
calls.

GWI-474

Remote Test:
------------------------------

Finished in 3.6855 seconds.
6 tests, 17 assertions, 1 failures, 0 errors, 0 pendings,
0 omissions, 0 notifications
100% passed

Unit Tests:
------------------------------
Finished in 35.528692 seconds.
5441 tests, 77085 assertions, 0 failures, 0 errors, 0 pendings,
0 omissions, 0 notifications
100% passed

RuboCop:
------------------------------
760 files inspected, no offenses detected
Copy link
Collaborator

@javierpedrozaing javierpedrozaing left a comment

Choose a reason for hiding this comment

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

Good job @sinourain

💡 I can see that the '/pts/v2/' is repeated in each request, maybe we could remove it for each request and add it in the url function

Every commit call would be similar to

        commit('/credits', post)

and in the url function concat /pts/v2/

      def url(action)
        "#{(test? ? test_url : live_url)}/pts/v2/#{action}"
      end

also if you concider this update, you need to update this line in the get_http_signature function

       "(request-target)": "#{http_method} /pts/v2/#{resource}",

def refund(money, options = {})
post = build_refund_request(money, options)

yield post if block_given?
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Comment:

Unless this a copy-paste mistake, do you have a purpose for that yield ?, on authorize/purchase it had one but not sure here ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I was wrong copy / paste this approach and it is only necessary for the purchase/authorization methods

Copy link
Collaborator

@Heavyblade Heavyblade left a comment

Choose a reason for hiding this comment

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

@sinourain left some comments,

def refund(money, options = {})
post = build_refund_request(money, options)

yield post if block_given?
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Comment:

Unless this a copy-paste mistake, do you have a purpose for that yield ?, on authorize/purchase it had one but not sure here ...

def credit(money, payment, options = {})
post = build_credit_request(money, payment, options)

yield post if block_given?
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Comment:

Same comment here ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I was wrong copy / paste this approach and it is only necessary for the purchase/authorization methods

add_code(post, options)
add_credit_card(post, payment)
add_amount(post, amount)
add_address(post, payment, options[:billing_address], options, :billTo)
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Comment:

Seems that add_merchant_description is missing here ... comparing the actual implementation against the old one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

assert_equal 'PENDING', response.message
assert response.params['id'].present?
assert_nil response.params['_links']['capture']
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Comment:

Maybe is a good idea to test not just the happy path:

  • maybe checking how to handle error handling in case of a double refund
  • doing partial refunds and values above the initial transaction
  • credits on invalid credit cards
  • etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Description
-------------------------
This integration support the following payment operations:
- Refund
- Credit

Unit test
-------------------------
Finished in 37.39707 seconds.
5452 tests, 77126 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Remote test
-------------------------
145.79 tests/s, 2062.35 assertions/s

Rubocop
-------------------------
760 files inspected, no offenses detected

GWI-471
@sinourain sinourain force-pushed the cybersource_rest_refund_credit branch from 86556a2 to e6ce0bf Compare February 15, 2023 20:30
@Heavyblade Heavyblade force-pushed the add_cybersource_rest_gateway branch from 72ba52f to 729026a Compare February 15, 2023 22:52
@sinourain sinourain changed the title CybersourceREST - Refund | Credit DEPRECATED: CybersourceREST - Refund | Credit Feb 16, 2023
@sinourain
Copy link
Contributor Author

I created a new PR because I made this based in my personal folk repository

@sinourain sinourain closed this Feb 16, 2023
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.

3 participants