Skip to content

Commit 3943872

Browse files
jdartjdart-bold
andauthored
Paypal Attribution Id (#12)
Co-authored-by: Jonathan Dart <jonathan.dart@boldcommerce.com>
1 parent cebc545 commit 3943872

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/paypal/getPaypalScriptOptions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ export function getPaypalScriptOptions(clientId: string, debug: boolean, merchan
1313
'integrationDate': '2020-03-10',
1414
'merchantId': merchantId,
1515
'components': components,
16+
'dataPartnerAttributionId': debug ? 'BoldCommerce_BT_TEST' : 'BoldCommerce_BT',
1617
};
1718
}

tests/paypal/getPaypalScriptOptions.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const getCurrencyMock = mocked(getCurrency, true);
99

1010
describe('testing getPaypalScriptOptions function', () => {
1111
const clientId = 'some-client-id';
12-
const isDebug = false;
12+
let isDebug = false;
1313

1414
beforeEach(() => {
1515
jest.clearAllMocks();
@@ -27,9 +27,16 @@ describe('testing getPaypalScriptOptions function', () => {
2727
'integrationDate': '2020-03-10',
2828
'merchantId': undefined,
2929
'components': undefined,
30+
'dataPartnerAttributionId': 'BoldCommerce_BT',
3031
};
3132

32-
const result = getPaypalScriptOptions(clientId, isDebug);
33+
let result = getPaypalScriptOptions(clientId, isDebug);
34+
35+
expect(result).toStrictEqual(expectation);
36+
37+
expectation.dataPartnerAttributionId = 'BoldCommerce_BT_TEST';
38+
isDebug = expectation.debug = true;
39+
result = getPaypalScriptOptions(clientId, isDebug);
3340

3441
expect(result).toStrictEqual(expectation);
3542
});

0 commit comments

Comments
 (0)