CyberSource REST: Add commerce_indicator option override#5552
CyberSource REST: Add commerce_indicator option override#5552romankhadka wants to merge 1 commit into
Conversation
|
To provide a cleaner slate for the maintenance of the library, this PR/Issue is being labeled stale after 60 days without activity. It will be closed in 14 days unless you comment with an update regarding its applicability to the current build. Thank you! |
|
Update: this still applies to the current build. PR #5552 is mergeable against current Verification run locally with Ruby 3.2.2 across the CI gemfiles (
Each gemfile run completed with 48 tests, 249 assertions, 0 failures, and 0 errors. Please keep this PR open. |
The CyberSource REST API accepts many values for processingInformation.commerceIndicator (moto, retail, recurring, install, internet, etc.) but the gateway only computes three of them from stored_credential reason_type. The SOAP gateway already supports an options[:commerce_indicator] pass-through; this brings parity to the REST gateway. Add add_commerce_indicator that runs after add_stored_credentials in build_auth_request, allowing callers to override the computed indicator with any valid value. When the option is absent, existing behavior is unchanged.
119d271 to
a81b9fb
Compare
Summary
The CyberSource REST API accepts many values for
processingInformation.commerceIndicator(moto,retail,recurring,install,internet, etc.) but the gateway only computes three of them fromstored_credential[:reason_type].The SOAP gateway (
CyberSourceGateway) already supportsoptions[:commerce_indicator]as a direct pass-through (line 843). This brings the same capability to the REST gateway for parity.Use Case
MOTO (Mail Order/Telephone Order) transactions require
commerceIndicator: "moto". Without this option, there is no way to set it via the REST gateway. The CyberSource docs listmotoas one of many valid indicator values.Changes
add_commerce_indicatorprivate method that appliesoptions[:commerce_indicator]as a final override afteradd_stored_credentialsinbuild_auth_requestadd_*method convention used by every other line inbuild_auth_requestTests
test_commerce_indicator_override— verifies override with"moto"on a regular credit cardtest_commerce_indicator_override_with_stored_credentials— verifies override takes precedence over stored credential computed value