payment-token-efi 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,13 +85,7 @@ _**Obs**: Esta biblioteca não é compatível no backend em Node.js_
85
85
 
86
86
  ### **Tipagens TypeScript**
87
87
 
88
- Se você estiver utilizando TypeScript, você pode instalar as tipagens para a biblioteca:
89
-
90
- ```sh
91
- npm install @types/payment-token-efi
92
- // ou
93
- yarn add @types/payment-token-efi
94
- ```
88
+ Se você estiver utilizando TypeScript, quando você instalar a biblioteca **payment-token-efi**, o TypeScript deve ser capaz de encontrar os tipos automaticamente localizados em `types/payment-token-efi.d.ts`
95
89
 
96
90
  ---
97
91
 
@@ -13,7 +13,7 @@ const App: React.FC = () => {
13
13
  try {
14
14
  const result = await EfiPay.CreditCard.debugger(true, true)
15
15
  .setAccount("Identificador_de_conta_aqui")
16
- .setEnvironment("sandbox") // 'production' or 'sandbox'
16
+ .setEnvironment("sandbox") // 'production' or 'sandbox'
17
17
  .setCreditCardData({
18
18
  brand: "visa",
19
19
  number: "4485785674290087",
@@ -24,10 +24,12 @@ const App: React.FC = () => {
24
24
  })
25
25
  .getPaymentToken();
26
26
 
27
- setPaymentToken(result.payment_token);
28
- setCardMask(result.card_mask);
29
- console.log("payment_token", result.payment_token);
30
- console.log("card_mask", result.card_mask);
27
+ if ("payment_token" in result && "card_mask" in result) {
28
+ setPaymentToken(result.payment_token);
29
+ setCardMask(result.card_mask);
30
+ console.log("payment_token", result.payment_token);
31
+ console.log("card_mask", result.card_mask);
32
+ }
31
33
  } catch (err: any) {
32
34
  console.log(err);
33
35
  console.log("Código: ", err.code);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-token-efi",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Módulo Javascript que permite a criptografia dos dados do cartão do cartão a partir do browser do cliente para gerar o payment_token e identificar a bandeira do cartão.",
5
5
  "keywords": [
6
6
  "API",
@@ -1,5 +1,5 @@
1
1
  declare module "payment-token-efi" {
2
- export namespace EfiJs {
2
+ export namespace EfiPay {
3
3
  namespace CreditCard {
4
4
  function setEnvironment(environment: "production" | "sandbox"): typeof CreditCard;
5
5
  function setCardNumber(cardNumber: string): typeof CreditCard;
@@ -46,4 +46,6 @@ declare module "payment-token-efi" {
46
46
  }
47
47
  }
48
48
  }
49
+
50
+ export default EfiPay;
49
51
  }