mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-02 08:40:08 +01:00
Combine tax info with other updates
This commit is contained in:
parent
4502a966a1
commit
68d3d7abfd
@ -30,7 +30,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted">{{'creditDelayed' | i18n}}</small>
|
<small class="form-text text-muted">{{'creditDelayed' | i18n}}</small>
|
||||||
</div>
|
</div>
|
||||||
<app-tax-info></app-tax-info>
|
|
||||||
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading || ppLoading">
|
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading || ppLoading">
|
||||||
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}" aria-hidden="true"></i>
|
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}" aria-hidden="true"></i>
|
||||||
<span>{{'submit' | i18n}}</span>
|
<span>{{'submit' | i18n}}</span>
|
||||||
|
@ -21,8 +21,6 @@ import { BitPayInvoiceRequest } from 'jslib/models/request/bitPayInvoiceRequest'
|
|||||||
|
|
||||||
import { WebConstants } from '../../services/webConstants';
|
import { WebConstants } from '../../services/webConstants';
|
||||||
|
|
||||||
import { TaxInfoComponent } from './tax-info.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-add-credit',
|
selector: 'app-add-credit',
|
||||||
templateUrl: 'add-credit.component.html',
|
templateUrl: 'add-credit.component.html',
|
||||||
@ -36,7 +34,6 @@ export class AddCreditComponent implements OnInit {
|
|||||||
@Output() onCanceled = new EventEmitter();
|
@Output() onCanceled = new EventEmitter();
|
||||||
|
|
||||||
@ViewChild('ppButtonForm', { read: ElementRef }) ppButtonFormRef: ElementRef;
|
@ViewChild('ppButtonForm', { read: ElementRef }) ppButtonFormRef: ElementRef;
|
||||||
@ViewChild(TaxInfoComponent) taxInfoComponent: TaxInfoComponent;
|
|
||||||
|
|
||||||
paymentMethodType = PaymentMethodType;
|
paymentMethodType = PaymentMethodType;
|
||||||
ppButtonFormAction = WebConstants.paypal.buttonActionProduction;
|
ppButtonFormAction = WebConstants.paypal.buttonActionProduction;
|
||||||
@ -89,7 +86,6 @@ export class AddCreditComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.taxInfoComponent.submitTaxInfo();
|
|
||||||
if (this.method === PaymentMethodType.PayPal) {
|
if (this.method === PaymentMethodType.PayPal) {
|
||||||
this.ppButtonFormRef.nativeElement.submit();
|
this.ppButtonFormRef.nativeElement.submit();
|
||||||
this.ppLoading = true;
|
this.ppLoading = true;
|
||||||
|
@ -41,13 +41,20 @@ export class AdjustPaymentComponent {
|
|||||||
async submit() {
|
async submit() {
|
||||||
try {
|
try {
|
||||||
const request = new PaymentRequest();
|
const request = new PaymentRequest();
|
||||||
await this.taxInfoComponent.submitTaxInfo();
|
|
||||||
this.formPromise = this.paymentComponent.createPaymentToken().then((result) => {
|
this.formPromise = this.paymentComponent.createPaymentToken().then((result) => {
|
||||||
request.paymentToken = result[0];
|
request.paymentToken = result[0];
|
||||||
request.paymentMethodType = result[1];
|
request.paymentMethodType = result[1];
|
||||||
|
request.postalCode = this.taxInfoComponent.taxInfo.postalCode;
|
||||||
|
request.country = this.taxInfoComponent.taxInfo.country;
|
||||||
if (this.organizationId == null) {
|
if (this.organizationId == null) {
|
||||||
return this.apiService.postAccountPayment(request);
|
return this.apiService.postAccountPayment(request);
|
||||||
} else {
|
} else {
|
||||||
|
request.taxId = this.taxInfoComponent.taxInfo.taxId;
|
||||||
|
request.state = this.taxInfoComponent.taxInfo.state;
|
||||||
|
request.line1 = this.taxInfoComponent.taxInfo.line1;
|
||||||
|
request.line2 = this.taxInfoComponent.taxInfo.line2;
|
||||||
|
request.city = this.taxInfoComponent.taxInfo.city;
|
||||||
|
request.state = this.taxInfoComponent.taxInfo.state;
|
||||||
return this.apiService.postOrganizationPayment(this.organizationId, request);
|
return this.apiService.postOrganizationPayment(this.organizationId, request);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -78,7 +78,6 @@ export class PremiumComponent implements OnInit {
|
|||||||
return this.finalizePremium();
|
return this.finalizePremium();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await this.taxInfoComponent.submitTaxInfo();
|
|
||||||
this.formPromise = this.paymentComponent.createPaymentToken().then((result) => {
|
this.formPromise = this.paymentComponent.createPaymentToken().then((result) => {
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('paymentMethodType', result[1].toString());
|
fd.append('paymentMethodType', result[1].toString());
|
||||||
@ -86,6 +85,8 @@ export class PremiumComponent implements OnInit {
|
|||||||
fd.append('paymentToken', result[0]);
|
fd.append('paymentToken', result[0]);
|
||||||
}
|
}
|
||||||
fd.append('additionalStorageGb', (this.additionalStorage || 0).toString());
|
fd.append('additionalStorageGb', (this.additionalStorage || 0).toString());
|
||||||
|
fd.append('country', this.taxInfoComponent.taxInfo.country);
|
||||||
|
fd.append('postalCode', this.taxInfoComponent.taxInfo.postalCode);
|
||||||
return this.apiService.postPremium(fd);
|
return this.apiService.postPremium(fd);
|
||||||
}).then((paymentResponse) => {
|
}).then((paymentResponse) => {
|
||||||
if (!paymentResponse.success && paymentResponse.paymentIntentClientSecret != null) {
|
if (!paymentResponse.success && paymentResponse.paymentIntentClientSecret != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user