【问题标题】:ActiveMerchant Cybersource Authorization Error Reason 102ActiveMerchant Cyber​​source 授权错误原因 102
【发布时间】:2021-03-05 11:10:55
【问题描述】:

我正在使用ActiveMerchant 1.117.0 调试当前在Ruby 2.5.8 上运行的应用程序。

我能够成功创建并保存订阅。但是,当我尝试授权保存的卡时,我不断收到reasonCode 102。 Cyber​​source 网关端的错误是the subscription () could not be found

我正在尝试使用该功能进行授权:

  def authorize(token, amount, order_id, line_items)
    response = gateway.authorize(amount, token, order_id: order_id, line_items: line_items)
    if !response.success?
      raise Exceptions::ChargeFailed.new(response.message, response: response)
    end
    response
  end

这个错误会让我相信这里的格式不正确。谁能指出一些有效的 ActiveMerchant Cyber​​Source 示例来授权订阅或指出这里可能有什么问题?

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-5 rails-activerecord cybersource


    【解决方案1】:

    经过一番挖掘,令牌分配的逻辑似乎在 ActiveMerchant Cyber​​Source gem 内部发生了变化

    原来的逻辑是:

    if reference
        _, subscription_id, _ = reference.split(";")
        xml.tag! 'subscriptionID',  subscription_id
    end
    

    转向的最新版本:

    if reference
        subscription_id = reference.split(";")[6]
        xml.tag! 'subscriptionID',  subscription_id
    end
    

    我之前使用的应用程序将 Cyber​​Source 配置文件/订阅 ID 格式化为 ;#{token};。为了使用这些最新更新,令牌需要格式化为;;;;;;#{token}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-13
      • 2015-12-21
      • 2017-08-31
      • 1970-01-01
      • 2016-05-13
      • 2023-04-03
      • 1970-01-01
      • 2018-02-16
      相关资源
      最近更新 更多