Sha256: 4109d6819f120e63a806354a013fdfd4f6a419a9929970357622b2434f1fe858

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

require 'uri'

module Wayforpay
  module Constants
    URL = URI.parse('https://api.wayforpay.com/api').freeze

    HOLD_ENCRYPT_FIELDS = %i[merchantAccount merchantDomainName orderReference orderDate amount currency productName productCount productPrice].freeze
    REFUND_ENCRYPT_FIELDS = %i[merchantAccount orderReference amount currency].freeze
    SETTLE_ENCRYPT_FIELDS = %i[merchantAccount orderReference amount currency].freeze
    VERIFY_ENCRYPT_FIELDS = %i[merchantAccount merchantDomainName orderReference amount currency].freeze

    HOLD_ATTRS = {
      transactionType: 'CHARGE',
      authorizationType: 'SimpleSignature',
      merchantTransactionType: 'AUTH',
      merchantTransactionSecureType: 'NON3DS',
      apiVersion: 1
    }.freeze

    REFUND_ATTRS = {
      transactionType: 'REFUND',
      apiVersion: 1
    }.freeze

    SETTLE_ATTRS = {
      transactionType: 'SETTLE',
      apiVersion: 1
    }.freeze

    VERIFY_ATTRS = {
      transactionType: 'VERIFY',
      apiVersion: 1
    }.freeze

    def self.hold_params
      HOLD_ATTRS.merge(
        merchantAccount: Wayforpay.merchant_account,
        merchantDomainName: Wayforpay.merchant_domain_name
      )
    end

    def self.refund_params
      REFUND_ATTRS.merge(merchantAccount: Wayforpay.merchant_account)
    end

    def self.settle_params
      SETTLE_ATTRS.merge(merchantAccount: Wayforpay.merchant_account)
    end

    def self.verify_params
      VERIFY_ATTRS.merge(
        merchantAccount: Wayforpay.merchant_account,
        merchantDomainName: Wayforpay.merchant_domain_name
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wayforpay-0.1.4 lib/wayforpay/constants.rb