-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
CyberSource: Refactor and add support for several fields #4623
Conversation
@@ -527,7 +554,7 @@ def test_authorize_and_capture | |||
assert auth = @gateway.authorize(@amount, @credit_card, @options) | |||
assert_successful_response(auth) | |||
|
|||
assert capture = @gateway.capture(@amount, auth.authorization) | |||
assert capture = @gateway.capture(@amount, auth.authorization, @capture_options) | |||
assert_successful_response(capture) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is testing for gratuity_amount
} | ||
merchant_descriptor_name: 'Test Name', | ||
merchant_descriptor_address1: '123 Main Dr', | ||
merchant_descriptor_locality: 'Durham' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test passes as implemented, but that's because the fields are not added as top level options. I was on the fence about whether to deal with this issue now or leave it for a later clean up task, so I'd love to hear your thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test failure just exposes that this field implementation was already broken
invoice_number: '123', | ||
mobile_remote_payment_type: 'A1', | ||
vat_tax_rate: '1' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't end up writing tests for each individual field, bc it seemed more important to make sure they'd be added to the request in order no matter the transaction type so I added them to the main options hash. I did include a few remote tests or addition where the situation seemed to call for it, like adding the capture_options
since that field would only be added to a capture request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's reasonable; given the strictness of the XML parser errors that you fought with, if this options hash doesn't cause problems throughout the test suite, we can assume the fields are applied safely to the request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me - your work has uncovered that there is an existing issue with the add_merchant_description
method, but that can be addressed in a separate task
} | ||
merchant_descriptor_name: 'Test Name', | ||
merchant_descriptor_address1: '123 Main Dr', | ||
merchant_descriptor_locality: 'Durham' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test failure just exposes that this field implementation was already broken
invoice_number: '123', | ||
mobile_remote_payment_type: 'A1', | ||
vat_tax_rate: '1' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's reasonable; given the strictness of the XML parser errors that you fought with, if this options hash doesn't cause problems throughout the test suite, we can assume the fields are applied safely to the request
8a2715f
to
a3a1959
Compare
CER-243 This PR refactors the order of some methods to prevent XML parse errors. It also adds support for the following fields: installment_gracePeriodDuration taxManagementIndicator purchaseTotals_invoiceAmount purchaseTotals_originalAmount invoiceHeader_referenceDataCode invoiceHeader_invoiceNumber ccCaptureService_gratuityAmount ccAuthService_mobileRemotePaymentType otherTax_vatTaxRate Local: 5371 tests, 76705 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed Remote: 118 tests, 600 assertions, 4 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 96.6102% passed There is one additional remote test failure due to the fields not being added at the top level. Unit: 123 tests, 588 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed
a3a1959
to
9b4ffcc
Compare
CER-243
This PR refactors the order of some methods to prevent XML parse errors. It also adds support for the following fields:
installment_gracePeriodDuration
taxManagementIndicator
purchaseTotals_invoiceAmount
purchaseTotals_originalAmount
invoiceHeader_referenceDataCode
invoiceHeader_invoiceNumber
ccCaptureService_gratuityAmount
ccAuthService_mobileRemotePaymentType
otherTax_vatTaxRate
Local:
5371 tests, 76705 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed
Remote:
118 tests, 600 assertions, 4 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 96.6102% passed
There is one additional remote test failure due to the fields not being added at the top level.
Unit:
123 tests, 588 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed