Skip to content

Commit

Permalink
feat: boleto legal text (#3)
Browse files Browse the repository at this point in the history
* feat: boleto legal text

* chore: add type

Co-authored-by: Ratnadeep Simhadri <rsimhadri@paypal.com>
  • Loading branch information
RatnadeepSimhadri and Ratnadeep Simhadri committed May 10, 2022
1 parent 6b36e5b commit 72e9dda
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
19 changes: 12 additions & 7 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ import { buildContent, FPTI_KEY } from './util';

export function Legal (options : LegalConfigInput) : Object {

/* Export Constants for Referencing by the Client*/
Legal.ERROR_CODE = {
PAYMENT_SOURCE_INFO_CANNOT_BE_VERIFIED: 'PAYMENT_SOURCE_INFO_CANNOT_BE_VERIFIED',
PAYMENT_SOURCE_DECLINED_BY_PROCESSOR: 'PAYMENT_SOURCE_DECLINED_BY_PROCESSOR'
};

return {
render(container) {

Expand Down Expand Up @@ -46,10 +40,21 @@ export function Legal (options : LegalConfigInput) : Object {
getLogger().info(JSON.stringify(metadata));
getLogger().info('PUI Legal Component Loaded').track({
[FPTI_KEY.CLIENT_ID]: getClientID(),
[FPTI_KEY.PAGE_TYPE]: 'PUI'
[FPTI_KEY.PAGE_TYPE]: options.fundingSource


});
}
};
}

Legal.FUNDING = {
PAY_UPON_INVOICE: 'PayUponInvoice',
BOLETO: 'boleto'
};

/* Export Constants for Referencing by the Client*/
Legal.ERROR_CODE = {
PAYMENT_SOURCE_INFO_CANNOT_BE_VERIFIED: 'PAYMENT_SOURCE_INFO_CANNOT_BE_VERIFIED',
PAYMENT_SOURCE_DECLINED_BY_PROCESSOR: 'PAYMENT_SOURCE_DECLINED_BY_PROCESSOR'
};
10 changes: 10 additions & 0 deletions src/constants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/types.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* @flow */
type FundingSource = "PayUponInvoice";
type FundingSource = "PayUponInvoice" | "boleto";
type ErrorCode = "PAYMENT_SOURCE_INFO_CANNOT_BE_VERIFIED" | "PAYMENT_SOURCE_DECLINED_BY_PROCESSOR";

export type ContentConfig = {|
Expand Down
8 changes: 7 additions & 1 deletion src/util/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow */
import type { ContentConfig } from '../types';
import { PayUponInvoice } from '../constants';
import { PayUponInvoice, boleto } from '../constants';

export function buildContent(options : ContentConfig) : string {
let content = '';
Expand All @@ -20,6 +20,12 @@ export function buildContent(options : ContentConfig) : string {

break;
}
case 'boleto': {
content = boleto?.LEGAL_TEXT?.[options.legalLocale]?.(
paypalPolicyLink
);
break;
}
default: {
break;
}
Expand Down

0 comments on commit 72e9dda

Please sign in to comment.