Created
June 21, 2023 13:46
-
-
Save unflores/87d3eb5d1fbce6a32b534b4f962ba25d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Compliance | |
module IdentityVerification | |
class TestingWebhookSubdomain | |
def initialize(stage, env, host) | |
@stage = stage | |
@host = host | |
@env = env | |
end | |
def value | |
return nil unless review_app? || @env.staging? | |
subdomain | |
end | |
private | |
def review_app? | |
@stage.branch_staging? | |
end | |
def subdomain | |
host.gsub('.comptoirdubitcoin.fr', '') | |
end | |
end | |
end | |
end | |
# in code | |
... | |
preferredLang: @customer.lg, | |
custom3: webhook_url_domain | |
... | |
def subdomain | |
Compliance::IdentityVerification::TestingWebhookSubdomain.new( | |
Coinhouse.stage, | |
Rails.env, | |
ENV['APP_HOST'] | |
) | |
end | |
# tests | |
describe '#value' do | |
context 'when review-app' do | |
it 'returns host subdomain' | |
end | |
context 'when staging' do | |
it 'returns host subdomain' | |
end | |
context 'when production' do | |
it 'returns nil' | |
end | |
context 'when development' do | |
it 'returns nil' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment