1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-07-21 14:45:50 +02:00

Combine tax info with other updates

This commit is contained in:
Chad Scharf 2020-06-17 20:11:30 -04:00
parent 4502a966a1
commit 68d3d7abfd
4 changed files with 10 additions and 7 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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);
}
});

View File

@ -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) {