Skip to content

Commit

Permalink
INTER-3509-Add hide-credit-card-payment-option action
Browse files Browse the repository at this point in the history
- New action allows the parent window to dispatch an action to PIGI to
  hide the credit card payment option.
  • Loading branch information
jeremywiebeofbold committed May 14, 2024
1 parent 70f21eb commit a4d7774
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pigi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './sendAddPaymentAction';
export * from './sendClearErrorMessageAction';
export * from './sendDisplayErrorMessageAction';
export * from './sendHandleScaAction';
export * from './sendHideCreditCardOptionAction';
export * from './sendRefreshOrderAction';
export * from './sendSelectPaymentMethodAction';
export * from './sendUpdateLanguageAction';
Expand Down
24 changes: 24 additions & 0 deletions src/pigi/sendHideCreditCardOptionAction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {pigiActionTypes, IApiReturnObject, IPigiActionType, IPigiResponseType, sendPigiAction, sendPigiActionAsync} from 'src';

const action: IPigiActionType = { actionType: pigiActionTypes.PIGI_HIDE_CREDIT_CARD_OPTION };
/**
* ## sendHideCreditCardOptionAction
*
* This action is to be sent after PIGI has been loaded. It causes the credit card
* fields in PIGI to be hidden.
*/
export function sendHideCreditCardOptionAction(): IApiReturnObject {
return sendPigiAction(action);

Check failure on line 11 in src/pigi/sendHideCreditCardOptionAction.ts

View workflow job for this annotation

GitHub Actions / Yarn Build

Expected indentation of 4 spaces but found 2
}

/**
* ## sendHideCreditCardOptionActionAsync
*
* This action is to be sent after PIGI has been loaded. It causes the credit card
* fields in PIGI to be hidden.
*
* This method waits for a response back from PIGI before returning.
*/
export async function sendHideCreditCardOptionActionAsync(): Promise<IPigiResponseType> {
return await sendPigiActionAsync(action);

Check failure on line 23 in src/pigi/sendHideCreditCardOptionAction.ts

View workflow job for this annotation

GitHub Actions / Yarn Build

Expected indentation of 4 spaces but found 2
}
1 change: 1 addition & 0 deletions src/types/apiInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface IPigiActionTypes {
PIGI_PAYMENT_ADDED: string;
PIGI_DISPLAY_IN_FULL_PAGE: string;
PIGI_DISPLAY_IN_FULL_PAGE_DONE: string;
PIGI_HIDE_CREDIT_CARD_OPTION: string;
}

export interface IExternalPaymentGatewayToParentActionTypes {
Expand Down
1 change: 1 addition & 0 deletions src/variables/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const pigiActionTypes: IPigiActionTypes = {
PIGI_PAYMENT_ADDED: 'PIGI_PAYMENT_ADDED',
PIGI_DISPLAY_IN_FULL_PAGE: 'PIGI_DISPLAY_IN_FULL_PAGE',
PIGI_DISPLAY_IN_FULL_PAGE_DONE: 'PIGI_DISPLAY_IN_FULL_PAGE_DONE',
PIGI_HIDE_CREDIT_CARD_OPTION: 'PIGI_HIDE_CREDIT_CARD_OPTION',
};

export const externalPaymentGatewayToParentActionTypes: IExternalPaymentGatewayToParentActionTypes = {
Expand Down

0 comments on commit a4d7774

Please sign in to comment.