module Paylike

Paylike HTTP API Client

Constants

THREE_D_SECURE_CALLBACK_URI

The 3D Secure callback URI

THREE_D_SECURE_ERROR_CODE

The 3D Secure error code

VERSION

Public Class Methods

extract_threedsecure_data(error, uid) click to toggle source

Validates and extracts 3D Secure related data from an error response

@param error [ApiClient::ResponseError] the response error to extract from @param uid [String] the unique identifier to use as the 3D Secure `MD` value

@return [Hash] on valid 3D Secure response errors

# File lib/paylike.rb, line 19
def self.extract_threedsecure_data(error, uid)
  resp_data = error.response_data

  if resp_data.nil? || resp_data['code'].to_i != THREE_D_SECURE_ERROR_CODE
    return
  end

  {
    threedsecure_url: resp_data['tds']['url'],
    threedsecure_data: {
      MD: uid,
      TermUrl: THREE_D_SECURE_CALLBACK_URI,
      PaReq: resp_data['tds']['pareq']
    }
  }
end