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