{"_id":"@d24/sdk-minimal","_rev":"2-fd59484a2c991d8db5cb1ac96e8d8376","name":"@d24/sdk-minimal","dist-tags":{"latest":"1.0.19"},"versions":{"1.0.17":{"name":"@d24/sdk-minimal","version":"1.0.17","description":"Learn how to use our SDK in Javascript to allow integrations with our Deposits APIs","scripts":{"build":"npm run clean && tsc && vite build","clean":"rimraf ./dist/","test":"jest --watch","clear_jest":"jest --clearCache","prepare":"husky install","test:coverage":"jest --coverage --passWithNoTests"},"exports":{".":{"import":"./dist/d24.es.js","require":"./dist/d24.umd.js"}},"main":"./dist/d24.umd.js","module":"./dist/d24.es.js","types":"./dist/index.d.ts","author":"","license":"ISC","dependencies":{"axios":"^1.4.0","dotenv":"^16.3.1","joi":"^17.9.2"},"devDependencies":{"@types/jest":"^29.5.1","husky":"^8.0.3","rimraf":"^5.0.1","ts-jest":"^29.1.0","vite":"^4.4.4","vite-plugin-dts":"^3.3.1"},"gitHead":"3dd7f871e66769a34d1d02aaf67b5a6086b11c6c","_id":"@d24/sdk-minimal@1.0.17","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"integrity":"sha512-ThUusadkpOtmBzTnDYKfH8Vtwec4qsRdAWiomaV1xPxSLP7DCIK6T3DeYfo3cLkHzu0JEPOhfV4Z0AUZOS9/qw==","shasum":"50d75a93569ac98f252ad11a3c8d8c673fdf0d32","tarball":"https://registry.npmjs.org/@d24/sdk-minimal/-/sdk-minimal-1.0.17.tgz","fileCount":25,"unpackedSize":452448,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDTwg5hcjDS1mx31Yk0X7fjjF+YkMQdrinuKr49lvAQiAiBdazyckk6sPucSLTR8qNyWIFxInhmKHfuR3aQazpRO9A=="}]},"_npmUser":{"name":"d24infra","email":"infra+npm@d24.com"},"directories":{},"maintainers":[{"name":"d24infra","email":"infra+npm@d24.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sdk-minimal_1.0.17_1716815901725_0.9617198149778365"},"_hasShrinkwrap":false},"1.0.18":{"name":"@d24/sdk-minimal","version":"1.0.18","description":"Learn how to use our SDK in Javascript to allow integrations with our Deposits APIs","scripts":{"build":"npm run clean && tsc && vite build","clean":"rimraf ./dist/","test":"jest --watch","clear_jest":"jest --clearCache","prepare":"husky install","test:coverage":"jest --coverage --passWithNoTests"},"exports":{".":{"import":"./dist/d24.es.js","require":"./dist/d24.umd.js"}},"main":"./dist/d24.umd.js","module":"./dist/d24.es.js","types":"./dist/index.d.ts","author":"","license":"ISC","dependencies":{"axios":"^1.4.0","dotenv":"^16.3.1","joi":"^17.9.2"},"devDependencies":{"@types/jest":"^29.5.1","husky":"^8.0.3","rimraf":"^5.0.1","ts-jest":"^29.1.0","vite":"^4.4.4","vite-plugin-dts":"^3.3.1"},"gitHead":"bee177cb8de908934dfc32016fc24a469d7b9079","_id":"@d24/sdk-minimal@1.0.18","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"integrity":"sha512-eVGe4we40ij2g+gWkpZ+SXOX1RmvttMOOZWvYM7jOLDSwOqVtc9aESpp+xfaTTUR/Nc9Z2O8kOFiSS9T//Lg+Q==","shasum":"d8f8059465bc2f00acf8170b925a0f4e662c4f72","tarball":"https://registry.npmjs.org/@d24/sdk-minimal/-/sdk-minimal-1.0.18.tgz","fileCount":25,"unpackedSize":452805,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7jqbYgN20WTjkKAiDOX0P+evyEJ/zHIhzr5rIKFyz9gIhANFUIAK9O6uGWpqeH2/1nqtyOMew5fvjjLscg/r5nxt5"}]},"_npmUser":{"name":"d24infra","email":"infra+npm@d24.com"},"directories":{},"maintainers":[{"name":"d24infra","email":"infra+npm@d24.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sdk-minimal_1.0.18_1716823012502_0.3538790967594063"},"_hasShrinkwrap":false},"1.0.19":{"name":"@d24/sdk-minimal","version":"1.0.19","description":"Learn how to use our SDK in Javascript to allow integrations with our Deposits APIs","scripts":{"build":"npm run clean && tsc && vite build","clean":"rimraf ./dist/","test":"jest --watch","clear_jest":"jest --clearCache","prepare":"husky install","test:coverage":"jest --coverage --passWithNoTests"},"exports":{".":{"import":"./dist/d24.es.js","require":"./dist/d24.umd.js"}},"main":"./dist/d24.umd.js","module":"./dist/d24.es.js","types":"./dist/index.d.ts","author":"","license":"ISC","dependencies":{"axios":"^1.4.0","dotenv":"^16.3.1","joi":"^17.9.2"},"devDependencies":{"@types/jest":"^29.5.1","husky":"^8.0.3","rimraf":"^5.0.1","ts-jest":"^29.1.0","vite":"^4.4.4","vite-plugin-dts":"^3.3.1"},"gitHead":"597b6905f776192e41040cf7ece7bbc3da535d99","_id":"@d24/sdk-minimal@1.0.19","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"integrity":"sha512-7quG08y0LeTFRQidFlmINlRBvBswhEbq1fTnpkefg9ZMQeayHp5pnQIr0C6+JQDTWAutIn1+5UV1VkHaJzzc7Q==","shasum":"4c86ed666b1131f8898972f03fdd46bda90f6098","tarball":"https://registry.npmjs.org/@d24/sdk-minimal/-/sdk-minimal-1.0.19.tgz","fileCount":25,"unpackedSize":452781,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6nhcP7OPgyroXIBGruZznGc31H36W4eEG6dG6zgFeHQIhAOJ3YYGr6zlBvGMlM1vSd5KCLjjvm3HolHT28L4AY+5k"}]},"_npmUser":{"name":"d24infra","email":"infra+npm@d24.com"},"directories":{},"maintainers":[{"name":"d24infra","email":"infra+npm@d24.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sdk-minimal_1.0.19_1717455498747_0.7658792427436303"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-27T13:18:21.594Z","1.0.17":"2024-05-27T13:18:21.900Z","modified":"2024-06-03T22:58:19.129Z","1.0.18":"2024-05-27T15:16:52.678Z","1.0.19":"2024-06-03T22:58:18.955Z"},"maintainers":[{"name":"d24infra","email":"infra+npm@d24.com"}],"description":"Learn how to use our SDK in Javascript to allow integrations with our Deposits APIs","license":"ISC","readme":"# D24 Credit card SDK\nLearn how to use our SDK in Javascript to allow integrations with our Deposits APIs\n\n<!-- TOC -->\n* [Getting started](#getting-started)\n  * [Instalation](#instalation)\n    * [npm](#npm)\n    * [UMD](#umd)\n  * [How to use](#how-to-use)\n    * [Instantiation](#instantiation)\n    * [Tokenaization a credit card](#tokenaization-a-credit-card)\n* [API](#api)\n  * [constructor(publicKey, options)](#constructorpublickey-options)\n    * [Parameters](#parameters)\n    * [Possible errors](#possible-errors)\n  * [generateToken({card}): Promise\\<{token: string}>](#generatetokencard-promisetoken-string)\n    * [Parameters](#parameters-1)\n    * [Possible errors](#possible-errors-1)\n<!-- TOC -->\n\n## Getting started\n### Instalation\n#### Load D24 as a npm module\nInstall the D24.js from the npm public registry.\n```bash\nnpm install @d24/sdk-minimal\n```\nor\n#### Manually load the D24.js script\nAdd the D24.js module as a script in the <head> of your app HTML\n```html\n<script type=\"module\" src=\"https://d24sdk.s3.amazonaws.com/releases/d24-1.0.10.umd.js\"></script>\n```\n\n### How to use\n#### Instantiation\nFirst of all, we must instantiate the SDK.\n\nKeep in mind that the SDK can be instantiated only once, and it is a requirement to be able to use all its methods.\n\nIn order to instantiate the SDK we need to specify the public key and the environment.\n\n* npm\n```javascript \n\nimport SDK from '@d24/sdk-minimal';\n\nnew SDK('as1i2nxal12bvd', {environment: 'test'});\n```\n\n* umd\n```javascript\n \nnew window.D24.SDK('as1i2nxal12bvd', {environment: 'test'});\n ```\n\n##### constructor(publicKey, options)\n###### Parameters\n| Parameter           | Type   | Description                | Required | Possible values      |\n|---------------------|--------|----------------------------|----------|----------------------|\n| publicKey           | string | Public key provided by D24 | true     | -                    |\n| options             | object | Options                    | true     | -                    |\n| options.environment | string | Environment                | true     | 'test', 'production' |\n\n#### Tokenaization a credit card\nOnce we instantiate the SDK, we can tokenize a card, said token will be used later to send it to the backend and generate the payment through an endpoint.\n\n* npm\n```javascript\n\nimport {generateToken} from '@d24/sdk-minimal';\n\nconst creditCard = {\n    number: '4509953566233704',\n    holder: 'Juan Perez',\n    cvv: '123',\n    expirationMonth: '11',\n    expirationYear: '25',\n}\n\nconst response = await generateToken({card: creditCard});\nconst token = response.token;\n```\n\n* umd\n```javascript\nconst creditCard = {\n  number: '4509953566233704',\n  holder: 'Juan Perez',\n  cvv: '123',\n  expirationMonth: '11',\n  expirationYear: '25',\n}\n\nconst response = await window.D24.generateToken({card: creditCard});\nconst token = response.token;\n```\n\n## API\n\n#### Possible errors\n| Error                                                  | Explanation                                                                                                 |\n|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|\n| SDK was already instantiate.                           | The SDK has already been instantiated and you are trying to instantiate it again                            |\n| The environment [config.environment] is not supported. | The environment you passed to the constructor is not valid, remember that it only accepts \"test\" or \"prod\"  |\n\n### generateToken({card}): Promise\\<{token: string}>\nThis method validates that the card data is correct and generates a token.\nAlthough it has validations that occur at the frontend level, it uses a D24 endpoint to be able to generate the token which executes additional validations.\n\nTo validate the data structure, the [joi](https://joi.dev/api/?v=17.9.1#errors) library is used, therefore the errors returned at the frontend level are generated with said library.\n\n\n#### Parameters\n| Parameter            | Type   | Description                                                              | Required | Example          |\n|----------------------|--------|--------------------------------------------------------------------------|----------|------------------|\n| card                 | object | Credit card values                                                       | true     | -                |\n| card.number          | string | Credit card number                                                       | true     | 4509953566233704 |\n| card.holder          | string | Credit card holder                                                       | true     | Juan Perez       |\n| card.cvv             | string | Credit card security code. Must be 3 digits, except for AMEX which are 4 | true     | 123, 1234        |\n| card.expirationMonth | string | Credit card expiration month. Must be 2 digits                           | true     | 11               |\n| card.expirationYear  | string | Credit card expiration year. Must be 2 digits                            | true     | 25               |\n\n#### Possible errors\n| Error                                                           | Explanation                                                            |\n|-----------------------------------------------------------------|------------------------------------------------------------------------|\n| You must instantiate D24CreditCardSDK before using SDK methods  | You executed the method without having previously instantiated the SDK |\n","readmeFilename":"readme.md"}