-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweaks Add todo Fix things Remove nav shadow (#7109) Update copy on `DonationStep` (#7083) * Update copy on `DonationStep` * Remove old `DonationStep` * Adjust test Update CODEOWNERS (#7091) Don't consider bootcamp purchases to be donations Tweaks
- Loading branch information
Showing
90 changed files
with
5,123 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
class BootcampController < ApplicationController | ||
layout false | ||
COMPLETE_PRICE = 149.99 | ||
PART_1_PRICE = 99.99 | ||
|
||
def index | ||
@full_complete_price = COMPLETE_PRICE | ||
@full_part_1_price = PART_1_PRICE | ||
|
||
if Rails.env.production? | ||
begin | ||
data = JSON.parse(RestClient.get("https://vpnapi.io/api/#{request.remote_ip}?key=#{Exercism.config.vpnapi_key}").body) | ||
@country_code_2 = data.dig("location", "country_code") | ||
@is_vpn = data.dig("security", "vpn") | ||
rescue StandardError | ||
# Rate limit probably | ||
end | ||
else | ||
@country_code_2 = "BA" | ||
@is_vpn = false | ||
end | ||
|
||
country_data = DATA[@country_code_2] | ||
if country_data && !@is_vpn | ||
@country_name = country_data[0] | ||
@hello = country_data[1] | ||
|
||
@has_discount = true | ||
@complete_price = country_data[2].to_f | ||
@part_1_price = country_data[3].to_f | ||
@full_payment_url = country_data[4] | ||
@part_1_payment_url = country_data[5] | ||
|
||
@discount_percentage = ((COMPLETE_PRICE - @complete_price) / COMPLETE_PRICE * 100).round | ||
else | ||
@has_discount = false | ||
@full_payment_link = "https://buy.stripe.com/14k9BE4FBcyBeDmf0f" | ||
@part_1_payment_link = "https://buy.stripe.com/6oE4hk9ZVfKNeDm7xO" | ||
end | ||
end | ||
|
||
DATA = JSON.parse(File.read(Rails.root / 'config' / 'bootcamp.json')).freeze | ||
end | ||
|
||
# | ||
# Full: buy.stripe.com/9AQ5logoj1TX52MaEE | ||
# Full with code: ?prefilled_promo_code=XXX | ||
# | ||
# |
Oops, something went wrong.