Skip to content

Commit

Permalink
Add support for the latest CB implementation (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioan-ghisoi-cko authored Dec 2, 2022
1 parent 7198cc0 commit 8bd2a2f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 34 deletions.
34 changes: 5 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ If you want to use Frame in single frame mode you cna do it like this:

# For Carte Bancaire

If you want to accept Carte Bancaire we provide an additional element so that the scheme can be picked. You also need to make sure you update the config to specify the selectors. If you use Multi Frames you need to provide the selectors for schemeChoice, cardNumber, expiryDate and cvv. For Single Frames you just need the schemeChoice. Make sure you don't forget to add the SchemeChoice component, and write some CSS sso when it renders, it does not overlap your other elements.
If you want to accept Carte Bancaire you can pass the schemeChoice parameter in the config.
This will render the scheme icon with a dropdown, and customers will be able to select their scheme.
Make sure your CSS is not interfering with the display of the dropdown.

```js
import React from 'react';
import { Frames, CardNumber, ExpiryDate, Cvv, CardFrame, SchemeChoice } from './frames';
import { Frames, CardNumber, ExpiryDate, Cvv, CardFrame } from 'frames-react';

import './App.css';

Expand All @@ -136,34 +138,11 @@ function App() {
<Frames
config={{
publicKey: 'pk_sbox_ogynfaoply5o6ksuw3d3hcee3ez',
cardNumber: {
frameSelector: '.card-number-frame',
},
expiryDate: {
frameSelector: '.expiry-date-frame',
},
cvv: {
frameSelector: '.cvv-frame',
},
schemeChoice: {
frameSelector: '.scheme-choice-frame',
},
localization: 'EN-GB',
debug: false,
schemeChoice: true,
}}
ready={() => {}}
frameActivated={(e) => {}}
frameFocus={(e) => {}}
frameBlur={(e) => {}}
frameValidationChanged={(e) => {}}
paymentMethodChanged={(e) => {}}
cardValidationChanged={(e) => {}}
cardSubmitted={() => {}}
cardTokenized={(e) => {
alert(e.token);
}}
cardTokenizationFailed={(e) => {}}
cardBinChanged={(e) => {}}
>
<CardNumber />
<div className="date-and-code">
Expand All @@ -174,9 +153,6 @@ function App() {
{/* Or if you want to use single frames: */}
{/* <CardFrame /> */}

{/* If you you use CB and need to select the Scheme: */}
<SchemeChoice />

<button
id="pay-button"
onClick={() => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frames-react",
"version": "1.0.13",
"version": "1.1.0",
"peerDependencies": {
"react": ">=16.8"
},
Expand Down
8 changes: 5 additions & 3 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ html {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

iframe {
/* This fixes a mobile Safari bug */
height: 38px !important;
.card-frame,
.card-number-frame,
.expiry-date-frame,
.cvv-frame {
height: 38px;
}

#schemeChoice {
Expand Down
2 changes: 1 addition & 1 deletion src/frames/types/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export interface FramesInitProps {
cardholder?: FramesCardholder;
localization?: FramesLanguages | FramesLocalization;
modes?: Array<String>;
schemeChoice?: SelectorChoiceType;
schemeChoice?: SelectorChoiceType | boolean;
cardNumber?: SelectorChoiceType;
expiryDate?: SelectorChoiceType;
cvv?: SelectorChoiceType;
Expand Down

0 comments on commit 8bd2a2f

Please sign in to comment.