-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(payment): INT-2181 Add secured fields to support TSV with hosted…
… fields
- Loading branch information
Victor Parra
committed
Dec 31, 2019
1 parent
581eb7c
commit 69d4753
Showing
10 changed files
with
152 additions
and
45 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/app/payment/paymentMethod/AdyenV2CardValidation.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { mount } from 'enzyme'; | ||
import React, { FunctionComponent } from 'react'; | ||
|
||
import AdyenV2CardValidation, { AdyenV2CardValidationProps } from './AdyenV2CardValidation'; | ||
|
||
describe('AdyenV2CardValidation', () => { | ||
let defaultProps: AdyenV2CardValidationProps; | ||
let AdyenV2CardValidationTest: FunctionComponent<AdyenV2CardValidationProps>; | ||
|
||
beforeEach(() => { | ||
defaultProps = { | ||
verificationFieldsContainerId: 'container', | ||
shouldShowNumberField: true, | ||
}; | ||
|
||
AdyenV2CardValidationTest = props => ( | ||
<AdyenV2CardValidation { ...props } /> | ||
); | ||
}); | ||
|
||
it('renders Adyen V2 secured fields', () => { | ||
const container = mount(<AdyenV2CardValidationTest { ...defaultProps } />); | ||
|
||
expect(container.props()) | ||
.toEqual(expect.objectContaining({ | ||
verificationFieldsContainerId: 'container', | ||
shouldShowNumberField: true, | ||
})); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import classNames from 'classnames'; | ||
import React from 'react'; | ||
|
||
import { TranslatedString } from '../../locale'; | ||
|
||
export interface AdyenV2CardValidationProps { | ||
verificationFieldsContainerId?: string; | ||
shouldShowNumberField: boolean; | ||
} | ||
|
||
const AdyenV2CardValidation: React.FunctionComponent<AdyenV2CardValidationProps> = ({ | ||
verificationFieldsContainerId, | ||
shouldShowNumberField, | ||
}) => ( | ||
<div> | ||
{ shouldShowNumberField && <p> | ||
<strong> | ||
<TranslatedString id="payment.instrument_trusted_shipping_address_title_text" /> | ||
</strong> | ||
|
||
<br /> | ||
|
||
<TranslatedString id="payment.instrument_trusted_shipping_address_text" /> | ||
</p> } | ||
|
||
<div className="form-ccFields" id={ verificationFieldsContainerId }> | ||
{ <div className="form-field form-field--ccNumber" style={ { display: (shouldShowNumberField) ? undefined : 'none' } }> | ||
<label htmlFor="encryptedCardNumber"> | ||
<TranslatedString id="payment.credit_card_number_label" /> | ||
</label> | ||
<div className="form-input optimizedCheckout-form-input has-icon" data-cse="encryptedCardNumber" id="encryptedCardNumber" /> | ||
</div> } | ||
<div className="form-field form-ccFields-field--ccCvv"> | ||
<label htmlFor="encryptedSecurityCode"> | ||
<TranslatedString id="payment.credit_card_cvv_label" /> | ||
</label> | ||
<div | ||
className={ classNames( | ||
'form-input', | ||
'optimizedCheckout-form-input', | ||
'has-icon' | ||
) } | ||
data-cse="encryptedSecurityCode" | ||
id="encryptedSecurityCode" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default AdyenV2CardValidation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters