Module: OffsitePayments::Integrations::BitPay

Defined in:
lib/offsite_payments/integrations/bit_pay.rb

Defined Under Namespace

Classes: Helper, Notification, Return

Constant Summary collapse

API_V1_URL =
'https://bitpay.com/api/invoice'
API_V2_TOKEN_REGEX =
/^[^0OIl]{44,}$/
API_V2_URL =
'https://bitpay.com/invoices'

Class Method Summary collapse

Class Method Details

.helper(order, account, options = {}) ⇒ Object



15
16
17
# File 'lib/offsite_payments/integrations/bit_pay.rb', line 15

def self.helper(order, , options = {})
  Helper.new(order, , options)
end

.invoicing_url(api_token) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/offsite_payments/integrations/bit_pay.rb', line 27

def self.invoicing_url(api_token)
  if v2_api_token?(api_token)
    API_V2_URL
  else
    API_V1_URL
  end
end

.notification(post, options = {}) ⇒ Object



11
12
13
# File 'lib/offsite_payments/integrations/bit_pay.rb', line 11

def self.notification(post, options = {})
  Notification.new(post, options)
end

.return(query_string, options = {}) ⇒ Object



19
20
21
# File 'lib/offsite_payments/integrations/bit_pay.rb', line 19

def self.return(query_string, options = {})
  Return.new(query_string)
end

.v2_api_token?(api_token) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/offsite_payments/integrations/bit_pay.rb', line 23

def self.v2_api_token?(api_token)
  API_V2_TOKEN_REGEX.match(api_token)
end