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

Flex Charge: Add support for TPV store #5120

Merged
merged 3 commits into from
May 20, 2024

Conversation

edgarv09
Copy link
Contributor

Flex Charge: Add support for the TPV store

Test summary:
Local:
5898 tests, 79569 assertions, 0 failures, 17 errors, 0 pendings, 0 omissions, 0 notifications 99.7118% passed
Unit:
12 tests, 58 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed
Remote:
13 tests, 34 assertions, 1 failures, 0 errors, 0 pendings, 1 omissions, 0 notifications 91.6667% passed

Copy link
Collaborator

@gasb150 gasb150 left a comment

Choose a reason for hiding this comment

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

@edgarv09 It's pretty good. I left a few comments to your consideration.

test/unit/gateways/flex_charge_test.rb Show resolved Hide resolved
@@ -115,23 +135,29 @@ def add_invoice(post, money, credit_card, options)
avsResultCode: options[:avs_result_code],
cvvResultCode: options[:cvv_result_code],
cavvResultCode: options[:cavv_result_code],
cardNotPresent: credit_card.verification_value.blank?
cardNotPresent: credit_card.is_a?(String) ? false : credit_card.verification_value.blank?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just confirming: for TPV the cardNotPresent value will always be false.

But for credit cards, will it be something true if no verification value is provided?

Copy link
Contributor Author

@edgarv09 edgarv09 May 15, 2024

Choose a reason for hiding this comment

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

Flex charge Documentation is not clear on this topic but the error messages during the testing led me to this conclusion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds reasonable 👍

@edgarv09 edgarv09 force-pushed the SER-1149_flex_charge_store branch from 7c4f059 to 4bf9913 Compare May 15, 2024 14:30
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.

@edgarv09 looks pretty much ok, left a couple comments for your consideration

}.compact
}

post = { payment_method: payment_method }
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Comment / Style:

Is just matter of taste but, for your consideration =>

post[:payment_method] = {
  credit_card: {
    first_name: first_name,
    last_name: last_name,
    month: credit_card.month,
    year: credit_card.year,
    number: credit_card.number,
    verification_value: credit_card.verification_value
  }.compact
}

@@ -115,23 +135,29 @@ def add_invoice(post, money, credit_card, options)
avsResultCode: options[:avs_result_code],
cvvResultCode: options[:cvv_result_code],
cavvResultCode: options[:cavv_result_code],
cardNotPresent: credit_card.verification_value.blank?
cardNotPresent: credit_card.is_a?(String) ? false : credit_card.verification_value.blank?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds reasonable 👍

}.compact
payment_method = case credit_card
when String
{ token: true, cardNumber: credit_card }
Copy link
Collaborator

Choose a reason for hiding this comment

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

❓ Question:

Is weird because I assume that it works for you but, does it work with token and Token ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems to work with lower/upper case.

def authorization_from(response)
response[:orderSessionKey]
def authorization_from(action, response)
action == :store ? response[:transaction][:payment_method][:token] : response[:orderSessionKey]
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Comment:

Just in case of unexpected scenarios dig is a safer way to get the token

Test summary:
Local:
5898 tests, 79569 assertions, 0 failures, 17 errors, 0 pendings, 0 omissions, 0 notifications
99.7118% passed
Unit:
12 tests, 58 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
Remote:
13 tests, 34 assertions, 1 failures, 0 errors, 0 pendings, 1 omissions, 0 notifications
91.6667% passed
@edgarv09 edgarv09 force-pushed the SER-1149_flex_charge_store branch from 4bf9913 to 5232f00 Compare May 17, 2024 21:08
CHANGELOG Outdated
@@ -2,6 +2,7 @@
= ActiveMerchant CHANGELOG

== HEAD
* FlexCharge: Add support for TPV store [edgarv09] #5120
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Comment,

This should be a the bottom of the block

@edgarv09 edgarv09 merged commit 5278776 into activemerchant:master May 20, 2024
0 of 5 checks passed
@edgarv09 edgarv09 deleted the SER-1149_flex_charge_store branch May 20, 2024 15:25
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.

None yet

3 participants