-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
444 lines (383 loc) · 17.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<style>
.payment-wrapper {
width: 100%;
padding: 20px;
}
.payment-cell {
height: 50px;
margin: 5px;
padding-top: 10px;
background-color: #E6E9ED;
color: #000;
}
.payment-info {
padding-top: 10px;
}
.emailStyle {
width: 90%;
}
.wrapper {
width: 100%;
margin-left: 20px;
margin-right: 20px;
}
.customPayment {
width: 99%;
height: 30px;
}
.headerTop {
color: #1C2445;
}
.headerBottom {
color: #1C2445;
}
.donateButton {
background-color: #1C2445 !important;
border-color: #1C2445 !important;
}
.disclaimer {
margin-top: 20px;
color: #1C2445;
font-size: 12px;
}
.selectedPayment {
background-color: #2E3476;
color: #fff;
}
/**bitpay form css**/
.bitpay-donate {
margin: 20px 0;
}
.bitpay-donate fieldset {
border: 0;
}
.bitpay-donate .field-input {
color: #666;
background: #fff;
border: 1px solid #eee;
height: 30px;
box-sizing: border-box;
flex-grow: 1;
}
.bitpay-donate .field-input-wrapper {
display: inline-flex;
float: none;
width: 80%;
}
.bitpay-donate input {
padding: 4px 10px;
}
.bitpay-donate select {
padding: 3px 10px;
}
.bitpay-donate .bitpay-donate-button {
padding: 12px 0;
width: 188px;
box-sizing: border-box;
}
.bitpay-donate ul,
.bitpay-donate li {
padding: 0;
margin: 0;
list-style: none;
}
.bitpay-donate li {
padding: 10px 0;
}
.bitpay-donate-field {
clear: both;
width:40%;
}
.bitpay-donate-field label {
float: left;
width: 100px;
}
.bitpay-donate-field div {
float: left;
}
.bitpay-donate-button-wrapper {
clear: both;
margin: auto;
text-align: center;
}
input.bitpay-donate-error {
border: 2px solid red;
}
</style>
</head>
<body>
<div class="container">
<div class="row payment-info">
<div class="col-12">
<p class="headerTop">Your contribution will benefit RECIPIENT.</p>
</div>
</div>
<div class="row payment-info">
<div class="col-3 payment-cell payment" id="payment_2800" onclick="updateVal('2800')">
<p>$2,800</p>
</div>
<div class="col-3 payment-cell payment" id="payment_1000" onclick="updateVal('1000')">
<p>$1,000</p>
</div>
<div class="col-3 payment-cell payment" id="payment_500" onclick="updateVal('500')">
<p>$500</p>
</div>
</div>
<div class="row payment-info">
<div class="col-3 payment-cell payment" id="payment_100" onclick="updateVal('100')">
<p>$100</p>
</div>
<div class="col-3 payment-cell payment" id="payment_50" onclick="updateVal('50')">
<p>$50</p>
</div>
<div class="col-3 payment-cell payment" id="payment_other"><input type="text" class="customPayment" name="customPayment" id="customPayment" onfocus="updateCSS()" placeholder="Other (Maximum $2,800)" onkeyup="updateVal(this.value)">
</div>
</div>
<form class="bitpay-donate" action="https://test.bitpay.com/checkout" id="donateForm" method="post">
<input name="action" type="hidden" value="checkout">
<fieldset>
<div class="row payment-info">
<div class="col-3">
<label>Name:</label>
</div>
<div class="col-9">
<input type="text" class="inputField field-input bitpay-donate-field " name="buyerName" id="buyerName" placeholder="Name">
</div>
</div>
<div class="row payment-info">
<div class="col-3">
<label>Address:</label>
</div>
<div class="col-9">
<input type="text" class="inputField field-input bitpay-donate-field " name="buyerAddress1" id="buyerAddress1" placeholder="Address">
</div>
</div>
<div class="row payment-info">
<div class="col-3">
<label>City:</label>
</div>
<div class="col-9">
<input type="text" class="inputField field-input bitpay-donate-field " name="buyerLocality" id="buyerLocality" placeholder="City">
</div>
</div>
<div class="row payment-info">
<div class="col-3">
<label>State:</label>
</div>
<div class = "col-9">
<select class="inputField bitpay-donate-field field-input" name="buyerRegion" id="buyerRegion">
<option value="-" selected>--Select a state--</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</div>
</div>
<div class="row payment-info">
<div class="col-3">
<label>Zip:</label>
</div>
<div class="col-9">
<input type="text" class="inputField field-input bitpay-donate-field " name="buyerPostalCode" id="buyerPostalCode" placeholder="Zip Code">
</div>
</div>
<div class="row payment-info">
<div class="col-3">
<label>Phone Number:</label>
</div>
<div class="col-9">
<input type="text" class="inputField field-input bitpay-donate-field " name="buyerPhone" id="buyerPhone" placeholder="Phone Number">
</div>
</div>
<div class="row payment-info">
<div class="col-3">
<label>Email:</label>
</div>
<div class = "col-9">
<input type="text" class="inputField field-input bitpay-donate-field " name="buyerEmail" id="buyerEmail" type="email" placeholder="Email address" autocapitalize=off autocorrect=off><br>
</div>
</div>
<div class="row payment-info">
<div class="col-3">
<label>Amount:</label>
</div>
<div class="col-9">
<input type="text" class="inputField field-input bitpay-donate-field " name="price" id="price" type="number" placeholder="Amount" />
</div>
</div>
<div class="row payment-info">
<div class="col-3">
<label>Employer:</label>
</div>
<div class="col-9">
<input type="text" class="inputField field-input bitpay-donate-field " name="buyerEmployer" id="buyerEmployer" placeholder="Employer" />
</div>
</div>
<div class="row payment-info">
<div class="col-3">
<label>Occupation:</label>
</div>
<div class="col-9">
<input type="text" class="inputField field-input bitpay-donate-field " name="buyerJobTitle" id="buyerJobTitle" placeholder="Occupation" />
</div>
</div>
<input type="hidden" name="currency" value="USD">
<!-- change redirectURL to a url to send users after a payment-->
<input type="hidden" name="redirectURL" value="https://www.bitpay.com/">
<input type="hidden" name="orderID" value="">
<input type="hidden" name="posData" id="posData" value="">
<!--change the value of itemDesc to a description to display to users, and/or for record keeping-->
<input type="hidden" name="itemDesc" value="Donation">
<!-- production token | change the form action to bitpay.com- -->
<!--
<input type="hidden" name="data" value="--token goes here--">
-->
<!-- test - form action should be test.bitpay.com -->
<input type="hidden" id = "apiToken" name="data" value="your test api token" />
</fieldset>
</form>
<div class="row payment-info">
<div class="col-12">
<p class="disclaimer">Contributions or gifts to RECIPIENT are not tax deductible. Contributions are limited to $10,000 per PAC per election cycle ($5,000 primary and $5,000 general) and $5,600 per individual per election cycle ($2,800 primary and $2,800 general). Contributions from the general treasury funds of corporations, labor unions, and national banks are prohibited.
Federal contractors and foreign nationals who are not admitted for permanent residence in the United States are prohibited
from making contributions. All contributions must be from personal funds and may not be reimbursed or paid by any other person.
Federal law requires us to use our best efforts to collect and report the name, mailing address, occupation, and name of employer of individuals
whose contributions exceed $200 in an election cycle.</p>
</div>
</div>
<div class="bitpay-donate-button-wrapper">
<input class="bitpay-donate-button" onclick="submitForm();return false;" src="https://bitpay.com/cdn/merchant-resources/pay-with-bitpay-card-group.svg" onerror="this.onerror=null; this.src='https://test.bitpay.com/cdn/en_US/bp-btn-donate-currencies.svg'" type="image" alt="BitPay, the easy way to pay with bitcoins.">
</div>
</div>
<script type="text/javascript">
function submitForm() {
//change maximumDonation as needed
var maximumDonation = 2800
var $price = $("#price").val()
var isValid = true;
$(".inputField").each(function () {
var element = $(this);
if (element.val() == "") {
isValid = false;
}
});
if (!isValid || $("#buyerRegion").val() == "-") {
alert('Please fill in all fields')
return
}
if ($price > maximumDonation) {
alert("Your donation was larger than the allowed maximum of " + Number(maximumDonation).toFixed(2))
return
}
if (isNaN($price) || $price == '') {
alert('Please enter a donation amount')
return
}
//submit since there are no errors
var buyerEmailField = document.querySelector('[name="buyerEmail"]');
var orderIdField = document.querySelector('[name="orderID"]');
var $posData = {}
$posData.buyerAddress1 = $("#buyerAddress1").val()
$posData.buyerLocality = $("#buyerLocality").val()
$posData.buyerRegion = $("#buyerRegion").val()
$posData.buyerPostalCode = $("#buyerPostalCode").val()
$posData.buyerEmployer = $("#buyerEmployer").val()
$posData.buyerJobTitle = $("#buyerJobTitle").val()
$posData = JSON.stringify($posData)
$("#posData").val($posData)
orderIdField.value = $("#buyerEmail").val() + " | " + $("#buyerEmployer").val() + " | " + $("#buyerJobTitle").val()
document.getElementById("donateForm").submit()
}
function updateVal(val) {
//monitors the clicks and/or the input field, handles css updatess
$(".payment").each(function () {
$(this).removeClass("selectedPayment");
});
var $payment_arr = ['2800', '1000', '500', '100', '50']
if ($payment_arr.includes(val)) {
$("#payment_" + val).addClass('selectedPayment')
} else {
$("#payment_other").addClass('selectedPayment')
}
$("#price").val(val)
}
function updateCSS() {
//called when using the OTHER input field
$(".payment").each(function () {
$(this).removeClass("selectedPayment");
});
$("#payment_other").addClass('selectedPayment')
}
$env = "test"
$test_token = "test token goes here"
$prod_token = "prod token goes here"
function updateEnv($env) {
if ($env == "test") {
$("#donateForm").attr('action',('https://test.bitpay.com/checkout'))
$("#apiToken").attr("value",$test_token)
}
else{
$("#donateForm").attr('action',('https://bitpay.com/checkout'))
$("#apiToken").attr("value",$prod_token)
}
}
updateEnv($env)
</script>
</body>
</html>