Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CyberSource REST: Add commerce_indicator option override#5552

Open
romankhadka wants to merge 1 commit into
activemerchant:masterfrom
romankhadka:cybersource-rest-commerce-indicator
Open

CyberSource REST: Add commerce_indicator option override#5552
romankhadka wants to merge 1 commit into
activemerchant:masterfrom
romankhadka:cybersource-rest-commerce-indicator

Conversation

@romankhadka

Copy link
Copy Markdown

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 from stored_credential[:reason_type].

The SOAP gateway (CyberSourceGateway) already supports options[: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 list moto as one of many valid indicator values.

Changes

  • Add add_commerce_indicator private method that applies options[:commerce_indicator] as a final override after add_stored_credentials in build_auth_request
  • When the option is absent, existing behavior is completely unchanged
  • Follows the same add_* method convention used by every other line in build_auth_request

Tests

  • test_commerce_indicator_override — verifies override with "moto" on a regular credit card
  • test_commerce_indicator_override_with_stored_credentials — verifies override takes precedence over stored credential computed value
  • All 48 CyberSource REST tests pass (46 existing + 2 new)

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

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!

@github-actions github-actions Bot added the Stale label Jun 7, 2026
@romankhadka

Copy link
Copy Markdown
Author

Update: this still applies to the current build. PR #5552 is mergeable against current activemerchant:master, and the affected CyberSource REST tests pass on the PR merge ref.

Verification run locally with Ruby 3.2.2 across the CI gemfiles (rails50, rails51, rails52, rails60, rails_master):

BUNDLE_GEMFILE=<gemfile> bundle exec ruby -Itest test/unit/gateways/cyber_source_rest_test.rb

Each gemfile run completed with 48 tests, 249 assertions, 0 failures, and 0 errors. Please keep this PR open.

@github-actions github-actions Bot removed the Stale label Jun 18, 2026
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.
@romankhadka romankhadka force-pushed the cybersource-rest-commerce-indicator branch from 119d271 to a81b9fb Compare June 18, 2026 13:24
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.

1 participant