payment component and styling
This commit is contained in:
parent
7267045475
commit
fd88a066da
|
@ -39,6 +39,7 @@ import { DeauthorizeSessionsComponent } from './settings/deauthorize-sessions.co
|
|||
import { DeleteAccountComponent } from './settings/delete-account.component';
|
||||
import { DomainRulesComponent } from './settings/domain-rules.component';
|
||||
import { OptionsComponent } from './settings/options.component';
|
||||
import { PaymentComponent } from './settings/payment.component';
|
||||
import { PremiumComponent } from './settings/premium.component';
|
||||
import { ProfileComponent } from './settings/profile.component';
|
||||
import { PurgeVaultComponent } from './settings/purge-vault.component';
|
||||
|
@ -144,6 +145,7 @@ import { SearchCiphersPipe } from 'jslib/angular/pipes/search-ciphers.pipe';
|
|||
OrganizationLayoutComponent,
|
||||
PasswordGeneratorComponent,
|
||||
PasswordGeneratorHistoryComponent,
|
||||
PaymentComponent,
|
||||
PremiumComponent,
|
||||
ProfileComponent,
|
||||
PurgeVaultComponent,
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<i class="fa fa-spinner fa-spin"></i>
|
||||
<span>{{'save' | i18n}}</span>
|
||||
</button>
|
||||
<h2 class="mt-5">{{'globalEqDomains' | i18n}}</h2>
|
||||
<h2 class="spaced-header">{{'globalEqDomains' | i18n}}</h2>
|
||||
<p *ngIf="loading">
|
||||
<i class="fa fa-spinner fa-spin text-muted"></i>
|
||||
</p>
|
||||
|
|
|
@ -0,0 +1,311 @@
|
|||
<div class="my-4 text-lg">
|
||||
<div class="form-check form-check-inline mr-4">
|
||||
<input class="form-check-input" type="radio" name="Method" id="method-card" value="card" [(ngModel)]="method" (change)="changeMethod()">
|
||||
<label class="form-check-label" for="method-card">
|
||||
<i class="fa fa-fw fa-credit-card"></i> {{'creditCard' | i18n}}</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="Method" id="method-paypal" value="paypal" [(ngModel)]="method" (change)="changeMethod()">
|
||||
<label class="form-check-label" for="method-paypal">
|
||||
<i class="fa fa-fw fa-paypal"></i> PayPal</label>
|
||||
</div>
|
||||
</div>
|
||||
<ng-container *ngIf="method === 'card'">
|
||||
<div class="row">
|
||||
<div class="form-group col-5">
|
||||
<label for="card_number">{{'number' | i18n}}</label>
|
||||
<input id="card_number" class="form-control" type="text" name="card_number" [(ngModel)]="card.number" required pattern="[0-9]*"
|
||||
autocomplete="cc-number">
|
||||
<small class="form-text text-muted">{{'creditCardAllBrandsAccepted' | i18n}}</small>
|
||||
</div>
|
||||
<div class="form-group col-7">
|
||||
</div>
|
||||
<div class="form-group col-4">
|
||||
<label for="exp_month">{{'expirationMonth' | i18n}}</label>
|
||||
<select id="exp_month" class="form-control" name="exp_month" [(ngModel)]="card.exp_month" required autocomplete="cc-exp-month">
|
||||
<option *ngFor="let o of cardExpMonthOptions" [ngValue]="o.value">{{o.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-4">
|
||||
<label for="exp_year">{{'expirationYear' | i18n}}</label>
|
||||
<select id="exp_year" class="form-control" name="exp_year" [(ngModel)]="card.exp_year" required autocomplete="cc-exp-year">
|
||||
<option *ngFor="let o of cardExpYearOptions" [ngValue]="o.value">{{o.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-4">
|
||||
<label for="cvc" class="d-flex">
|
||||
{{'securityCode' | i18n}}
|
||||
<a href="https://www.cvvnumber.com/cvv.html" target="_blank" rel="noopener noreferrer" class="ml-auto">
|
||||
<i class="fa fa-question-circle"></i>
|
||||
</a>
|
||||
</label>
|
||||
<input id="cvc" class="form-control" type="text" name="cvc" [(ngModel)]="card.cvc" required autocomplete="cc-csc">
|
||||
</div>
|
||||
<div class="form-group col-5">
|
||||
<label for="address_country">{{'country' | i18n}}</label>
|
||||
<select id="address_country" class="form-control" [(ngModel)]="card.address_country" required name="address_country" autocomplete="country">
|
||||
<option value="">-- Select --</option>
|
||||
<option value="US">United States</option>
|
||||
<option value="CN">China</option>
|
||||
<option value="FR">France</option>
|
||||
<option value="DE">Germany</option>
|
||||
<option value="CA">Canada</option>
|
||||
<option value="GB">United Kingdom</option>
|
||||
<option value="AU">Australia</option>
|
||||
<option value="IN">India</option>
|
||||
<option value="-" disabled></option>
|
||||
<option value="AF">Afghanistan</option>
|
||||
<option value="AX">Åland Islands</option>
|
||||
<option value="AL">Albania</option>
|
||||
<option value="DZ">Algeria</option>
|
||||
<option value="AS">American Samoa</option>
|
||||
<option value="AD">Andorra</option>
|
||||
<option value="AO">Angola</option>
|
||||
<option value="AI">Anguilla</option>
|
||||
<option value="AQ">Antarctica</option>
|
||||
<option value="AG">Antigua and Barbuda</option>
|
||||
<option value="AR">Argentina</option>
|
||||
<option value="AM">Armenia</option>
|
||||
<option value="AW">Aruba</option>
|
||||
<option value="AT">Austria</option>
|
||||
<option value="AZ">Azerbaijan</option>
|
||||
<option value="BS">Bahamas</option>
|
||||
<option value="BH">Bahrain</option>
|
||||
<option value="BD">Bangladesh</option>
|
||||
<option value="BB">Barbados</option>
|
||||
<option value="BY">Belarus</option>
|
||||
<option value="BE">Belgium</option>
|
||||
<option value="BZ">Belize</option>
|
||||
<option value="BJ">Benin</option>
|
||||
<option value="BM">Bermuda</option>
|
||||
<option value="BT">Bhutan</option>
|
||||
<option value="BO">Bolivia, Plurinational State of</option>
|
||||
<option value="BQ">Bonaire, Sint Eustatius and Saba</option>
|
||||
<option value="BA">Bosnia and Herzegovina</option>
|
||||
<option value="BW">Botswana</option>
|
||||
<option value="BV">Bouvet Island</option>
|
||||
<option value="BR">Brazil</option>
|
||||
<option value="IO">British Indian Ocean Territory</option>
|
||||
<option value="BN">Brunei Darussalam</option>
|
||||
<option value="BG">Bulgaria</option>
|
||||
<option value="BF">Burkina Faso</option>
|
||||
<option value="BI">Burundi</option>
|
||||
<option value="KH">Cambodia</option>
|
||||
<option value="CM">Cameroon</option>
|
||||
<option value="CV">Cape Verde</option>
|
||||
<option value="KY">Cayman Islands</option>
|
||||
<option value="CF">Central African Republic</option>
|
||||
<option value="TD">Chad</option>
|
||||
<option value="CL">Chile</option>
|
||||
<option value="CX">Christmas Island</option>
|
||||
<option value="CC">Cocos (Keeling) Islands</option>
|
||||
<option value="CO">Colombia</option>
|
||||
<option value="KM">Comoros</option>
|
||||
<option value="CG">Congo</option>
|
||||
<option value="CD">Congo, the Democratic Republic of the</option>
|
||||
<option value="CK">Cook Islands</option>
|
||||
<option value="CR">Costa Rica</option>
|
||||
<option value="CI">Côte d'Ivoire</option>
|
||||
<option value="HR">Croatia</option>
|
||||
<option value="CU">Cuba</option>
|
||||
<option value="CW">Curaçao</option>
|
||||
<option value="CY">Cyprus</option>
|
||||
<option value="CZ">Czech Republic</option>
|
||||
<option value="DK">Denmark</option>
|
||||
<option value="DJ">Djibouti</option>
|
||||
<option value="DM">Dominica</option>
|
||||
<option value="DO">Dominican Republic</option>
|
||||
<option value="EC">Ecuador</option>
|
||||
<option value="EG">Egypt</option>
|
||||
<option value="SV">El Salvador</option>
|
||||
<option value="GQ">Equatorial Guinea</option>
|
||||
<option value="ER">Eritrea</option>
|
||||
<option value="EE">Estonia</option>
|
||||
<option value="ET">Ethiopia</option>
|
||||
<option value="FK">Falkland Islands (Malvinas)</option>
|
||||
<option value="FO">Faroe Islands</option>
|
||||
<option value="FJ">Fiji</option>
|
||||
<option value="FI">Finland</option>
|
||||
<option value="GF">French Guiana</option>
|
||||
<option value="PF">French Polynesia</option>
|
||||
<option value="TF">French Southern Territories</option>
|
||||
<option value="GA">Gabon</option>
|
||||
<option value="GM">Gambia</option>
|
||||
<option value="GE">Georgia</option>
|
||||
<option value="GH">Ghana</option>
|
||||
<option value="GI">Gibraltar</option>
|
||||
<option value="GR">Greece</option>
|
||||
<option value="GL">Greenland</option>
|
||||
<option value="GD">Grenada</option>
|
||||
<option value="GP">Guadeloupe</option>
|
||||
<option value="GU">Guam</option>
|
||||
<option value="GT">Guatemala</option>
|
||||
<option value="GG">Guernsey</option>
|
||||
<option value="GN">Guinea</option>
|
||||
<option value="GW">Guinea-Bissau</option>
|
||||
<option value="GY">Guyana</option>
|
||||
<option value="HT">Haiti</option>
|
||||
<option value="HM">Heard Island and McDonald Islands</option>
|
||||
<option value="VA">Holy See (Vatican City State)</option>
|
||||
<option value="HN">Honduras</option>
|
||||
<option value="HK">Hong Kong</option>
|
||||
<option value="HU">Hungary</option>
|
||||
<option value="IS">Iceland</option>
|
||||
<option value="ID">Indonesia</option>
|
||||
<option value="IR">Iran, Islamic Republic of</option>
|
||||
<option value="IQ">Iraq</option>
|
||||
<option value="IE">Ireland</option>
|
||||
<option value="IM">Isle of Man</option>
|
||||
<option value="IL">Israel</option>
|
||||
<option value="IT">Italy</option>
|
||||
<option value="JM">Jamaica</option>
|
||||
<option value="JP">Japan</option>
|
||||
<option value="JE">Jersey</option>
|
||||
<option value="JO">Jordan</option>
|
||||
<option value="KZ">Kazakhstan</option>
|
||||
<option value="KE">Kenya</option>
|
||||
<option value="KI">Kiribati</option>
|
||||
<option value="KP">Korea, Democratic People's Republic of</option>
|
||||
<option value="KR">Korea, Republic of</option>
|
||||
<option value="KW">Kuwait</option>
|
||||
<option value="KG">Kyrgyzstan</option>
|
||||
<option value="LA">Lao People's Democratic Republic</option>
|
||||
<option value="LV">Latvia</option>
|
||||
<option value="LB">Lebanon</option>
|
||||
<option value="LS">Lesotho</option>
|
||||
<option value="LR">Liberia</option>
|
||||
<option value="LY">Libya</option>
|
||||
<option value="LI">Liechtenstein</option>
|
||||
<option value="LT">Lithuania</option>
|
||||
<option value="LU">Luxembourg</option>
|
||||
<option value="MO">Macao</option>
|
||||
<option value="MK">Macedonia, the former Yugoslav Republic of</option>
|
||||
<option value="MG">Madagascar</option>
|
||||
<option value="MW">Malawi</option>
|
||||
<option value="MY">Malaysia</option>
|
||||
<option value="MV">Maldives</option>
|
||||
<option value="ML">Mali</option>
|
||||
<option value="MT">Malta</option>
|
||||
<option value="MH">Marshall Islands</option>
|
||||
<option value="MQ">Martinique</option>
|
||||
<option value="MR">Mauritania</option>
|
||||
<option value="MU">Mauritius</option>
|
||||
<option value="YT">Mayotte</option>
|
||||
<option value="MX">Mexico</option>
|
||||
<option value="FM">Micronesia, Federated States of</option>
|
||||
<option value="MD">Moldova, Republic of</option>
|
||||
<option value="MC">Monaco</option>
|
||||
<option value="MN">Mongolia</option>
|
||||
<option value="ME">Montenegro</option>
|
||||
<option value="MS">Montserrat</option>
|
||||
<option value="MA">Morocco</option>
|
||||
<option value="MZ">Mozambique</option>
|
||||
<option value="MM">Myanmar</option>
|
||||
<option value="NA">Namibia</option>
|
||||
<option value="NR">Nauru</option>
|
||||
<option value="NP">Nepal</option>
|
||||
<option value="NL">Netherlands</option>
|
||||
<option value="NC">New Caledonia</option>
|
||||
<option value="NZ">New Zealand</option>
|
||||
<option value="NI">Nicaragua</option>
|
||||
<option value="NE">Niger</option>
|
||||
<option value="NG">Nigeria</option>
|
||||
<option value="NU">Niue</option>
|
||||
<option value="NF">Norfolk Island</option>
|
||||
<option value="MP">Northern Mariana Islands</option>
|
||||
<option value="NO">Norway</option>
|
||||
<option value="OM">Oman</option>
|
||||
<option value="PK">Pakistan</option>
|
||||
<option value="PW">Palau</option>
|
||||
<option value="PS">Palestinian Territory, Occupied</option>
|
||||
<option value="PA">Panama</option>
|
||||
<option value="PG">Papua New Guinea</option>
|
||||
<option value="PY">Paraguay</option>
|
||||
<option value="PE">Peru</option>
|
||||
<option value="PH">Philippines</option>
|
||||
<option value="PN">Pitcairn</option>
|
||||
<option value="PL">Poland</option>
|
||||
<option value="PT">Portugal</option>
|
||||
<option value="PR">Puerto Rico</option>
|
||||
<option value="QA">Qatar</option>
|
||||
<option value="RE">Réunion</option>
|
||||
<option value="RO">Romania</option>
|
||||
<option value="RU">Russian Federation</option>
|
||||
<option value="RW">Rwanda</option>
|
||||
<option value="BL">Saint Barthélemy</option>
|
||||
<option value="SH">Saint Helena, Ascension and Tristan da Cunha</option>
|
||||
<option value="KN">Saint Kitts and Nevis</option>
|
||||
<option value="LC">Saint Lucia</option>
|
||||
<option value="MF">Saint Martin (French part)</option>
|
||||
<option value="PM">Saint Pierre and Miquelon</option>
|
||||
<option value="VC">Saint Vincent and the Grenadines</option>
|
||||
<option value="WS">Samoa</option>
|
||||
<option value="SM">San Marino</option>
|
||||
<option value="ST">Sao Tome and Principe</option>
|
||||
<option value="SA">Saudi Arabia</option>
|
||||
<option value="SN">Senegal</option>
|
||||
<option value="RS">Serbia</option>
|
||||
<option value="SC">Seychelles</option>
|
||||
<option value="SL">Sierra Leone</option>
|
||||
<option value="SG">Singapore</option>
|
||||
<option value="SX">Sint Maarten (Dutch part)</option>
|
||||
<option value="SK">Slovakia</option>
|
||||
<option value="SI">Slovenia</option>
|
||||
<option value="SB">Solomon Islands</option>
|
||||
<option value="SO">Somalia</option>
|
||||
<option value="ZA">South Africa</option>
|
||||
<option value="GS">South Georgia and the South Sandwich Islands</option>
|
||||
<option value="SS">South Sudan</option>
|
||||
<option value="ES">Spain</option>
|
||||
<option value="LK">Sri Lanka</option>
|
||||
<option value="SD">Sudan</option>
|
||||
<option value="SR">Suriname</option>
|
||||
<option value="SJ">Svalbard and Jan Mayen</option>
|
||||
<option value="SZ">Swaziland</option>
|
||||
<option value="SE">Sweden</option>
|
||||
<option value="CH">Switzerland</option>
|
||||
<option value="SY">Syrian Arab Republic</option>
|
||||
<option value="TW">Taiwan, Province of China</option>
|
||||
<option value="TJ">Tajikistan</option>
|
||||
<option value="TZ">Tanzania, United Republic of</option>
|
||||
<option value="TH">Thailand</option>
|
||||
<option value="TL">Timor-Leste</option>
|
||||
<option value="TG">Togo</option>
|
||||
<option value="TK">Tokelau</option>
|
||||
<option value="TO">Tonga</option>
|
||||
<option value="TT">Trinidad and Tobago</option>
|
||||
<option value="TN">Tunisia</option>
|
||||
<option value="TR">Turkey</option>
|
||||
<option value="TM">Turkmenistan</option>
|
||||
<option value="TC">Turks and Caicos Islands</option>
|
||||
<option value="TV">Tuvalu</option>
|
||||
<option value="UG">Uganda</option>
|
||||
<option value="UA">Ukraine</option>
|
||||
<option value="AE">United Arab Emirates</option>
|
||||
<option value="UM">United States Minor Outlying Islands</option>
|
||||
<option value="UY">Uruguay</option>
|
||||
<option value="UZ">Uzbekistan</option>
|
||||
<option value="VU">Vanuatu</option>
|
||||
<option value="VE">Venezuela, Bolivarian Republic of</option>
|
||||
<option value="VN">Viet Nam</option>
|
||||
<option value="VG">Virgin Islands, British</option>
|
||||
<option value="VI">Virgin Islands, U.S.</option>
|
||||
<option value="WF">Wallis and Futuna</option>
|
||||
<option value="EH">Western Sahara</option>
|
||||
<option value="YE">Yemen</option>
|
||||
<option value="ZM">Zambia</option>
|
||||
<option value="ZW">Zimbabwe</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-4">
|
||||
<label for="address_zip">{{'zipPostalCode' | i18n}}</label>
|
||||
<input id="address_zip" class="form-control" type="text" name="address_zip" [(ngModel)]="card.address_zip" required autocomplete="postal-code">
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="method === 'paypal'">
|
||||
<div class="mb-3">
|
||||
<div id="bt-dropin-container" class="mb-1"></div>
|
||||
<small class="text-muted">{{'paypalClickSubmit' | i18n}}</small>
|
||||
</div>
|
||||
</ng-container>
|
|
@ -0,0 +1,144 @@
|
|||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
} from '@angular/core';
|
||||
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
|
||||
const Keys = {
|
||||
stripeTest: 'pk_test_KPoCfZXu7mznb9uSCPZ2JpTD',
|
||||
stripeLive: 'pk_live_bpN0P37nMxrMQkcaHXtAybJk',
|
||||
btSandbox: 'sandbox_r72q8jq6_9pnxkwm75f87sdc2',
|
||||
btProduction: 'production_qfbsv8kc_njj2zjtyngtjmbjd',
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-payment',
|
||||
templateUrl: 'payment.component.html',
|
||||
})
|
||||
export class PaymentComponent implements OnInit {
|
||||
method = 'card';
|
||||
card: any = {
|
||||
number: null,
|
||||
exp_month: null,
|
||||
exp_year: null,
|
||||
address_country: '',
|
||||
address_zip: null,
|
||||
};
|
||||
cardExpMonthOptions: any[];
|
||||
cardExpYearOptions: any[];
|
||||
|
||||
private stripeScript: HTMLScriptElement;
|
||||
private btScript: HTMLScriptElement;
|
||||
private btInstance: any = null;
|
||||
|
||||
constructor(i18nService: I18nService, private platformUtilsService: PlatformUtilsService) {
|
||||
this.stripeScript = window.document.createElement('script');
|
||||
this.stripeScript.src = 'https://js.stripe.com/v2/';
|
||||
this.stripeScript.async = true;
|
||||
this.stripeScript.onload = () => {
|
||||
(window as any).Stripe.setPublishableKey(
|
||||
this.platformUtilsService.isDev() ? Keys.stripeTest : Keys.stripeLive);
|
||||
};
|
||||
this.btScript = window.document.createElement('script');
|
||||
this.btScript.src = 'https://js.braintreegateway.com/web/dropin/1.4.0/js/dropin.min.js';
|
||||
this.btScript.async = true;
|
||||
|
||||
this.cardExpMonthOptions = [
|
||||
{ name: '-- ' + i18nService.t('select') + ' --', value: null },
|
||||
{ name: '01 - ' + i18nService.t('january'), value: '01' },
|
||||
{ name: '02 - ' + i18nService.t('february'), value: '02' },
|
||||
{ name: '03 - ' + i18nService.t('march'), value: '03' },
|
||||
{ name: '04 - ' + i18nService.t('april'), value: '04' },
|
||||
{ name: '05 - ' + i18nService.t('may'), value: '05' },
|
||||
{ name: '06 - ' + i18nService.t('june'), value: '06' },
|
||||
{ name: '07 - ' + i18nService.t('july'), value: '07' },
|
||||
{ name: '08 - ' + i18nService.t('august'), value: '08' },
|
||||
{ name: '09 - ' + i18nService.t('september'), value: '09' },
|
||||
{ name: '10 - ' + i18nService.t('october'), value: '10' },
|
||||
{ name: '11 - ' + i18nService.t('november'), value: '11' },
|
||||
{ name: '12 - ' + i18nService.t('december'), value: '12' },
|
||||
];
|
||||
|
||||
this.cardExpYearOptions = [
|
||||
{ name: '-- ' + i18nService.t('select') + ' --', value: null },
|
||||
];
|
||||
const year = (new Date()).getFullYear();
|
||||
for (let i = year; i < (year + 10); i++) {
|
||||
this.cardExpYearOptions.push({ name: i.toString(), value: i.toString().slice(-2) });
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
window.document.head.appendChild(this.stripeScript);
|
||||
window.document.head.appendChild(this.btScript);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
window.document.head.removeChild(this.stripeScript);
|
||||
window.document.head.removeChild(this.btScript);
|
||||
Array.from(window.document.querySelectorAll('iframe')).forEach((el) => {
|
||||
if (el.src != null && el.src.indexOf('stripe') > -1) {
|
||||
window.document.body.removeChild(el);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
changeMethod() {
|
||||
if (this.method !== 'paypal') {
|
||||
this.btInstance = null;
|
||||
return;
|
||||
}
|
||||
|
||||
window.setTimeout(() => {
|
||||
(window as any).braintree.dropin.create({
|
||||
authorization: this.platformUtilsService.isDev() ? Keys.btSandbox : Keys.btProduction,
|
||||
container: '#bt-dropin-container',
|
||||
paymentOptionPriority: ['paypal'],
|
||||
paypal: {
|
||||
flow: 'vault',
|
||||
buttonStyle: {
|
||||
label: 'pay',
|
||||
size: 'medium',
|
||||
shape: 'pill',
|
||||
color: 'blue',
|
||||
},
|
||||
},
|
||||
}, (createErr: any, instance: any) => {
|
||||
if (createErr != null) {
|
||||
// tslint:disable-next-line
|
||||
console.error(createErr);
|
||||
return;
|
||||
}
|
||||
this.btInstance = instance;
|
||||
});
|
||||
}, 250);
|
||||
}
|
||||
|
||||
createPaymentToken(): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.method === 'paypal') {
|
||||
this.btInstance.requestPaymentMethod().then((payload: any) => {
|
||||
resolve(payload.nonce);
|
||||
}).catch((err: any) => {
|
||||
reject(err.message);
|
||||
});
|
||||
} else {
|
||||
(window as any).Stripe.card.createToken(this.card, (status: number, response: any) => {
|
||||
if (status === 200 && response.id != null) {
|
||||
resolve(response.id);
|
||||
} else if (response.error != null) {
|
||||
reject(response.error.message);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getCountry(): string {
|
||||
return this.card.address_country;
|
||||
}
|
||||
}
|
|
@ -1,331 +1,21 @@
|
|||
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise" ngNativeValidate>
|
||||
<h2 class="mt-5">{{'addons' | i18n}}</h2>
|
||||
<h2 class="spaced-header">{{'addons' | i18n}}</h2>
|
||||
<div class="form-group">
|
||||
<label for="additionalStorage">{{'additionalStorageGb' | i18n}}</label>
|
||||
<input id="additionalStorage" class="form-control" type="number" name="AdditionalStorageGb" [(ngModel)]="additionalStorage"
|
||||
min="0" max="99" step="1" placeholder="{{'additionalStorageGbDesc' | i18n}}">
|
||||
<small class="text-muted form-text">{{'additionalStorageDesc' | i18n : (storageGbPrice | currency:'USD')}}</small>
|
||||
</div>
|
||||
<h2 class="mt-5">{{'summary' | i18n}}</h2>
|
||||
<h2 class="spaced-header">{{'summary' | i18n}}</h2>
|
||||
{{'premiumMembership' | i18n}}: {{premiumPrice | currency:'USD':'$'}}
|
||||
<br> {{'additionalStorageGb' | i18n}}: {{additionalStorage || 0}} GB × {{storageGbPrice | currency:'USD'}} = {{additionalStorageTotal
|
||||
| currency:'USD':'$'}}
|
||||
<hr class="my-2">
|
||||
<strong>{{'total' | i18n}}:</strong> USD {{total | currency:'USD'}} /{{'year' | i18n}}
|
||||
<br>
|
||||
<small class="text-muted">{{'cardChargedAnnually' | i18n}}</small>
|
||||
<h2 class="mt-5">{{'paymentInformation' | i18n}}</h2>
|
||||
<div class="my-4">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="Method" id="method-card" value="card" [(ngModel)]="method" (change)="changeMethod()">
|
||||
<label class="form-check-label" for="method-card">
|
||||
<i class="fa fa-fw fa-credit-card"></i> {{'creditCard' | i18n}}</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="Method" id="method-paypal" value="paypal" [(ngModel)]="method" (change)="changeMethod()">
|
||||
<label class="form-check-label" for="method-paypal">
|
||||
<i class="fa fa-fw fa-paypal"></i> PayPal</label>
|
||||
</div>
|
||||
</div>
|
||||
<ng-container *ngIf="method === 'card'">
|
||||
<div class="row">
|
||||
<div class="form-group col-5">
|
||||
<label for="card_number">{{'number' | i18n}}</label>
|
||||
<input id="card_number" class="form-control" type="text" name="card_number" [(ngModel)]="card.number" required pattern="[0-9]*"
|
||||
autocomplete="cc-number">
|
||||
<small class="form-text text-muted">{{'creditCardAllBrandsAccepted' | i18n}}</small>
|
||||
</div>
|
||||
<div class="form-group col-7">
|
||||
</div>
|
||||
<div class="form-group col-4">
|
||||
<label for="exp_month">{{'expirationMonth' | i18n}}</label>
|
||||
<select id="exp_month" class="form-control" name="exp_month" [(ngModel)]="card.exp_month" required autocomplete="cc-exp-month">
|
||||
<option *ngFor="let o of cardExpMonthOptions" [ngValue]="o.value">{{o.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-4">
|
||||
<label for="exp_year">{{'expirationYear' | i18n}}</label>
|
||||
<select id="exp_year" class="form-control" name="exp_year" [(ngModel)]="card.exp_year" required autocomplete="cc-exp-year">
|
||||
<option *ngFor="let o of cardExpYearOptions" [ngValue]="o.value">{{o.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-4">
|
||||
<label for="cvc">
|
||||
{{'securityCode' | i18n}}
|
||||
<a href="https://www.cvvnumber.com/cvv.html" target="_blank" title="What is this?" rel="noopener noreferrer">
|
||||
<i class="fa fa-question-circle"></i>
|
||||
</a>
|
||||
</label>
|
||||
<input id="cvc" class="form-control" type="text" name="cvc" [(ngModel)]="card.cvc" required autocomplete="cc-csc">
|
||||
</div>
|
||||
<div class="form-group col-5">
|
||||
<label for="address_country">{{'country' | i18n}}</label>
|
||||
<select id="address_country" class="form-control" [(ngModel)]="card.address_country" required name="address_country" autocomplete="country">
|
||||
<option value="">-- Select --</option>
|
||||
<option value="US">United States</option>
|
||||
<option value="CN">China</option>
|
||||
<option value="FR">France</option>
|
||||
<option value="DE">Germany</option>
|
||||
<option value="CA">Canada</option>
|
||||
<option value="GB">United Kingdom</option>
|
||||
<option value="AU">Australia</option>
|
||||
<option value="IN">India</option>
|
||||
<option value="-" disabled></option>
|
||||
<option value="AF">Afghanistan</option>
|
||||
<option value="AX">Åland Islands</option>
|
||||
<option value="AL">Albania</option>
|
||||
<option value="DZ">Algeria</option>
|
||||
<option value="AS">American Samoa</option>
|
||||
<option value="AD">Andorra</option>
|
||||
<option value="AO">Angola</option>
|
||||
<option value="AI">Anguilla</option>
|
||||
<option value="AQ">Antarctica</option>
|
||||
<option value="AG">Antigua and Barbuda</option>
|
||||
<option value="AR">Argentina</option>
|
||||
<option value="AM">Armenia</option>
|
||||
<option value="AW">Aruba</option>
|
||||
<option value="AT">Austria</option>
|
||||
<option value="AZ">Azerbaijan</option>
|
||||
<option value="BS">Bahamas</option>
|
||||
<option value="BH">Bahrain</option>
|
||||
<option value="BD">Bangladesh</option>
|
||||
<option value="BB">Barbados</option>
|
||||
<option value="BY">Belarus</option>
|
||||
<option value="BE">Belgium</option>
|
||||
<option value="BZ">Belize</option>
|
||||
<option value="BJ">Benin</option>
|
||||
<option value="BM">Bermuda</option>
|
||||
<option value="BT">Bhutan</option>
|
||||
<option value="BO">Bolivia, Plurinational State of</option>
|
||||
<option value="BQ">Bonaire, Sint Eustatius and Saba</option>
|
||||
<option value="BA">Bosnia and Herzegovina</option>
|
||||
<option value="BW">Botswana</option>
|
||||
<option value="BV">Bouvet Island</option>
|
||||
<option value="BR">Brazil</option>
|
||||
<option value="IO">British Indian Ocean Territory</option>
|
||||
<option value="BN">Brunei Darussalam</option>
|
||||
<option value="BG">Bulgaria</option>
|
||||
<option value="BF">Burkina Faso</option>
|
||||
<option value="BI">Burundi</option>
|
||||
<option value="KH">Cambodia</option>
|
||||
<option value="CM">Cameroon</option>
|
||||
<option value="CV">Cape Verde</option>
|
||||
<option value="KY">Cayman Islands</option>
|
||||
<option value="CF">Central African Republic</option>
|
||||
<option value="TD">Chad</option>
|
||||
<option value="CL">Chile</option>
|
||||
<option value="CX">Christmas Island</option>
|
||||
<option value="CC">Cocos (Keeling) Islands</option>
|
||||
<option value="CO">Colombia</option>
|
||||
<option value="KM">Comoros</option>
|
||||
<option value="CG">Congo</option>
|
||||
<option value="CD">Congo, the Democratic Republic of the</option>
|
||||
<option value="CK">Cook Islands</option>
|
||||
<option value="CR">Costa Rica</option>
|
||||
<option value="CI">Côte d'Ivoire</option>
|
||||
<option value="HR">Croatia</option>
|
||||
<option value="CU">Cuba</option>
|
||||
<option value="CW">Curaçao</option>
|
||||
<option value="CY">Cyprus</option>
|
||||
<option value="CZ">Czech Republic</option>
|
||||
<option value="DK">Denmark</option>
|
||||
<option value="DJ">Djibouti</option>
|
||||
<option value="DM">Dominica</option>
|
||||
<option value="DO">Dominican Republic</option>
|
||||
<option value="EC">Ecuador</option>
|
||||
<option value="EG">Egypt</option>
|
||||
<option value="SV">El Salvador</option>
|
||||
<option value="GQ">Equatorial Guinea</option>
|
||||
<option value="ER">Eritrea</option>
|
||||
<option value="EE">Estonia</option>
|
||||
<option value="ET">Ethiopia</option>
|
||||
<option value="FK">Falkland Islands (Malvinas)</option>
|
||||
<option value="FO">Faroe Islands</option>
|
||||
<option value="FJ">Fiji</option>
|
||||
<option value="FI">Finland</option>
|
||||
<option value="GF">French Guiana</option>
|
||||
<option value="PF">French Polynesia</option>
|
||||
<option value="TF">French Southern Territories</option>
|
||||
<option value="GA">Gabon</option>
|
||||
<option value="GM">Gambia</option>
|
||||
<option value="GE">Georgia</option>
|
||||
<option value="GH">Ghana</option>
|
||||
<option value="GI">Gibraltar</option>
|
||||
<option value="GR">Greece</option>
|
||||
<option value="GL">Greenland</option>
|
||||
<option value="GD">Grenada</option>
|
||||
<option value="GP">Guadeloupe</option>
|
||||
<option value="GU">Guam</option>
|
||||
<option value="GT">Guatemala</option>
|
||||
<option value="GG">Guernsey</option>
|
||||
<option value="GN">Guinea</option>
|
||||
<option value="GW">Guinea-Bissau</option>
|
||||
<option value="GY">Guyana</option>
|
||||
<option value="HT">Haiti</option>
|
||||
<option value="HM">Heard Island and McDonald Islands</option>
|
||||
<option value="VA">Holy See (Vatican City State)</option>
|
||||
<option value="HN">Honduras</option>
|
||||
<option value="HK">Hong Kong</option>
|
||||
<option value="HU">Hungary</option>
|
||||
<option value="IS">Iceland</option>
|
||||
<option value="ID">Indonesia</option>
|
||||
<option value="IR">Iran, Islamic Republic of</option>
|
||||
<option value="IQ">Iraq</option>
|
||||
<option value="IE">Ireland</option>
|
||||
<option value="IM">Isle of Man</option>
|
||||
<option value="IL">Israel</option>
|
||||
<option value="IT">Italy</option>
|
||||
<option value="JM">Jamaica</option>
|
||||
<option value="JP">Japan</option>
|
||||
<option value="JE">Jersey</option>
|
||||
<option value="JO">Jordan</option>
|
||||
<option value="KZ">Kazakhstan</option>
|
||||
<option value="KE">Kenya</option>
|
||||
<option value="KI">Kiribati</option>
|
||||
<option value="KP">Korea, Democratic People's Republic of</option>
|
||||
<option value="KR">Korea, Republic of</option>
|
||||
<option value="KW">Kuwait</option>
|
||||
<option value="KG">Kyrgyzstan</option>
|
||||
<option value="LA">Lao People's Democratic Republic</option>
|
||||
<option value="LV">Latvia</option>
|
||||
<option value="LB">Lebanon</option>
|
||||
<option value="LS">Lesotho</option>
|
||||
<option value="LR">Liberia</option>
|
||||
<option value="LY">Libya</option>
|
||||
<option value="LI">Liechtenstein</option>
|
||||
<option value="LT">Lithuania</option>
|
||||
<option value="LU">Luxembourg</option>
|
||||
<option value="MO">Macao</option>
|
||||
<option value="MK">Macedonia, the former Yugoslav Republic of</option>
|
||||
<option value="MG">Madagascar</option>
|
||||
<option value="MW">Malawi</option>
|
||||
<option value="MY">Malaysia</option>
|
||||
<option value="MV">Maldives</option>
|
||||
<option value="ML">Mali</option>
|
||||
<option value="MT">Malta</option>
|
||||
<option value="MH">Marshall Islands</option>
|
||||
<option value="MQ">Martinique</option>
|
||||
<option value="MR">Mauritania</option>
|
||||
<option value="MU">Mauritius</option>
|
||||
<option value="YT">Mayotte</option>
|
||||
<option value="MX">Mexico</option>
|
||||
<option value="FM">Micronesia, Federated States of</option>
|
||||
<option value="MD">Moldova, Republic of</option>
|
||||
<option value="MC">Monaco</option>
|
||||
<option value="MN">Mongolia</option>
|
||||
<option value="ME">Montenegro</option>
|
||||
<option value="MS">Montserrat</option>
|
||||
<option value="MA">Morocco</option>
|
||||
<option value="MZ">Mozambique</option>
|
||||
<option value="MM">Myanmar</option>
|
||||
<option value="NA">Namibia</option>
|
||||
<option value="NR">Nauru</option>
|
||||
<option value="NP">Nepal</option>
|
||||
<option value="NL">Netherlands</option>
|
||||
<option value="NC">New Caledonia</option>
|
||||
<option value="NZ">New Zealand</option>
|
||||
<option value="NI">Nicaragua</option>
|
||||
<option value="NE">Niger</option>
|
||||
<option value="NG">Nigeria</option>
|
||||
<option value="NU">Niue</option>
|
||||
<option value="NF">Norfolk Island</option>
|
||||
<option value="MP">Northern Mariana Islands</option>
|
||||
<option value="NO">Norway</option>
|
||||
<option value="OM">Oman</option>
|
||||
<option value="PK">Pakistan</option>
|
||||
<option value="PW">Palau</option>
|
||||
<option value="PS">Palestinian Territory, Occupied</option>
|
||||
<option value="PA">Panama</option>
|
||||
<option value="PG">Papua New Guinea</option>
|
||||
<option value="PY">Paraguay</option>
|
||||
<option value="PE">Peru</option>
|
||||
<option value="PH">Philippines</option>
|
||||
<option value="PN">Pitcairn</option>
|
||||
<option value="PL">Poland</option>
|
||||
<option value="PT">Portugal</option>
|
||||
<option value="PR">Puerto Rico</option>
|
||||
<option value="QA">Qatar</option>
|
||||
<option value="RE">Réunion</option>
|
||||
<option value="RO">Romania</option>
|
||||
<option value="RU">Russian Federation</option>
|
||||
<option value="RW">Rwanda</option>
|
||||
<option value="BL">Saint Barthélemy</option>
|
||||
<option value="SH">Saint Helena, Ascension and Tristan da Cunha</option>
|
||||
<option value="KN">Saint Kitts and Nevis</option>
|
||||
<option value="LC">Saint Lucia</option>
|
||||
<option value="MF">Saint Martin (French part)</option>
|
||||
<option value="PM">Saint Pierre and Miquelon</option>
|
||||
<option value="VC">Saint Vincent and the Grenadines</option>
|
||||
<option value="WS">Samoa</option>
|
||||
<option value="SM">San Marino</option>
|
||||
<option value="ST">Sao Tome and Principe</option>
|
||||
<option value="SA">Saudi Arabia</option>
|
||||
<option value="SN">Senegal</option>
|
||||
<option value="RS">Serbia</option>
|
||||
<option value="SC">Seychelles</option>
|
||||
<option value="SL">Sierra Leone</option>
|
||||
<option value="SG">Singapore</option>
|
||||
<option value="SX">Sint Maarten (Dutch part)</option>
|
||||
<option value="SK">Slovakia</option>
|
||||
<option value="SI">Slovenia</option>
|
||||
<option value="SB">Solomon Islands</option>
|
||||
<option value="SO">Somalia</option>
|
||||
<option value="ZA">South Africa</option>
|
||||
<option value="GS">South Georgia and the South Sandwich Islands</option>
|
||||
<option value="SS">South Sudan</option>
|
||||
<option value="ES">Spain</option>
|
||||
<option value="LK">Sri Lanka</option>
|
||||
<option value="SD">Sudan</option>
|
||||
<option value="SR">Suriname</option>
|
||||
<option value="SJ">Svalbard and Jan Mayen</option>
|
||||
<option value="SZ">Swaziland</option>
|
||||
<option value="SE">Sweden</option>
|
||||
<option value="CH">Switzerland</option>
|
||||
<option value="SY">Syrian Arab Republic</option>
|
||||
<option value="TW">Taiwan, Province of China</option>
|
||||
<option value="TJ">Tajikistan</option>
|
||||
<option value="TZ">Tanzania, United Republic of</option>
|
||||
<option value="TH">Thailand</option>
|
||||
<option value="TL">Timor-Leste</option>
|
||||
<option value="TG">Togo</option>
|
||||
<option value="TK">Tokelau</option>
|
||||
<option value="TO">Tonga</option>
|
||||
<option value="TT">Trinidad and Tobago</option>
|
||||
<option value="TN">Tunisia</option>
|
||||
<option value="TR">Turkey</option>
|
||||
<option value="TM">Turkmenistan</option>
|
||||
<option value="TC">Turks and Caicos Islands</option>
|
||||
<option value="TV">Tuvalu</option>
|
||||
<option value="UG">Uganda</option>
|
||||
<option value="UA">Ukraine</option>
|
||||
<option value="AE">United Arab Emirates</option>
|
||||
<option value="UM">United States Minor Outlying Islands</option>
|
||||
<option value="UY">Uruguay</option>
|
||||
<option value="UZ">Uzbekistan</option>
|
||||
<option value="VU">Vanuatu</option>
|
||||
<option value="VE">Venezuela, Bolivarian Republic of</option>
|
||||
<option value="VN">Viet Nam</option>
|
||||
<option value="VG">Virgin Islands, British</option>
|
||||
<option value="VI">Virgin Islands, U.S.</option>
|
||||
<option value="WF">Wallis and Futuna</option>
|
||||
<option value="EH">Western Sahara</option>
|
||||
<option value="YE">Yemen</option>
|
||||
<option value="ZM">Zambia</option>
|
||||
<option value="ZW">Zimbabwe</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-4">
|
||||
<label for="address_zip">{{'zipPostalCode' | i18n}}</label>
|
||||
<input id="address_zip" class="form-control" type="text" name="address_zip" [(ngModel)]="card.address_zip" required autocomplete="postal-code">
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="method === 'paypal'">
|
||||
<div class="mb-3">
|
||||
<div id="bt-dropin-container" class="mb-1"></div>
|
||||
<small class="text-muted">{{'paypalClickSubmit' | i18n}}</small>
|
||||
</div>
|
||||
</ng-container>
|
||||
<small class="text-muted">{{'paymentChargedAnnually' | i18n}}</small>
|
||||
<h2 class="spaced-header">{{'paymentInformation' | i18n}}</h2>
|
||||
<app-payment></app-payment>
|
||||
<button type="submit" class="btn btn-primary btn-submit" appBlurClick [disabled]="form.loading">
|
||||
<i class="fa fa-spinner fa-spin"></i>
|
||||
<span>{{'submit' | i18n}}</span>
|
||||
|
|
|
@ -1,123 +1,34 @@
|
|||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
ViewChild,
|
||||
} from '@angular/core';
|
||||
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
|
||||
import { PaymentComponent } from './payment.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-premium',
|
||||
templateUrl: 'premium.component.html',
|
||||
})
|
||||
export class PremiumComponent implements OnInit {
|
||||
export class PremiumComponent {
|
||||
@ViewChild(PaymentComponent) paymentComponent: PaymentComponent;
|
||||
|
||||
premiumPrice = 10;
|
||||
storageGbPrice = 4;
|
||||
additionalStorage = 0;
|
||||
method = 'card';
|
||||
card: any = {
|
||||
number: null,
|
||||
exp_month: null,
|
||||
exp_year: null,
|
||||
address_country: '',
|
||||
address_zip: null,
|
||||
};
|
||||
formPromise: Promise<any>;
|
||||
cardExpMonthOptions: any[];
|
||||
cardExpYearOptions: any[];
|
||||
|
||||
private stripeScript: HTMLScriptElement;
|
||||
private btScript: HTMLScriptElement;
|
||||
private btInstance: any = null;
|
||||
|
||||
constructor(private i18nService: I18nService) {
|
||||
this.stripeScript = window.document.createElement('script');
|
||||
this.stripeScript.src = 'https://js.stripe.com/v2/';
|
||||
this.stripeScript.async = true;
|
||||
this.stripeScript.onload = () => {
|
||||
(window as any).Stripe.setPublishableKey('pk_test_KPoCfZXu7mznb9uSCPZ2JpTD');
|
||||
};
|
||||
this.btScript = window.document.createElement('script');
|
||||
this.btScript.src = 'https://js.braintreegateway.com/web/dropin/1.4.0/js/dropin.min.js';
|
||||
this.btScript.async = true;
|
||||
|
||||
this.cardExpMonthOptions = [
|
||||
{ name: '-- ' + i18nService.t('select') + ' --', value: null },
|
||||
{ name: '01 - ' + i18nService.t('january'), value: '01' },
|
||||
{ name: '02 - ' + i18nService.t('february'), value: '02' },
|
||||
{ name: '03 - ' + i18nService.t('march'), value: '03' },
|
||||
{ name: '04 - ' + i18nService.t('april'), value: '04' },
|
||||
{ name: '05 - ' + i18nService.t('may'), value: '05' },
|
||||
{ name: '06 - ' + i18nService.t('june'), value: '06' },
|
||||
{ name: '07 - ' + i18nService.t('july'), value: '07' },
|
||||
{ name: '08 - ' + i18nService.t('august'), value: '08' },
|
||||
{ name: '09 - ' + i18nService.t('september'), value: '09' },
|
||||
{ name: '10 - ' + i18nService.t('october'), value: '10' },
|
||||
{ name: '11 - ' + i18nService.t('november'), value: '11' },
|
||||
{ name: '12 - ' + i18nService.t('december'), value: '12' },
|
||||
];
|
||||
|
||||
this.cardExpYearOptions = [
|
||||
{ name: '-- ' + i18nService.t('select') + ' --', value: null },
|
||||
];
|
||||
const year = (new Date()).getFullYear();
|
||||
for (let i = year; i < (year + 10); i++) {
|
||||
this.cardExpYearOptions.push({ name: i.toString(), value: i.toString().slice(-2) });
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
window.document.body.appendChild(this.stripeScript);
|
||||
window.document.body.appendChild(this.btScript);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
window.document.body.removeChild(this.stripeScript);
|
||||
window.document.body.removeChild(this.btScript);
|
||||
Array.from(window.document.querySelectorAll('iframe')).forEach((el) => {
|
||||
if (el.src != null && el.src.indexOf('stripe') > -1) {
|
||||
window.document.body.removeChild(el);
|
||||
}
|
||||
});
|
||||
}
|
||||
constructor(private i18nService: I18nService) { }
|
||||
|
||||
async submit() {
|
||||
try {
|
||||
const token = await this.createPaymentToken();
|
||||
const token = await this.paymentComponent.createPaymentToken();
|
||||
console.log(token);
|
||||
} catch (e) {
|
||||
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
changeMethod() {
|
||||
if (this.method !== 'paypal') {
|
||||
this.btInstance = null;
|
||||
return;
|
||||
}
|
||||
|
||||
window.setTimeout(() => {
|
||||
(window as any).braintree.dropin.create({
|
||||
authorization: 'sandbox_r72q8jq6_9pnxkwm75f87sdc2',
|
||||
container: '#bt-dropin-container',
|
||||
paymentOptionPriority: ['paypal'],
|
||||
paypal: {
|
||||
flow: 'vault',
|
||||
buttonStyle: {
|
||||
label: 'pay',
|
||||
size: 'medium',
|
||||
shape: 'pill',
|
||||
color: 'blue',
|
||||
},
|
||||
},
|
||||
}, (createErr: any, instance: any) => {
|
||||
if (createErr != null) {
|
||||
console.error(createErr);
|
||||
return;
|
||||
}
|
||||
this.btInstance = instance;
|
||||
});
|
||||
}, 250);
|
||||
}
|
||||
|
||||
get additionalStorageTotal(): number {
|
||||
return this.storageGbPrice * this.additionalStorage;
|
||||
}
|
||||
|
@ -125,26 +36,4 @@ export class PremiumComponent implements OnInit {
|
|||
get total(): number {
|
||||
return this.additionalStorageTotal + this.premiumPrice;
|
||||
}
|
||||
|
||||
private createPaymentToken() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.method === 'paypal') {
|
||||
this.btInstance.requestPaymentMethod().then((payload: any) => {
|
||||
resolve(payload.nonce);
|
||||
}).catch((err: any) => {
|
||||
reject(err.message);
|
||||
});
|
||||
} else {
|
||||
(window as any).Stripe.card.createToken(this.card, (status: number, response: any) => {
|
||||
if (status === 200 && response.id != null) {
|
||||
resolve(response.id);
|
||||
} else if (response.error != null) {
|
||||
reject(response.error.message);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,16 @@
|
|||
</app-two-factor-verify>
|
||||
<ng-container *ngIf="authed">
|
||||
<div class="modal-body text-center">
|
||||
<p>{{'twoFactorRecoveryYourCode' | i18n}}:</p>
|
||||
<code>{{code}}</code>
|
||||
<ng-container *ngIf="code">
|
||||
<p>{{'twoFactorRecoveryYourCode' | i18n}}:</p>
|
||||
<code class="text-lg">{{code}}</code>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!code">
|
||||
{{'twoFactorRecoveryNoCode' | i18n}}
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button appBlurClick type="button" class="btn btn-primary" (click)="print()">{{'printCode' | i18n}}</button>
|
||||
<button appBlurClick type="button" class="btn btn-primary" (click)="print()" *ngIf="code">{{'printCode' | i18n}}</button>
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">{{'close' | i18n}}</button>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<img [src]="'https://haveibeenpwned.com/Content/Images/PwnedLogos/' + a.name + '.' + a.logoType" alt="" class="img-fluid">
|
||||
</div>
|
||||
<div class="col-7">
|
||||
<h3>{{a.title}}</h3>
|
||||
<h3 class="text-lg">{{a.title}}</h3>
|
||||
<p [innerHTML]="a.description"></p>
|
||||
<p class="mb-1">{{'compromisedData' | i18n}}:</p>
|
||||
<ul>
|
||||
|
|
|
@ -1132,6 +1132,9 @@
|
|||
"twoFactorRecoveryYourCode": {
|
||||
"message": "Your Bitwarden two-step login recovery code"
|
||||
},
|
||||
"twoFactorRecoveryNoCode": {
|
||||
"message": "You have not enabled any two-step login providers yet. After you have enabled a two-step login provider you can check back here for your recovery code."
|
||||
},
|
||||
"printCode": {
|
||||
"message": "Print Code",
|
||||
"description": "Print 2FA recovery code"
|
||||
|
@ -1225,11 +1228,11 @@
|
|||
"month": {
|
||||
"message": "month"
|
||||
},
|
||||
"cardChargedAnnually": {
|
||||
"message": "Your card will be charged immediately and on a recurring basis each year. You may cancel at any time."
|
||||
"paymentChargedAnnually": {
|
||||
"message": "Your payment method will be charged immediately and on a recurring basis each year. You may cancel at any time."
|
||||
},
|
||||
"cardChargedMonthly": {
|
||||
"message": "Your card will be charged immediately and on a recurring basis each month. You may cancel at any time."
|
||||
"paymentChargedMonthly": {
|
||||
"message": "Your payment method will be charged immediately and on a recurring basis each month. You may cancel at any time."
|
||||
},
|
||||
"paymentInformation": {
|
||||
"message": "Payment Information"
|
||||
|
|
|
@ -25,6 +25,7 @@ $h4-font-size: 1rem;
|
|||
$h5-font-size: 1rem;
|
||||
$h6-font-size: 1rem;
|
||||
|
||||
$font-size-lg: 1.18rem;
|
||||
$code-font-size: 100%;
|
||||
|
||||
$navbar-padding-y: .75rem;
|
||||
|
@ -84,7 +85,7 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
.secondary-header {
|
||||
.secondary-header, .spaced-header {
|
||||
margin-top: 4rem;
|
||||
}
|
||||
|
||||
|
@ -286,6 +287,10 @@ label:not(.form-check-label) {
|
|||
}
|
||||
}
|
||||
|
||||
.text-lg {
|
||||
font-size: $font-size-lg;
|
||||
}
|
||||
|
||||
app-vault-groupings {
|
||||
.card {
|
||||
#search {
|
||||
|
@ -378,18 +383,6 @@ app-avatar {
|
|||
}
|
||||
}
|
||||
|
||||
app-two-factor-recovery {
|
||||
code {
|
||||
font-size: $font-size-lg;
|
||||
}
|
||||
}
|
||||
|
||||
app-breach-report {
|
||||
.list-group-item h3 {
|
||||
font-size: $font-size-lg;
|
||||
}
|
||||
}
|
||||
|
||||
#duo-frame {
|
||||
background: url('../images/loading.svg') 0 0 no-repeat;
|
||||
height: 330px;
|
||||
|
|
Loading…
Reference in New Issue