Skip to content

Commit f284f8c

Browse files
jaalah-akamaijaalahbnussman-akamai
authored
added: [M3-8008, M3-8277] - Update invoices for JP and EU (#10606)
Co-authored-by: Jaalah Ramos <jaalah.ramos@gmail.com> Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>
1 parent 40ee98b commit f284f8c

3 files changed

Lines changed: 35 additions & 12 deletions

File tree

packages/manager/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1515

1616
- Informational notice about capturing an image from a Linode in a distributed compute region ([#10544](https://github.com/linode/manager/pull/10544))
1717
- Volume & Images landing pages search and filtering ([#10570](https://github.com/linode/manager/pull/10570))
18+
- Standard Tax Rate for JP ([#10606](https://github.com/linode/manager/pull/10606))
19+
- B2B Tax ID for EU ([#10606](https://github.com/linode/manager/pull/10606))
1820

1921
### Changed:
2022

packages/manager/src/featureFlags.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ import type { NoticeVariant } from 'src/components/Notice/Notice';
77
export interface TaxDetail {
88
qi_registration?: string;
99
tax_id: string;
10+
tax_ids?: Record<
11+
'B2B' | 'B2C',
12+
{
13+
tax_id: string;
14+
tax_name: string;
15+
}
16+
>;
17+
tax_info?: string;
1018
tax_name: string;
1119
}
1220

packages/manager/src/features/Billing/PdfGenerator/PdfGenerator.ts

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
import {
2-
Account,
3-
Invoice,
4-
InvoiceItem,
5-
Payment,
6-
} from '@linode/api-v4/lib/account';
71
import axios from 'axios';
82
import jsPDF from 'jspdf';
93
import { splitEvery } from 'ramda';
104

115
import { ADDRESSES } from 'src/constants';
126
import { reportException } from 'src/exceptionReporting';
13-
import { FlagSet, TaxDetail } from 'src/featureFlags';
147
import { formatDate } from 'src/utilities/formatDate';
158

169
import { getShouldUseAkamaiBilling } from '../billingUtils';
1710
import AkamaiLogo from './akamai-logo.png';
1811
import {
19-
PdfResult,
2012
createFooter,
2113
createInvoiceItemsTable,
2214
createInvoiceTotalsTable,
@@ -27,7 +19,15 @@ import {
2719
pageMargin,
2820
} from './utils';
2921

22+
import type { PdfResult } from './utils';
3023
import type { Region } from '@linode/api-v4';
24+
import type {
25+
Account,
26+
Invoice,
27+
InvoiceItem,
28+
Payment,
29+
} from '@linode/api-v4/lib/account';
30+
import type { FlagSet, TaxDetail } from 'src/featureFlags';
3131

3232
const baseFont = 'helvetica';
3333

@@ -98,17 +98,29 @@ const addLeftHeader = (
9898
doc.setFont(baseFont, 'normal');
9999

100100
if (countryTax) {
101-
addLine(`${countryTax.tax_name}: ${countryTax.tax_id}`);
101+
const { tax_id, tax_ids, tax_name } = countryTax;
102+
103+
addLine(`${tax_name}: ${tax_id}`);
104+
105+
if (tax_ids?.B2B) {
106+
const { tax_id: b2bTaxId, tax_name: b2bTaxName } = tax_ids.B2B;
107+
addLine(`${b2bTaxName}: ${b2bTaxId}`);
108+
}
102109
}
103110
/**
104-
* M3-7847 Add Akamai's Japanese QI System ID to Japanese Invoices.
111+
* [M3-7847, M3-8008] Add Akamai's Japanese QI System ID to Japanese Invoices.
105112
* Since LD automatically serves Tax data based on the user's
106113
* we can check on qi_registration field to render QI Registration.
107114
* */
108115
if (countryTax && countryTax.qi_registration) {
109-
const line = `QI Registration # ${countryTax.qi_registration}`;
110-
addLine(line);
116+
const qiRegistration = `QI Registration # ${countryTax.qi_registration}`;
117+
addLine(qiRegistration);
118+
}
119+
120+
if (countryTax?.tax_info) {
121+
addLine(countryTax.tax_info);
111122
}
123+
112124
if (provincialTax) {
113125
addLine(`${provincialTax.tax_name}: ${provincialTax.tax_id}`);
114126
}
@@ -248,6 +260,7 @@ export const printInvoice = async (
248260
* as of 2/20/2020 we have the following cases:
249261
*
250262
* VAT: Applies only to EU countries; started from 6/1/2019 and we have an EU tax id
263+
* - [M3-8277] For EU customers, invoices will include VAT for B2C transactions and exclude VAT for B2B transactions. Both VAT numbers will be shown on the invoice template for EU countries.
251264
* GMT: Applies to both Australia and India, but we only have a tax ID for Australia.
252265
*/
253266
const hasTax = !taxes?.date ? true : convertedInvoiceDate > TaxStartDate;

0 commit comments

Comments
 (0)