Module: Payment::PaymentTypes

Included in:
Gateway
Defined in:
app/my_lib/payment/payment_types.rb

Overview

Constants for payment types used across the payment gateway system These constants ensure type safety and prevent typos when referencing payment methods

Usage:

Payment::Gateway.new(payment_type: Payment::PaymentTypes::CREDIT_CARD)
Payment::Gateway.new(payment_type: Payment::PaymentTypes::PROMPTPAY)

Constant Summary collapse

CREDIT_CARD =

Credit card payment via various providers (Omise, GB PrimePay, etc.)

'credit_card'
PROMPTPAY =

PromptPay (Thailand) / PayNow (Singapore) QR code payment

'promptpay'
TRUE_WALLET =

TrueWallet e-wallet payment

'true_wallet'
SHOPEE_PAY =

Shopee Pay e-wallet payment

'shopee_pay'
ALIPAY_PLUS =

Alipay+ payment

'alipay_plus'
WECHAT_PAY =

WeChat Pay payment

'wechat_pay'
VENDOR_PAYMENT =

Vendor payment (third-party channel)

'vendor_payment'
ALL =

All valid payment types

[
  CREDIT_CARD,
  PROMPTPAY,
  TRUE_WALLET,
  SHOPEE_PAY,
  ALIPAY_PLUS,
  WECHAT_PAY,
  VENDOR_PAYMENT,
].freeze

Class Method Summary collapse

Class Method Details

.valid?(payment_type) ⇒ Boolean

Checks if a payment type is valid

Parameters:

  • payment_type (String)

    Payment type to validate

Returns:

  • (Boolean)

    true if valid



46
47
48
# File 'app/my_lib/payment/payment_types.rb', line 46

def self.valid?(payment_type)
  ALL.include?(payment_type.to_s)
end