1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

billing imrovements

This commit is contained in:
Kyle Spearrin 2019-02-21 18:03:39 -05:00
parent 33b539858f
commit 8e9ab12219
3 changed files with 16 additions and 7 deletions

View File

@ -45,8 +45,8 @@
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="https://vault.bitwarden.com">
<input type="hidden" name="cancel_return" value="https://vault.bitwarden.com">
<input type="hidden" name="return" value="{{ppReturnUrl}}">
<input type="hidden" name="cancel_return" value="{{ppReturnUrl}}">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHosted">
<input type="hidden" name="amount" value="{{creditAmount}}">

View File

@ -24,7 +24,7 @@ import { WebConstants } from '../../services/webConstants';
templateUrl: 'add-credit.component.html',
})
export class AddCreditComponent implements OnInit {
@Input() creditAmount = '10.00';
@Input() creditAmount: string;
@Input() showOptions = true;
@Input() method = PaymentMethodType.PayPal;
@Input() organizationId: string;
@ -37,6 +37,7 @@ export class AddCreditComponent implements OnInit {
ppButtonFormAction = WebConstants.paypal.buttonActionProduction;
ppButtonBusinessId = WebConstants.paypal.businessIdProduction;
ppButtonCustomField: string;
ppReturnUrl: string;
ppLoading = false;
subject: string;
formPromise: Promise<any>;
@ -52,17 +53,24 @@ export class AddCreditComponent implements OnInit {
async ngOnInit() {
if (this.organizationId != null) {
if (this.creditAmount == null) {
this.creditAmount = '20.00';
}
this.ppButtonCustomField = 'organization_id:' + this.organizationId;
const org = await this.userService.getOrganization(this.organizationId);
if (org != null) {
this.subject = org.name;
}
} else {
if (this.creditAmount == null) {
this.creditAmount = '10.00';
}
const userId = await this.userService.getUserId();
this.subject = await this.userService.getEmail();
this.ppButtonCustomField = 'user_id:' + userId;
}
this.ppButtonCustomField += ',account_credit:true';
this.ppReturnUrl = window.location.href;
}
async submit() {

View File

@ -1,10 +1,11 @@
<div class="page-header">
<div class="page-header d-flex">
<h1>
{{'billing' | i18n}}
<small>
<i class="fa fa-spinner fa-spin text-muted" *ngIf="firstLoaded && loading" title="{{'loading' | i18n}}"></i>
</small>
</h1>
<button (click)="load()" class="btn btn-sm btn-outline-primary ml-auto" *ngIf="firstLoaded" [disabled]="loading">
<i class="fa fa-refresh fa-fw" [ngClass]="{'fa-spin': loading}"></i>
{{'refresh' | i18n}}
</button>
</div>
<i class="fa fa-spinner fa-spin text-muted" *ngIf="!firstLoaded && loading" title="{{'loading' | i18n}}"></i>
<ng-container *ngIf="billing">