From fda0e9cfa3d1d0922aef89b280af680c1757e23d Mon Sep 17 00:00:00 2001 From: Piotr Ilski Date: Tue, 26 Sep 2017 12:38:07 +0200 Subject: [PATCH 1/2] Use specific Stripe's SDK version Use 11.2 version of Stripe SDK Remove deprecated validation CC validation method and use STPCardValidator.validationStateForCard instead --- demo/.DS_Store | Bin 0 -> 6148 bytes package.json | 2 +- platforms/ios/Podfile | 2 +- src/ios/card.ts | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 demo/.DS_Store diff --git a/demo/.DS_Store b/demo/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3e391de0f729d619dabea1aac629bcd83153700f GIT binary patch literal 6148 zcmeHKyG{c^3>-s>NTf(fxxc_4tfKG*`G8O)q6rrX6zZ$^EAYi)7o2gx1*ci{^@MX*7=m@2@Q-+V z-@Oi}^YEPaU%x5vab1>=e=-D3_9~cC+cUwb&*MdzgFN2OO6(D literal 0 HcmV?d00001 diff --git a/package.json b/package.json index 603c974..e9647c3 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "scripts": { "build": "tsc", - "demo.ios": "npm run preparedemo && cd demo && tns emulate ios", + "demo.ios": "npm run preparedemo && cd demo && tns debug ios", "demo.ios.device": "npm run preparedemo && cd demo && tns run ios", "demo.android": "npm run preparedemo && cd demo && tns run android", "test.ios": "cd demo && tns test ios --emulator", diff --git a/platforms/ios/Podfile b/platforms/ios/Podfile index 88af28a..1e0ca39 100644 --- a/platforms/ios/Podfile +++ b/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Stripe' \ No newline at end of file +pod 'Stripe', '11.2.0' \ No newline at end of file diff --git a/src/ios/card.ts b/src/ios/card.ts index 0d538c3..179be6c 100644 --- a/src/ios/card.ts +++ b/src/ios/card.ts @@ -47,7 +47,7 @@ export class Card { } validateCard(): boolean { try { - return this._card.validateCardReturningError(); + return STPCardValidator.validationStateForCard(this._card) === STPCardValidationState.Valid; } catch (ex) { return false; } From 6efbda98a605ad322f54fd57898e93fff847b047 Mon Sep 17 00:00:00 2001 From: Piotr Ilski Date: Fri, 20 Oct 2017 12:14:16 +0200 Subject: [PATCH 2/2] Update dependencies - update nativescript to 3.2.0 - update angular to 4.4.1 - generate typing (with additional declarations of missing iOS11 types) --- .gitignore | 6 +- .nvmrc | 1 + demo/app/main-page.xml | 21 +- demo/package-lock.json | 437 ++++++++ demo/package.json | 6 +- objc!Stripe.d.ts | 2235 +++++++++++++++++++++++++++------------- package-lock.json | 129 +++ package.json | 34 +- src/ios/card-view.d.ts | 7 +- src/ios/card-view.ts | 61 +- 10 files changed, 2195 insertions(+), 742 deletions(-) create mode 100644 .nvmrc create mode 100644 demo/package-lock.json create mode 100644 package-lock.json diff --git a/.gitignore b/.gitignore index 56d4f07..ebfd88e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,10 @@ demo/lib demo/platforms demo/node_modules node_modules +demo/metadata-i386/ +demo/metadata-x86_64/ .vscode .idea -hooks \ No newline at end of file +hooks +.DS_Store +demo/.DS_Store diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..8384713 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +6.11.4 diff --git a/demo/app/main-page.xml b/demo/app/main-page.xml index 7f0463d..c56b66c 100644 --- a/demo/app/main-page.xml +++ b/demo/app/main-page.xml @@ -1,12 +1,11 @@ - - - - - - - - - - - + + + + + + diff --git a/demo/package-lock.json b/demo/package-lock.json new file mode 100644 index 0000000..6336d13 --- /dev/null +++ b/demo/package-lock.json @@ -0,0 +1,437 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "adm-zip": { + "version": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.7.tgz", + "integrity": "sha1-hgbCy/HEJs6MjsABdER/1Jtur8E=", + "dev": true + }, + "ansi-regex": { + "version": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "babel-code-frame": { + "version": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "esutils": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "js-tokens": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz" + } + }, + "babel-messages": { + "version": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz" + } + }, + "babel-runtime": { + "version": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "regenerator-runtime": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz" + } + }, + "babel-traverse": { + "version": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.23.1.tgz", + "integrity": "sha1-08tZAQ7NBql9gTEAZflmtpnhT0g=", + "dev": true, + "requires": { + "babel-code-frame": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "babel-messages": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "babel-runtime": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "babel-types": "https://registry.npmjs.org/babel-types/-/babel-types-6.23.0.tgz", + "babylon": "https://registry.npmjs.org/babylon/-/babylon-6.16.1.tgz", + "debug": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "globals": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "invariant": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "lodash": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz" + } + }, + "babel-types": { + "version": "https://registry.npmjs.org/babel-types/-/babel-types-6.23.0.tgz", + "integrity": "sha1-uxcXnXU4utOM0MnhFdNA935+ms8=", + "dev": true, + "requires": { + "babel-runtime": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "esutils": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "lodash": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "to-fast-properties": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz" + } + }, + "babylon": { + "version": "https://registry.npmjs.org/babylon/-/babylon-6.16.1.tgz", + "integrity": "sha1-MMWiL0gZeKnn+M399JaxHZS0BNM=", + "dev": true + }, + "balanced-match": { + "version": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, + "requires": { + "balanced-match": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "concat-map": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + } + }, + "chalk": { + "version": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "escape-string-regexp": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "has-ansi": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "strip-ansi": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "supports-color": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" + } + }, + "concat-map": { + "version": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "core-js": { + "version": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", + "dev": true + }, + "debug": { + "version": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "dev": true, + "requires": { + "ms": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" + } + }, + "escape-string-regexp": { + "version": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esutils": { + "version": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "glob": { + "version": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "dev": true, + "requires": { + "inflight": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "minimatch": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "path-is-absolute": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + } + }, + "globals": { + "version": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha1-qjiWs+abSH8X4x7SFD1pqOMMLYo=", + "dev": true + }, + "has-ansi": { + "version": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz" + } + }, + "inflight": { + "version": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "wrappy": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + } + }, + "inherits": { + "version": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "invariant": { + "version": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dev": true, + "requires": { + "loose-envify": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz" + } + }, + "js-tokens": { + "version": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "lazy": { + "version": "https://registry.npmjs.org/lazy/-/lazy-1.0.11.tgz", + "integrity": "sha1-2qBoIGKCVCwIgojpdcKXwa53tpA=", + "dev": true + }, + "lodash": { + "version": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "loose-envify": { + "version": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, + "requires": { + "js-tokens": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz" + } + }, + "minimatch": { + "version": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "dev": true, + "requires": { + "brace-expansion": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz" + } + }, + "minimist": { + "version": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz" + } + }, + "ms": { + "version": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "nativescript-dev-android-snapshot": { + "version": "https://registry.npmjs.org/nativescript-dev-android-snapshot/-/nativescript-dev-android-snapshot-0.0.11.tgz", + "integrity": "sha1-0Wlz3QEIV99VD0auh2taeA2PJNs=", + "dev": true, + "requires": { + "adm-zip": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.7.tgz", + "nativescript-hook": "https://registry.npmjs.org/nativescript-hook/-/nativescript-hook-0.2.1.tgz", + "semver": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "shelljs": "https://registry.npmjs.org/shelljs/-/shelljs-0.6.1.tgz" + } + }, + "nativescript-dev-typescript": { + "version": "https://registry.npmjs.org/nativescript-dev-typescript/-/nativescript-dev-typescript-0.3.7.tgz", + "integrity": "sha1-6cmC7sojRzSSRdRbP2uiwYFkBQo=", + "dev": true, + "requires": { + "nativescript-hook": "https://registry.npmjs.org/nativescript-hook/-/nativescript-hook-0.2.1.tgz" + } + }, + "nativescript-hook": { + "version": "https://registry.npmjs.org/nativescript-hook/-/nativescript-hook-0.2.1.tgz", + "integrity": "sha1-eGIlBW2yD6SeeGRR3M1ktS44ZNk=", + "dev": true, + "requires": { + "glob": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" + } + }, + "nativescript-stripe": { + "version": "file:..", + "dependencies": { + "@angular/common": { + "version": "4.4.6", + "bundled": true, + "requires": { + "tslib": "1.8.0" + } + }, + "@angular/compiler": { + "version": "4.4.6", + "bundled": true, + "requires": { + "tslib": "1.8.0" + } + }, + "@angular/core": { + "version": "4.4.6", + "bundled": true, + "requires": { + "tslib": "1.8.0" + } + }, + "@angular/forms": { + "version": "4.4.6", + "bundled": true, + "requires": { + "tslib": "1.8.0" + } + }, + "@angular/http": { + "version": "4.4.6", + "bundled": true, + "requires": { + "tslib": "1.8.0" + } + }, + "@angular/platform-browser": { + "version": "4.4.6", + "bundled": true, + "requires": { + "tslib": "1.8.0" + } + }, + "@angular/router": { + "version": "4.4.6", + "bundled": true, + "requires": { + "tslib": "1.8.0" + } + }, + "nativescript-angular": { + "version": "4.4.1", + "bundled": true, + "requires": { + "nativescript-intl": "3.0.0", + "reflect-metadata": "0.1.10" + } + }, + "nativescript-intl": { + "version": "3.0.0", + "bundled": true + }, + "reflect-metadata": { + "version": "0.1.10", + "bundled": true + }, + "rxjs": { + "version": "5.0.3", + "bundled": true, + "requires": { + "symbol-observable": "1.0.4" + } + }, + "symbol-observable": { + "version": "1.0.4", + "bundled": true + }, + "tns-core-modules": { + "version": "3.2.0", + "bundled": true, + "requires": { + "tns-core-modules-widgets": "3.2.0" + } + }, + "tns-core-modules-widgets": { + "version": "3.2.0", + "bundled": true + }, + "tns-platform-declarations": { + "version": "3.2.0", + "bundled": true + }, + "tslib": { + "version": "1.8.0", + "bundled": true + }, + "typescript": { + "version": "2.5.3", + "bundled": true + }, + "zone.js": { + "version": "0.8.18", + "bundled": true + } + } + }, + "nativescript-theme-core": { + "version": "https://registry.npmjs.org/nativescript-theme-core/-/nativescript-theme-core-1.0.4.tgz", + "integrity": "sha1-zyiAx/vy/l9D4iNdMJdQeQgD7+E=" + }, + "once": { + "version": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + } + }, + "path-is-absolute": { + "version": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "regenerator-runtime": { + "version": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha1-flT+W1zNXWYk6mJVw0c74JC4AuE=", + "dev": true + }, + "semver": { + "version": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha1-4FnAnYVx8FQII3M0M1BdOi8AsY4=", + "dev": true + }, + "shelljs": { + "version": "https://registry.npmjs.org/shelljs/-/shelljs-0.6.1.tgz", + "integrity": "sha1-7GIRvtGSBEIIj+D3Cyg3Iy7SyKg=", + "dev": true + }, + "strip-ansi": { + "version": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz" + } + }, + "supports-color": { + "version": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "tns-core-modules": { + "version": "https://registry.npmjs.org/tns-core-modules/-/tns-core-modules-3.2.0.tgz", + "integrity": "sha1-v0cYlbc8teVUnETyU0Hff100+cI=", + "requires": { + "tns-core-modules-widgets": "https://registry.npmjs.org/tns-core-modules-widgets/-/tns-core-modules-widgets-3.2.0.tgz" + } + }, + "tns-core-modules-widgets": { + "version": "https://registry.npmjs.org/tns-core-modules-widgets/-/tns-core-modules-widgets-3.2.0.tgz", + "integrity": "sha1-bTIK6dHhyudsdEPEpfrqvtsAR3M=" + }, + "to-fast-properties": { + "version": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "typescript": { + "version": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz", + "integrity": "sha1-3z3Nw48764ANS8MiZGsEo/bKfw0=", + "dev": true + }, + "wrappy": { + "version": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + } + } +} diff --git a/demo/package.json b/demo/package.json index a08c41b..d34abf1 100644 --- a/demo/package.json +++ b/demo/package.json @@ -6,16 +6,16 @@ "nativescript": { "id": "org.nativescript.demo", "tns-android": { - "version": "3.0.0" + "version": "3.2.0" }, "tns-ios": { - "version": "3.0.0" + "version": "3.2.0" } }, "dependencies": { "nativescript-stripe": "file:..", "nativescript-theme-core": "~1.0.2", - "tns-core-modules": "3.0.0" + "tns-core-modules": "3.2.0" }, "devDependencies": { "babel-traverse": "6.23.1", diff --git a/objc!Stripe.d.ts b/objc!Stripe.d.ts index 7c70a92..a3c9f44 100644 --- a/objc!Stripe.d.ts +++ b/objc!Stripe.d.ts @@ -1,1311 +1,2166 @@ -declare class PTKCard extends STPCard { +declare type UITextSmartDashesType = any; // inherited from UITextInputTraits +declare type UITextSmartInsertDeleteType = any; // inherited from UITextInputTraits +declare type UITextSmartQuotesType = any; - static alloc(): PTKCard; // inherited from NSObject +declare class STPAPIClient extends NSObject { - static decodedObjectFromAPIResponse(response: NSDictionary): PTKCard; // inherited from STPAPIResponseDecodable + static alloc(): STPAPIClient; // inherited from NSObject - static new(): PTKCard; // inherited from NSObject -} + static new(): STPAPIClient; // inherited from NSObject -declare class PTKView extends STPPaymentCardTextField { + static sharedClient(): STPAPIClient; - static alloc(): PTKView; // inherited from NSObject + configuration: STPPaymentConfiguration; - static appearance(): PTKView; // inherited from UIAppearance + publishableKey: string; - static appearanceForTraitCollection(trait: UITraitCollection): PTKView; // inherited from UIAppearance + stripeAccount: string; - static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): PTKView; // inherited from UIAppearance + constructor(o: { configuration: STPPaymentConfiguration; }); - static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray): PTKView; // inherited from UIAppearance + constructor(o: { publishableKey: string; }); - static appearanceWhenContainedIn(ContainerClass: typeof NSObject): PTKView; // inherited from UIAppearance + createSourceWithParamsCompletion(params: STPSourceParams, completion: (p1: STPSource, p2: NSError) => void): void; - static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray): PTKView; // inherited from UIAppearance + createSourceWithPaymentCompletion(payment: PKPayment, completion: (p1: STPSource, p2: NSError) => void): void; - static new(): PTKView; // inherited from NSObject + createTokenWithBankAccountCompletion(bankAccount: STPBankAccountParams, completion: (p1: STPToken, p2: NSError) => void): void; - card: PTKCard; + createTokenWithCardCompletion(card: STPCardParams, completion: (p1: STPToken, p2: NSError) => void): void; - delegate: PTKViewDelegate; -} + createTokenWithPaymentCompletion(payment: PKPayment, completion: (p1: STPToken, p2: NSError) => void): void; -interface PTKViewDelegate extends STPPaymentCardTextFieldDelegate { + createTokenWithPersonalIDNumberCompletion(pii: string, completion: (p1: STPToken, p2: NSError) => void): void; - paymentViewWithCardIsValid?(paymentView: PTKView, card: PTKCard, valid: boolean): void; -} -declare var PTKViewDelegate: { + initWithConfiguration(configuration: STPPaymentConfiguration): this; - prototype: PTKViewDelegate; -}; + initWithPublishableKey(publishableKey: string): this; -declare class STPAPIClient extends NSObject { + retrieveSourceWithIdClientSecretCompletion(identifier: string, secret: string, completion: (p1: STPSource, p2: NSError) => void): void; + + startPollingSourceWithIdClientSecretTimeoutCompletion(identifier: string, secret: string, timeout: number, completion: (p1: STPSource, p2: NSError) => void): void; + + stopPollingSourceWithId(identifier: string): void; + + uploadImagePurposeCompletion(image: UIImage, purpose: STPFilePurpose, completion: (p1: STPFile, p2: NSError) => void): void; + } + + interface STPAPIResponseDecodable extends NSObjectProtocol { + + allResponseFields: NSDictionary; + } + declare var STPAPIResponseDecodable: { + + prototype: STPAPIResponseDecodable; + + decodedObjectFromAPIResponse(response: NSDictionary): STPAPIResponseDecodable; + + requiredFields(): NSArray; + }; + + declare class STPAddCardViewController extends STPCoreTableViewController { + + static alloc(): STPAddCardViewController; // inherited from NSObject + + static new(): STPAddCardViewController; // inherited from NSObject + + delegate: STPAddCardViewControllerDelegate; + + managedAccountCurrency: string; + + prefilledInformation: STPUserInformation; + + constructor(o: { configuration: STPPaymentConfiguration; theme: STPTheme; }); + + initWithConfigurationTheme(configuration: STPPaymentConfiguration, theme: STPTheme): this; + } + + interface STPAddCardViewControllerDelegate extends NSObjectProtocol { + + addCardViewControllerDidCancel(addCardViewController: STPAddCardViewController): void; + + addCardViewControllerDidCreateTokenCompletion(addCardViewController: STPAddCardViewController, token: STPToken, completion: (p1: NSError) => void): void; + } + declare var STPAddCardViewControllerDelegate: { + + prototype: STPAddCardViewControllerDelegate; + }; + + declare class STPAddress extends NSObject implements STPAPIResponseDecodable { + + static alloc(): STPAddress; // inherited from NSObject + + static applePayAddressFieldsFromBillingAddressFields(billingAddressFields: STPBillingAddressFields): PKAddressField; + + static decodedObjectFromAPIResponse(response: NSDictionary): STPAddress; + + static new(): STPAddress; // inherited from NSObject + + static requiredFields(): NSArray; + + static shippingInfoForChargeWithAddressShippingMethod(address: STPAddress, method: PKShippingMethod): NSDictionary; + + city: string; + + country: string; + + email: string; + + line1: string; + + line2: string; + + name: string; + + phone: string; + + postalCode: string; + + state: string; + + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable + + readonly debugDescription: string; // inherited from NSObjectProtocol + + readonly description: string; // inherited from NSObjectProtocol + + readonly hash: number; // inherited from NSObjectProtocol + + readonly isProxy: boolean; // inherited from NSObjectProtocol + + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + + readonly // inherited from NSObjectProtocol + + constructor(o: { ABRecord: any; }); + + constructor(o: { CNContact: CNContact; }); + + constructor(o: { PKContact: PKContact; }); + + ABRecordValue(): any; + + PKContactValue(): PKContact; + + class(): typeof NSObject; + + conformsToProtocol(aProtocol: any /* Protocol */): boolean; + + containsRequiredFields(requiredFields: STPBillingAddressFields): boolean; + + containsRequiredShippingAddressFields(requiredFields: PKAddressField): boolean; + + initWithABRecord(record: any): this; + + initWithCNContact(contact: CNContact): this; + + initWithPKContact(contact: PKContact): this; + + isEqual(object: any): boolean; + + isKindOfClass(aClass: typeof NSObject): boolean; + + isMemberOfClass(aClass: typeof NSObject): boolean; + + performSelector(aSelector: string): any; + + performSelectorWithObject(aSelector: string, object: any): any; + + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + + respondsToSelector(aSelector: string): boolean; + + retainCount(): number; + + self(): this; + } + + declare class STPApplePayPaymentMethod extends NSObject implements STPPaymentMethod { + + static alloc(): STPApplePayPaymentMethod; // inherited from NSObject + + static new(): STPApplePayPaymentMethod; // inherited from NSObject + + readonly debugDescription: string; // inherited from NSObjectProtocol + + readonly description: string; // inherited from NSObjectProtocol + + readonly hash: number; // inherited from NSObjectProtocol + + readonly image: UIImage; // inherited from STPPaymentMethod + + readonly isProxy: boolean; // inherited from NSObjectProtocol + + readonly label: string; // inherited from STPPaymentMethod + + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + + readonly templateImage: UIImage; // inherited from STPPaymentMethod + + readonly // inherited from NSObjectProtocol + + class(): typeof NSObject; + + conformsToProtocol(aProtocol: any /* Protocol */): boolean; + + isEqual(object: any): boolean; + + isKindOfClass(aClass: typeof NSObject): boolean; + + isMemberOfClass(aClass: typeof NSObject): boolean; + + performSelector(aSelector: string): any; + + performSelectorWithObject(aSelector: string, object: any): any; + + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + + respondsToSelector(aSelector: string): boolean; + + retainCount(): number; + + self(): this; + } + + interface STPBackendAPIAdapter extends NSObjectProtocol { + + attachSourceToCustomerCompletion(source: STPSourceProtocol, completion: (p1: NSError) => void): void; + + retrieveCustomer(completion: (p1: STPCustomer, p2: NSError) => void): void; + + selectDefaultCustomerSourceCompletion(source: STPSourceProtocol, completion: (p1: NSError) => void): void; + } + declare var STPBackendAPIAdapter: { + + prototype: STPBackendAPIAdapter; + }; + + declare class STPBankAccount extends STPBankAccountParams implements STPAPIResponseDecodable { + + static alloc(): STPBankAccount; // inherited from NSObject + + static decodedObjectFromAPIResponse(response: NSDictionary): STPBankAccount; + + static new(): STPBankAccount; // inherited from NSObject + + static requiredFields(): NSArray; + + readonly bankAccountId: string; + + readonly bankName: string; + + readonly fingerprint: string; + + readonly last4: string; + + readonly status: STPBankAccountStatus; + + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable + + readonly debugDescription: string; // inherited from NSObjectProtocol + + readonly description: string; // inherited from NSObjectProtocol + + readonly hash: number; // inherited from NSObjectProtocol + + readonly isProxy: boolean; // inherited from NSObjectProtocol + + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + + readonly // inherited from NSObjectProtocol + + class(): typeof NSObject; + + conformsToProtocol(aProtocol: any /* Protocol */): boolean; + + isEqual(object: any): boolean; + + isKindOfClass(aClass: typeof NSObject): boolean; + + isMemberOfClass(aClass: typeof NSObject): boolean; + + performSelector(aSelector: string): any; + + performSelectorWithObject(aSelector: string, object: any): any; + + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + + respondsToSelector(aSelector: string): boolean; + + retainCount(): number; + + self(): this; + } + + declare const enum STPBankAccountHolderType { + + Individual = 0, + + Company = 1 + } + + declare class STPBankAccountParams extends NSObject implements STPFormEncodable { + + static alloc(): STPBankAccountParams; // inherited from NSObject + + static new(): STPBankAccountParams; // inherited from NSObject + + static propertyNamesToFormFieldNamesMapping(): NSDictionary; + + static rootObjectName(): string; + + accountHolderName: string; + + accountHolderType: STPBankAccountHolderType; + + accountNumber: string; + + country: string; + + currency: string; + + readonly last4: string; + + routingNumber: string; + + additionalAPIParameters: NSDictionary; // inherited from STPFormEncodable + + readonly debugDescription: string; // inherited from NSObjectProtocol + + readonly description: string; // inherited from NSObjectProtocol + + readonly hash: number; // inherited from NSObjectProtocol + + readonly isProxy: boolean; // inherited from NSObjectProtocol + + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + + readonly // inherited from NSObjectProtocol + + class(): typeof NSObject; + + conformsToProtocol(aProtocol: any /* Protocol */): boolean; + + isEqual(object: any): boolean; + + isKindOfClass(aClass: typeof NSObject): boolean; + + isMemberOfClass(aClass: typeof NSObject): boolean; + + performSelector(aSelector: string): any; + + performSelectorWithObject(aSelector: string, object: any): any; + + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + + respondsToSelector(aSelector: string): boolean; + + retainCount(): number; + + self(): this; + } + + declare const enum STPBankAccountStatus { + + New = 0, + + Validated = 1, + + Verified = 2, + + Errored = 3 + } + + declare const enum STPBillingAddressFields { + + None = 0, + + Zip = 1, + + Full = 2 + } + + declare class STPCard extends STPCardParams implements STPAPIResponseDecodable, STPPaymentMethod, STPSourceProtocol { + + static alloc(): STPCard; // inherited from NSObject + + static brandFromString(string: string): STPCardBrand; + + static decodedObjectFromAPIResponse(response: NSDictionary): STPCard; + + static fundingFromString(string: string): STPCardFundingType; + + static new(): STPCard; // inherited from NSObject + + static requiredFields(): NSArray; + + static stringFromBrand(brand: STPCardBrand): string; + + readonly brand: STPCardBrand; + + readonly cardId: string; + + readonly country: string; + + readonly dynamicLast4: string; + + readonly funding: STPCardFundingType; + + readonly isApplePayCard: boolean; + + readonly last4: string; + + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable + + readonly debugDescription: string; // inherited from NSObjectProtocol + + readonly description: string; // inherited from NSObjectProtocol + + readonly hash: number; // inherited from NSObjectProtocol + + readonly image: UIImage; // inherited from STPPaymentMethod + + readonly isProxy: boolean; // inherited from NSObjectProtocol + + readonly label: string; // inherited from STPPaymentMethod + + readonly stripeID: string; // inherited from STPSourceProtocol + + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + + readonly templateImage: UIImage; // inherited from STPPaymentMethod + + readonly // inherited from NSObjectProtocol + + constructor(o: { ID: string; brand: STPCardBrand; last4: string; expMonth: number; expYear: number; funding: STPCardFundingType; }); + + class(): typeof NSObject; + + conformsToProtocol(aProtocol: any /* Protocol */): boolean; + + initWithIDBrandLast4ExpMonthExpYearFunding(cardID: string, brand: STPCardBrand, last4: string, expMonth: number, expYear: number, funding: STPCardFundingType): this; + + isEqual(object: any): boolean; + + isKindOfClass(aClass: typeof NSObject): boolean; + + isMemberOfClass(aClass: typeof NSObject): boolean; + + performSelector(aSelector: string): any; + + performSelectorWithObject(aSelector: string, object: any): any; + + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + + respondsToSelector(aSelector: string): boolean; + + retainCount(): number; + + self(): this; + } + + declare const enum STPCardBrand { + + Visa = 0, + + Amex = 1, + + MasterCard = 2, + + Discover = 3, + + JCB = 4, + + DinersClub = 5, + + Unknown = 6 + } + + declare var STPCardDeclined: string; + + declare var STPCardErrorCodeKey: string; + + declare const enum STPCardFundingType { + + Debit = 0, + + Credit = 1, + + Prepaid = 2, + + Other = 3 + } + + declare class STPCardParams extends NSObject implements STPFormEncodable { + + static alloc(): STPCardParams; // inherited from NSObject + + static new(): STPCardParams; // inherited from NSObject + + static propertyNamesToFormFieldNamesMapping(): NSDictionary; + + static rootObjectName(): string; + + address: STPAddress; + + addressCity: string; + + addressCountry: string; + + addressLine1: string; + + addressLine2: string; + + addressState: string; + + addressZip: string; + + currency: string; + + cvc: string; + + expMonth: number; + + expYear: number; + + readonly last4: string; + + name: string; + + number: string; + + additionalAPIParameters: NSDictionary; // inherited from STPFormEncodable + + readonly debugDescription: string; // inherited from NSObjectProtocol + + readonly description: string; // inherited from NSObjectProtocol + + readonly hash: number; // inherited from NSObjectProtocol + + readonly isProxy: boolean; // inherited from NSObjectProtocol + + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + + readonly // inherited from NSObjectProtocol + + class(): typeof NSObject; + + conformsToProtocol(aProtocol: any /* Protocol */): boolean; + + isEqual(object: any): boolean; + + isKindOfClass(aClass: typeof NSObject): boolean; + + isMemberOfClass(aClass: typeof NSObject): boolean; + + performSelector(aSelector: string): any; + + performSelectorWithObject(aSelector: string, object: any): any; + + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + + respondsToSelector(aSelector: string): boolean; + + retainCount(): number; + + self(): this; + } + + declare const enum STPCardValidationState { + + Valid = 0, + + Invalid = 1, + + Incomplete = 2 + } + + declare class STPCardValidator extends NSObject { + + static alloc(): STPCardValidator; // inherited from NSObject + + static brandForNumber(cardNumber: string): STPCardBrand; + + static fragmentLengthForCardBrand(brand: STPCardBrand): number; + + static lengthsForCardBrand(brand: STPCardBrand): NSSet; + + static maxCVCLengthForCardBrand(brand: STPCardBrand): number; + + static maxLengthForCardBrand(brand: STPCardBrand): number; + + static new(): STPCardValidator; // inherited from NSObject + + static sanitizedNumericStringForString(string: string): string; + + static stringIsNumeric(string: string): boolean; + + static validationStateForCVCCardBrand(cvc: string, brand: STPCardBrand): STPCardValidationState; + + static validationStateForCard(card: STPCardParams): STPCardValidationState; + + static validationStateForCardInCurrentYearCurrentMonth(card: STPCardParams, currentYear: number, currentMonth: number): STPCardValidationState; + + static validationStateForExpirationMonth(expirationMonth: string): STPCardValidationState; + + static validationStateForExpirationYearInMonth(expirationYear: string, expirationMonth: string): STPCardValidationState; + + static validationStateForExpirationYearInMonthInCurrentYearCurrentMonth(expirationYear: string, expirationMonth: string, currentYear: number, currentMonth: number): STPCardValidationState; + + static validationStateForNumberValidatingCardBrand(cardNumber: string, validatingCardBrand: boolean): STPCardValidationState; + } + + declare class STPCoreScrollViewController extends STPCoreViewController { + + static alloc(): STPCoreScrollViewController; // inherited from NSObject + + static new(): STPCoreScrollViewController; // inherited from NSObject + } + + declare class STPCoreTableViewController extends STPCoreScrollViewController { + + static alloc(): STPCoreTableViewController; // inherited from NSObject + + static new(): STPCoreTableViewController; // inherited from NSObject + } + + declare class STPCoreViewController extends UIViewController { + + static alloc(): STPCoreViewController; // inherited from NSObject + + static new(): STPCoreViewController; // inherited from NSObject + + constructor(o: { theme: STPTheme; }); + + initWithTheme(theme: STPTheme): this; + } + + declare class STPCustomer extends NSObject implements STPAPIResponseDecodable { + + static alloc(): STPCustomer; // inherited from NSObject + + static customerWithStripeIDDefaultSourceSources(stripeID: string, defaultSource: STPSourceProtocol, sources: NSArray): STPCustomer; + + static decodedObjectFromAPIResponse(response: NSDictionary): STPCustomer; + + static new(): STPCustomer; // inherited from NSObject + + static requiredFields(): NSArray; + + readonly defaultSource: STPSourceProtocol; + + readonly shippingAddress: STPAddress; + + readonly sources: NSArray; + + readonly stripeID: string; + + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable + + readonly debugDescription: string; // inherited from NSObjectProtocol + + readonly description: string; // inherited from NSObjectProtocol + + readonly hash: number; // inherited from NSObjectProtocol + + readonly isProxy: boolean; // inherited from NSObjectProtocol + + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + + readonly // inherited from NSObjectProtocol + + class(): typeof NSObject; + + conformsToProtocol(aProtocol: any /* Protocol */): boolean; + + isEqual(object: any): boolean; + + isKindOfClass(aClass: typeof NSObject): boolean; + + isMemberOfClass(aClass: typeof NSObject): boolean; + + performSelector(aSelector: string): any; + + performSelectorWithObject(aSelector: string, object: any): any; + + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + + respondsToSelector(aSelector: string): boolean; + + retainCount(): number; + + self(): this; + } + + declare class STPCustomerContext extends NSObject implements STPBackendAPIAdapter { + + static alloc(): STPCustomerContext; // inherited from NSObject + + static new(): STPCustomerContext; // inherited from NSObject + + readonly debugDescription: string; // inherited from NSObjectProtocol + + readonly description: string; // inherited from NSObjectProtocol + + readonly hash: number; // inherited from NSObjectProtocol + + readonly isProxy: boolean; // inherited from NSObjectProtocol + + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + + readonly // inherited from NSObjectProtocol + + constructor(o: { keyProvider: STPEphemeralKeyProvider; }); + + attachSourceToCustomerCompletion(source: STPSourceProtocol, completion: (p1: NSError) => void): void; + + class(): typeof NSObject; + + clearCachedCustomer(): void; + + conformsToProtocol(aProtocol: any /* Protocol */): boolean; + + initWithKeyProvider(keyProvider: STPEphemeralKeyProvider): this; + + isEqual(object: any): boolean; + + isKindOfClass(aClass: typeof NSObject): boolean; + + isMemberOfClass(aClass: typeof NSObject): boolean; + + performSelector(aSelector: string): any; + + performSelectorWithObject(aSelector: string, object: any): any; + + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + + respondsToSelector(aSelector: string): boolean; + + retainCount(): number; + + retrieveCustomer(completion: (p1: STPCustomer, p2: NSError) => void): void; + + selectDefaultCustomerSourceCompletion(source: STPSourceProtocol, completion: (p1: NSError) => void): void; + + self(): this; + } + + declare class STPCustomerDeserializer extends NSObject { + + static alloc(): STPCustomerDeserializer; // inherited from NSObject + + static new(): STPCustomerDeserializer; // inherited from NSObject + + readonly customer: STPCustomer; + + readonly error: NSError; + + constructor(o: { data: NSData; urlResponse: NSURLResponse; error: NSError; }); + + constructor(o: { JSONResponse: any; }); + + initWithDataUrlResponseError(data: NSData, urlResponse: NSURLResponse, error: NSError): this; + + initWithJSONResponse(json: any): this; + } + + interface STPEphemeralKeyProvider extends NSObjectProtocol { + + createCustomerKeyWithAPIVersionCompletion(apiVersion: string, completion: (p1: NSDictionary, p2: NSError) => void): void; + } + declare var STPEphemeralKeyProvider: { + + prototype: STPEphemeralKeyProvider; + }; + + declare const enum STPErrorCode { + + ConnectionError = 40, + + InvalidRequestError = 50, + + APIError = 60, + + CardError = 70, + + CancellationError = 80, + + EphemeralKeyDecodingError = 1000 + } + + declare var STPErrorMessageKey: string; + + declare var STPErrorParameterKey: string; + + declare var STPExpiredCard: string; + + declare class STPFile extends NSObject implements STPAPIResponseDecodable { + + static alloc(): STPFile; // inherited from NSObject + + static decodedObjectFromAPIResponse(response: NSDictionary): STPFile; + + static new(): STPFile; // inherited from NSObject + + static requiredFields(): NSArray; + + static stringFromPurpose(purpose: STPFilePurpose): string; + + readonly created: Date; + + readonly fileId: string; + + readonly purpose: STPFilePurpose; + + readonly size: number; + + readonly type: string; + + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable + + readonly debugDescription: string; // inherited from NSObjectProtocol + + readonly description: string; // inherited from NSObjectProtocol + + readonly hash: number; // inherited from NSObjectProtocol + + readonly isProxy: boolean; // inherited from NSObjectProtocol + + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + + readonly // inherited from NSObjectProtocol + + class(): typeof NSObject; + + conformsToProtocol(aProtocol: any /* Protocol */): boolean; + + isEqual(object: any): boolean; + + isKindOfClass(aClass: typeof NSObject): boolean; + + isMemberOfClass(aClass: typeof NSObject): boolean; + + performSelector(aSelector: string): any; + + performSelectorWithObject(aSelector: string, object: any): any; + + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + + respondsToSelector(aSelector: string): boolean; + + retainCount(): number; + + self(): this; + } + + declare const enum STPFilePurpose { + + IdentityDocument = 0, + + DisputeEvidence = 1, + + Unknown = 2 + } + + interface STPFormEncodable extends NSObjectProtocol { + + additionalAPIParameters: NSDictionary; + } + declare var STPFormEncodable: { + + prototype: STPFormEncodable; + + propertyNamesToFormFieldNamesMapping(): NSDictionary; + + rootObjectName(): string; + }; + + declare class STPImageLibrary extends NSObject { + + static alloc(): STPImageLibrary; // inherited from NSObject + + static amexCardImage(): UIImage; + + static applePayCardImage(): UIImage; + + static brandImageForCardBrand(brand: STPCardBrand): UIImage; + + static cvcImageForCardBrand(brand: STPCardBrand): UIImage; + + static dinersClubCardImage(): UIImage; + + static discoverCardImage(): UIImage; + + static errorImageForCardBrand(brand: STPCardBrand): UIImage; + + static jcbCardImage(): UIImage; + + static masterCardCardImage(): UIImage; + + static new(): STPImageLibrary; // inherited from NSObject + + static templatedBrandImageForCardBrand(brand: STPCardBrand): UIImage; + + static unknownCardCardImage(): UIImage; + + static visaCardImage(): UIImage; + } + + declare var STPIncorrectCVC: string; + + declare var STPIncorrectNumber: string; - static alloc(): STPAPIClient; // inherited from NSObject + declare var STPInvalidCVC: string; - static new(): STPAPIClient; // inherited from NSObject + declare var STPInvalidExpMonth: string; - static sharedClient(): STPAPIClient; + declare var STPInvalidExpYear: string; - configuration: STPPaymentConfiguration; + declare var STPInvalidNumber: string; - publishableKey: string; + declare class STPPaymentActivityIndicatorView extends UIView { - constructor(o: { configuration: STPPaymentConfiguration; }); + static alloc(): STPPaymentActivityIndicatorView; // inherited from NSObject - constructor(o: { publishableKey: string; }); + static appearance(): STPPaymentActivityIndicatorView; // inherited from UIAppearance - createTokenWithBankAccountCompletion(bankAccount: STPBankAccountParams, completion: (p1: STPToken, p2: NSError) => void): void; + static appearanceForTraitCollection(trait: UITraitCollection): STPPaymentActivityIndicatorView; // inherited from UIAppearance - createTokenWithCardCompletion(card: STPCardParams, completion: (p1: STPToken, p2: NSError) => void): void; + static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): STPPaymentActivityIndicatorView; // inherited from UIAppearance - createTokenWithPaymentCompletion(payment: PKPayment, completion: (p1: STPToken, p2: NSError) => void): void; + static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray): STPPaymentActivityIndicatorView; // inherited from UIAppearance - initWithConfiguration(configuration: STPPaymentConfiguration): this; + static appearanceWhenContainedIn(ContainerClass: typeof NSObject): STPPaymentActivityIndicatorView; // inherited from UIAppearance - initWithPublishableKey(publishableKey: string): this; -} + static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray): STPPaymentActivityIndicatorView; // inherited from UIAppearance -interface STPAPIResponseDecodable extends NSObjectProtocol { + static new(): STPPaymentActivityIndicatorView; // inherited from NSObject - allResponseFields: NSDictionary; -} -declare var STPAPIResponseDecodable: { + animating: boolean; - prototype: STPAPIResponseDecodable; + hidesWhenStopped: boolean; - decodedObjectFromAPIResponse(response: NSDictionary): STPAPIResponseDecodable; + setAnimatingAnimated(animating: boolean, animated: boolean): void; + } - requiredFields(): NSArray; -}; + declare class STPPaymentCardTextField extends UIControl implements UIKeyInput { -declare class STPAddCardViewController extends UIViewController { + static alloc(): STPPaymentCardTextField; // inherited from NSObject - static alloc(): STPAddCardViewController; // inherited from NSObject + static appearance(): STPPaymentCardTextField; // inherited from UIAppearance - static new(): STPAddCardViewController; // inherited from NSObject + static appearanceForTraitCollection(trait: UITraitCollection): STPPaymentCardTextField; // inherited from UIAppearance - delegate: STPAddCardViewControllerDelegate; + static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): STPPaymentCardTextField; // inherited from UIAppearance - managedAccountCurrency: string; + static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray): STPPaymentCardTextField; // inherited from UIAppearance - prefilledInformation: STPUserInformation; + static appearanceWhenContainedIn(ContainerClass: typeof NSObject): STPPaymentCardTextField; // inherited from UIAppearance - constructor(o: { configuration: STPPaymentConfiguration; theme: STPTheme; }); + static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray): STPPaymentCardTextField; // inherited from UIAppearance - initWithConfigurationTheme(configuration: STPPaymentConfiguration, theme: STPTheme): this; -} + static brandImageForCardBrand(cardBrand: STPCardBrand): UIImage; -interface STPAddCardViewControllerDelegate extends NSObjectProtocol { + static cvcImageForCardBrand(cardBrand: STPCardBrand): UIImage; - addCardViewControllerDidCancel(addCardViewController: STPAddCardViewController): void; + static errorImageForCardBrand(cardBrand: STPCardBrand): UIImage; - addCardViewControllerDidCreateTokenCompletion(addCardViewController: STPAddCardViewController, token: STPToken, completion: (p1: NSError) => void): void; -} -declare var STPAddCardViewControllerDelegate: { + static new(): STPPaymentCardTextField; // inherited from NSObject - prototype: STPAddCardViewControllerDelegate; -}; + borderColor: UIColor; -declare class STPAddress extends NSObject { + borderWidth: number; - static alloc(): STPAddress; // inherited from NSObject + readonly brandImage: UIImage; - static applePayAddressFieldsFromBillingAddressFields(billingAddressFields: STPBillingAddressFields): PKAddressField; + readonly cardNumber: string; - static new(): STPAddress; // inherited from NSObject + cardParams: STPCardParams; - city: string; + cornerRadius: number; - country: string; + countryCode: string; - email: string; + cursorColor: UIColor; - line1: string; + readonly cvc: string; - line2: string; + cvcPlaceholder: string; - name: string; + delegate: STPPaymentCardTextFieldDelegate; - phone: string; + readonly expirationMonth: number; - postalCode: string; + expirationPlaceholder: string; - state: string; + readonly expirationYear: number; - constructor(o: { ABRecord: any; }); + font: UIFont; - ABRecordValue(): any; + readonly formattedExpirationMonth: string; - PKContactValue(): PKContact; + readonly formattedExpirationYear: string; - containsRequiredFields(requiredFields: STPBillingAddressFields): boolean; + inputAccessoryView: UIView; - containsRequiredShippingAddressFields(requiredFields: PKAddressField): boolean; + inputView: UIView; - initWithABRecord(record: any): this; -} + readonly isValid: boolean; -declare class STPApplePayPaymentMethod extends NSObject implements STPPaymentMethod { + numberPlaceholder: string; - static alloc(): STPApplePayPaymentMethod; // inherited from NSObject + placeholderColor: UIColor; - static new(): STPApplePayPaymentMethod; // inherited from NSObject + readonly postalCode: string; - readonly debugDescription: string; // inherited from NSObjectProtocol + postalCodeEntryEnabled: boolean; - readonly description: string; // inherited from NSObjectProtocol + postalCodePlaceholder: string; - readonly hash: number; // inherited from NSObjectProtocol + textColor: UIColor; - readonly image: UIImage; // inherited from STPPaymentMethod + textErrorColor: UIColor; - readonly isProxy: boolean; // inherited from NSObjectProtocol + autocapitalizationType: UITextAutocapitalizationType; // inherited from UITextInputTraits - readonly label: string; // inherited from STPPaymentMethod + autocorrectionType: UITextAutocorrectionType; // inherited from UITextInputTraits - readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + readonly debugDescription: string; // inherited from NSObjectProtocol - readonly templateImage: UIImage; // inherited from STPPaymentMethod + readonly description: string; // inherited from NSObjectProtocol - readonly // inherited from NSObjectProtocol + enablesReturnKeyAutomatically: boolean; // inherited from UITextInputTraits - class(): typeof NSObject; + readonly hasText: boolean; // inherited from UIKeyInput - conformsToProtocol(aProtocol: any /* Protocol */): boolean; + readonly hash: number; // inherited from NSObjectProtocol - isEqual(object: any): boolean; + readonly isProxy: boolean; // inherited from NSObjectProtocol - isKindOfClass(aClass: typeof NSObject): boolean; + keyboardAppearance: UIKeyboardAppearance; // inherited from UITextInputTraits - isMemberOfClass(aClass: typeof NSObject): boolean; + keyboardType: UIKeyboardType; // inherited from UITextInputTraits - performSelector(aSelector: string): any; + returnKeyType: UIReturnKeyType; // inherited from UITextInputTraits - performSelectorWithObject(aSelector: string, object: any): any; + secureTextEntry: boolean; // inherited from UITextInputTraits - performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + smartDashesType: UITextSmartDashesType; // inherited from UITextInputTraits - respondsToSelector(aSelector: string): boolean; + smartInsertDeleteType: UITextSmartInsertDeleteType; // inherited from UITextInputTraits - retainCount(): number; + smartQuotesType: UITextSmartQuotesType; // inherited from UITextInputTraits - self(): this; -} + spellCheckingType: UITextSpellCheckingType; // inherited from UITextInputTraits -interface STPBackendAPIAdapter extends NSObjectProtocol { + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol - attachSourceToCustomerCompletion(source: STPSource, completion: (p1: NSError) => void): void; + textContentType: string; // inherited from UITextInputTraits - retrieveCustomer(completion: (p1: STPCustomer, p2: NSError) => void): void; + readonly // inherited from NSObjectProtocol - selectDefaultCustomerSourceCompletion(source: STPSource, completion: (p1: NSError) => void): void; -} -declare var STPBackendAPIAdapter: { + brandImageRectForBounds(bounds: CGRect): CGRect; - prototype: STPBackendAPIAdapter; -}; + class(): typeof NSObject; -declare class STPBankAccount extends STPBankAccountParams implements STPAPIResponseDecodable { + clear(): void; - static alloc(): STPBankAccount; // inherited from NSObject + conformsToProtocol(aProtocol: any /* Protocol */): boolean; - static decodedObjectFromAPIResponse(response: NSDictionary): STPBankAccount; + deleteBackward(): void; - static new(): STPBankAccount; // inherited from NSObject + fieldsRectForBounds(bounds: CGRect): CGRect; - static requiredFields(): NSArray; + insertText(text: string): void; - readonly bankAccountId: string; + isEqual(object: any): boolean; - readonly bankName: string; + isKindOfClass(aClass: typeof NSObject): boolean; - readonly disabled: boolean; + isMemberOfClass(aClass: typeof NSObject): boolean; - readonly fingerprint: string; + performSelector(aSelector: string): any; - readonly last4: string; + performSelectorWithObject(aSelector: string, object: any): any; - readonly status: STPBankAccountStatus; + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; - readonly validated: boolean; + respondsToSelector(aSelector: string): boolean; - readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable + retainCount(): number; - readonly debugDescription: string; // inherited from NSObjectProtocol + self(): this; + } - readonly description: string; // inherited from NSObjectProtocol + interface STPPaymentCardTextFieldDelegate extends NSObjectProtocol { - readonly hash: number; // inherited from NSObjectProtocol + paymentCardTextFieldDidBeginEditing?(textField: STPPaymentCardTextField): void; - readonly isProxy: boolean; // inherited from NSObjectProtocol + paymentCardTextFieldDidBeginEditingCVC?(textField: STPPaymentCardTextField): void; - readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + paymentCardTextFieldDidBeginEditingExpiration?(textField: STPPaymentCardTextField): void; - readonly // inherited from NSObjectProtocol + paymentCardTextFieldDidBeginEditingNumber?(textField: STPPaymentCardTextField): void; - class(): typeof NSObject; + paymentCardTextFieldDidBeginEditingPostalCode?(textField: STPPaymentCardTextField): void; - conformsToProtocol(aProtocol: any /* Protocol */): boolean; + paymentCardTextFieldDidChange?(textField: STPPaymentCardTextField): void; - isEqual(object: any): boolean; + paymentCardTextFieldDidEndEditing?(textField: STPPaymentCardTextField): void; - isKindOfClass(aClass: typeof NSObject): boolean; + paymentCardTextFieldDidEndEditingCVC?(textField: STPPaymentCardTextField): void; - isMemberOfClass(aClass: typeof NSObject): boolean; + paymentCardTextFieldDidEndEditingExpiration?(textField: STPPaymentCardTextField): void; - performSelector(aSelector: string): any; + paymentCardTextFieldDidEndEditingNumber?(textField: STPPaymentCardTextField): void; - performSelectorWithObject(aSelector: string, object: any): any; + paymentCardTextFieldDidEndEditingPostalCode?(textField: STPPaymentCardTextField): void; + } + declare var STPPaymentCardTextFieldDelegate: { - performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + prototype: STPPaymentCardTextFieldDelegate; + }; - respondsToSelector(aSelector: string): boolean; + declare class STPPaymentConfiguration extends NSObject implements NSCopying { - retainCount(): number; + static alloc(): STPPaymentConfiguration; // inherited from NSObject - self(): this; + static new(): STPPaymentConfiguration; // inherited from NSObject - setAccountNumber(accountNumber: string): void; -} + static sharedConfiguration(): STPPaymentConfiguration; -declare const enum STPBankAccountHolderType { + additionalPaymentMethods: STPPaymentMethodType; - Individual = 0, + appleMerchantIdentifier: string; - Company = 1 -} + canDeletePaymentMethods: boolean; -declare class STPBankAccountParams extends NSObject implements STPFormEncodable { + companyName: string; - static alloc(): STPBankAccountParams; // inherited from NSObject + publishableKey: string; - static new(): STPBankAccountParams; // inherited from NSObject + requiredBillingAddressFields: STPBillingAddressFields; - static propertyNamesToFormFieldNamesMapping(): NSDictionary; + requiredShippingAddressFields: PKAddressField; - static rootObjectName(): string; + shippingType: STPShippingType; - accountHolderName: string; + verifyPrefilledShippingAddress: boolean; - accountHolderType: STPBankAccountHolderType; + copyWithZone(zone: interop.Pointer | interop.Reference): any; + } - accountNumber: string; + declare class STPPaymentContext extends NSObject { - country: string; + static alloc(): STPPaymentContext; // inherited from NSObject - currency: string; + static new(): STPPaymentContext; // inherited from NSObject - readonly last4: string; + readonly apiAdapter: STPBackendAPIAdapter; - routingNumber: string; + readonly configuration: STPPaymentConfiguration; - additionalAPIParameters: NSDictionary; // inherited from STPFormEncodable + delegate: STPPaymentContextDelegate; - readonly debugDescription: string; // inherited from NSObjectProtocol + hostViewController: UIViewController; - readonly description: string; // inherited from NSObjectProtocol + readonly loading: boolean; - readonly hash: number; // inherited from NSObjectProtocol + modalPresentationStyle: UIModalPresentationStyle; - readonly isProxy: boolean; // inherited from NSObjectProtocol + paymentAmount: number; - readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + paymentCountry: string; - readonly // inherited from NSObjectProtocol + paymentCurrency: string; - class(): typeof NSObject; + readonly paymentMethods: NSArray; - conformsToProtocol(aProtocol: any /* Protocol */): boolean; + paymentSummaryItems: NSArray; - isEqual(object: any): boolean; + prefilledInformation: STPUserInformation; - isKindOfClass(aClass: typeof NSObject): boolean; + readonly selectedPaymentMethod: STPPaymentMethod; - isMemberOfClass(aClass: typeof NSObject): boolean; + readonly selectedShippingMethod: PKShippingMethod; - performSelector(aSelector: string): any; + readonly shippingAddress: STPAddress; - performSelectorWithObject(aSelector: string, object: any): any; + readonly shippingMethods: NSArray; - performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + readonly theme: STPTheme; - respondsToSelector(aSelector: string): boolean; + constructor(o: { APIAdapter: STPBackendAPIAdapter; }); - retainCount(): number; + constructor(o: { APIAdapter: STPBackendAPIAdapter; configuration: STPPaymentConfiguration; theme: STPTheme; }); - self(): this; -} + constructor(o: { customerContext: STPCustomerContext; }); -declare const enum STPBankAccountStatus { + constructor(o: { customerContext: STPCustomerContext; configuration: STPPaymentConfiguration; theme: STPTheme; }); - New = 0, + initWithAPIAdapter(apiAdapter: STPBackendAPIAdapter): this; - Validated = 1, + initWithAPIAdapterConfigurationTheme(apiAdapter: STPBackendAPIAdapter, configuration: STPPaymentConfiguration, theme: STPTheme): this; - Verified = 2, + initWithCustomerContext(customerContext: STPCustomerContext): this; - Errored = 3 -} + initWithCustomerContextConfigurationTheme(customerContext: STPCustomerContext, configuration: STPPaymentConfiguration, theme: STPTheme): this; -declare const enum STPBillingAddressFields { + presentPaymentMethodsViewController(): void; - None = 0, + presentShippingViewController(): void; - Zip = 1, + pushPaymentMethodsViewController(): void; - Full = 2 -} + pushShippingViewController(): void; -declare class STPCard extends STPCardParams implements STPAPIResponseDecodable, STPPaymentMethod, STPSource { + requestPayment(): void; - static alloc(): STPCard; // inherited from NSObject + retryLoading(): void; + } - static brandFromString(string: string): STPCardBrand; + interface STPPaymentContextDelegate extends NSObjectProtocol { - static decodedObjectFromAPIResponse(response: NSDictionary): STPCard; + paymentContextDidChange(paymentContext: STPPaymentContext): void; - static fundingFromString(string: string): STPCardFundingType; + paymentContextDidCreatePaymentResultCompletion(paymentContext: STPPaymentContext, paymentResult: STPPaymentResult, completion: (p1: NSError) => void): void; - static new(): STPCard; // inherited from NSObject + paymentContextDidFailToLoadWithError(paymentContext: STPPaymentContext, error: NSError): void; - static requiredFields(): NSArray; + paymentContextDidFinishWithStatusError(paymentContext: STPPaymentContext, status: STPPaymentStatus, error: NSError): void; - static stringFromBrand(brand: STPCardBrand): string; + paymentContextDidUpdateShippingAddressCompletion?(paymentContext: STPPaymentContext, address: STPAddress, completion: (p1: STPShippingStatus, p2: NSError, p3: NSArray, p4: PKShippingMethod) => void): void; + } + declare var STPPaymentContextDelegate: { - readonly brand: STPCardBrand; + prototype: STPPaymentContextDelegate; + }; - readonly cardId: string; + interface STPPaymentMethod extends NSObjectProtocol { - readonly country: string; + image: UIImage; - readonly dynamicLast4: string; + label: string; - readonly fingerprint: string; + templateImage: UIImage; + } + declare var STPPaymentMethod: { - readonly funding: STPCardFundingType; + prototype: STPPaymentMethod; + }; - readonly isApplePayCard: boolean; + declare const enum STPPaymentMethodType { - readonly last4: string; + None = 0, - readonly type: string; + ApplePay = 1, - readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable + All = 1 + } - readonly debugDescription: string; // inherited from NSObjectProtocol + declare class STPPaymentMethodsViewController extends STPCoreViewController { - readonly description: string; // inherited from NSObjectProtocol + static alloc(): STPPaymentMethodsViewController; // inherited from NSObject - readonly hash: number; // inherited from NSObjectProtocol + static new(): STPPaymentMethodsViewController; // inherited from NSObject - readonly image: UIImage; // inherited from STPPaymentMethod + readonly delegate: STPPaymentMethodsViewControllerDelegate; - readonly isProxy: boolean; // inherited from NSObjectProtocol + prefilledInformation: STPUserInformation; - readonly label: string; // inherited from STPPaymentMethod + constructor(o: { configuration: STPPaymentConfiguration; theme: STPTheme; apiAdapter: STPBackendAPIAdapter; delegate: STPPaymentMethodsViewControllerDelegate; }); - readonly stripeID: string; // inherited from STPSource + constructor(o: { configuration: STPPaymentConfiguration; theme: STPTheme; customerContext: STPCustomerContext; delegate: STPPaymentMethodsViewControllerDelegate; }); - readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + constructor(o: { paymentContext: STPPaymentContext; }); - readonly templateImage: UIImage; // inherited from STPPaymentMethod + dismissWithCompletion(completion: () => void): void; - readonly // inherited from NSObjectProtocol + initWithConfigurationThemeApiAdapterDelegate(configuration: STPPaymentConfiguration, theme: STPTheme, apiAdapter: STPBackendAPIAdapter, delegate: STPPaymentMethodsViewControllerDelegate): this; - constructor(o: { ID: string; brand: STPCardBrand; last4: string; expMonth: number; expYear: number; funding: STPCardFundingType; }); + initWithConfigurationThemeCustomerContextDelegate(configuration: STPPaymentConfiguration, theme: STPTheme, customerContext: STPCustomerContext, delegate: STPPaymentMethodsViewControllerDelegate): this; - class(): typeof NSObject; + initWithPaymentContext(paymentContext: STPPaymentContext): this; + } - conformsToProtocol(aProtocol: any /* Protocol */): boolean; + interface STPPaymentMethodsViewControllerDelegate extends NSObjectProtocol { - initWithIDBrandLast4ExpMonthExpYearFunding(cardID: string, brand: STPCardBrand, last4: string, expMonth: number, expYear: number, funding: STPCardFundingType): this; + paymentMethodsViewControllerDidCancel(paymentMethodsViewController: STPPaymentMethodsViewController): void; - isEqual(object: any): boolean; + paymentMethodsViewControllerDidFailToLoadWithError(paymentMethodsViewController: STPPaymentMethodsViewController, error: NSError): void; - isKindOfClass(aClass: typeof NSObject): boolean; + paymentMethodsViewControllerDidFinish(paymentMethodsViewController: STPPaymentMethodsViewController): void; - isMemberOfClass(aClass: typeof NSObject): boolean; + paymentMethodsViewControllerDidSelectPaymentMethod?(paymentMethodsViewController: STPPaymentMethodsViewController, paymentMethod: STPPaymentMethod): void; + } + declare var STPPaymentMethodsViewControllerDelegate: { - performSelector(aSelector: string): any; + prototype: STPPaymentMethodsViewControllerDelegate; + }; - performSelectorWithObject(aSelector: string, object: any): any; + declare class STPPaymentResult extends NSObject { - performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + static alloc(): STPPaymentResult; // inherited from NSObject - respondsToSelector(aSelector: string): boolean; + static new(): STPPaymentResult; // inherited from NSObject - retainCount(): number; + readonly source: STPSourceProtocol; - self(): this; + constructor(o: { source: STPSourceProtocol; }); - setAddressCity(addressCity: string): void; + initWithSource(source: STPSourceProtocol): this; + } - setAddressCountry(addressCountry: string): void; + declare const enum STPPaymentStatus { - setAddressLine1(addressLine1: string): void; + Success = 0, - setAddressLine2(addressLine2: string): void; + Error = 1, - setAddressState(addressState: string): void; + UserCancellation = 2 + } - setAddressZip(addressZip: string): void; + declare var STPProcessingError: string; - setExpMonth(expMonth: number): void; + declare class STPRedirectContext extends NSObject { - setExpYear(expYear: number): void; + static alloc(): STPRedirectContext; // inherited from NSObject - setName(name: string): void; -} + static new(): STPRedirectContext; // inherited from NSObject -declare const enum STPCardBrand { + readonly state: STPRedirectContextState; - Visa = 0, + constructor(o: { source: STPSource; completion: (p1: string, p2: string, p3: NSError) => void; }); - Amex = 1, + cancel(): void; - MasterCard = 2, + initWithSourceCompletion(source: STPSource, completion: (p1: string, p2: string, p3: NSError) => void): this; - Discover = 3, + startRedirectFlowFromViewController(presentingViewController: UIViewController): void; - JCB = 4, + startSafariAppRedirectFlow(): void; - DinersClub = 5, + startSafariViewControllerRedirectFlowFromViewController(presentingViewController: UIViewController): void; + } - Unknown = 6 -} + declare const enum STPRedirectContextState { -declare var STPCardDeclined: string; + NotStarted = 0, -declare var STPCardErrorCodeKey: string; + InProgress = 1, -declare const enum STPCardFundingType { + Cancelled = 2, - Debit = 0, + Completed = 3 + } - Credit = 1, + declare class STPShippingAddressViewController extends STPCoreTableViewController { - Prepaid = 2, + static alloc(): STPShippingAddressViewController; // inherited from NSObject - Other = 3 -} + static new(): STPShippingAddressViewController; // inherited from NSObject -declare class STPCardParams extends NSObject implements STPFormEncodable { + delegate: STPShippingAddressViewControllerDelegate; - static alloc(): STPCardParams; // inherited from NSObject + constructor(o: { configuration: STPPaymentConfiguration; theme: STPTheme; currency: string; shippingAddress: STPAddress; selectedShippingMethod: PKShippingMethod; prefilledInformation: STPUserInformation; }); - static new(): STPCardParams; // inherited from NSObject + constructor(o: { paymentContext: STPPaymentContext; }); - static propertyNamesToFormFieldNamesMapping(): NSDictionary; + dismissWithCompletion(completion: () => void): void; - static rootObjectName(): string; + initWithConfigurationThemeCurrencyShippingAddressSelectedShippingMethodPrefilledInformation(configuration: STPPaymentConfiguration, theme: STPTheme, currency: string, shippingAddress: STPAddress, selectedShippingMethod: PKShippingMethod, prefilledInformation: STPUserInformation): this; - address: STPAddress; + initWithPaymentContext(paymentContext: STPPaymentContext): this; + } - addressCity: string; + interface STPShippingAddressViewControllerDelegate extends NSObjectProtocol { - addressCountry: string; + shippingAddressViewControllerDidCancel(addressViewController: STPShippingAddressViewController): void; - addressLine1: string; + shippingAddressViewControllerDidEnterAddressCompletion(addressViewController: STPShippingAddressViewController, address: STPAddress, completion: (p1: STPShippingStatus, p2: NSError, p3: NSArray, p4: PKShippingMethod) => void): void; - addressLine2: string; + shippingAddressViewControllerDidFinishWithAddressShippingMethod(addressViewController: STPShippingAddressViewController, address: STPAddress, method: PKShippingMethod): void; + } + declare var STPShippingAddressViewControllerDelegate: { - addressState: string; + prototype: STPShippingAddressViewControllerDelegate; + }; - addressZip: string; + declare const enum STPShippingStatus { - currency: string; + Valid = 0, - cvc: string; + Invalid = 1 + } - expMonth: number; + declare const enum STPShippingType { - expYear: number; + Shipping = 0, - readonly last4: string; + Delivery = 1 + } - name: string; + declare class STPSource extends NSObject implements STPAPIResponseDecodable, STPSourceProtocol { - number: string; + static alloc(): STPSource; // inherited from NSObject - additionalAPIParameters: NSDictionary; // inherited from STPFormEncodable + static decodedObjectFromAPIResponse(response: NSDictionary): STPSource; - readonly debugDescription: string; // inherited from NSObjectProtocol + static new(): STPSource; // inherited from NSObject - readonly description: string; // inherited from NSObjectProtocol + static requiredFields(): NSArray; - readonly hash: number; // inherited from NSObjectProtocol + readonly amount: number; - readonly isProxy: boolean; // inherited from NSObjectProtocol + readonly cardDetails: STPSourceCardDetails; - readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + readonly clientSecret: string; - readonly // inherited from NSObjectProtocol + readonly created: Date; - class(): typeof NSObject; + readonly currency: string; - conformsToProtocol(aProtocol: any /* Protocol */): boolean; + readonly details: NSDictionary; - isEqual(object: any): boolean; + readonly flow: STPSourceFlow; - isKindOfClass(aClass: typeof NSObject): boolean; + readonly livemode: boolean; - isMemberOfClass(aClass: typeof NSObject): boolean; + readonly metadata: NSDictionary; - performSelector(aSelector: string): any; + readonly owner: STPSourceOwner; - performSelectorWithObject(aSelector: string, object: any): any; + readonly receiver: STPSourceReceiver; - performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + readonly redirect: STPSourceRedirect; - respondsToSelector(aSelector: string): boolean; + readonly sepaDebitDetails: STPSourceSEPADebitDetails; - retainCount(): number; + readonly status: STPSourceStatus; - self(): this; + readonly type: STPSourceType; - validateCardReturningError(): boolean; + readonly usage: STPSourceUsage; - validateCvcError(ioValue: interop.Pointer | interop.Reference): boolean; + readonly verification: STPSourceVerification; - validateExpMonthError(ioValue: interop.Pointer | interop.Reference): boolean; + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable - validateExpYearError(ioValue: interop.Pointer | interop.Reference): boolean; + readonly debugDescription: string; // inherited from NSObjectProtocol - validateNumberError(ioValue: interop.Pointer | interop.Reference): boolean; -} + readonly description: string; // inherited from NSObjectProtocol -declare const enum STPCardValidationState { + readonly hash: number; // inherited from NSObjectProtocol - Valid = 0, + readonly isProxy: boolean; // inherited from NSObjectProtocol - Invalid = 1, + readonly stripeID: string; // inherited from STPSourceProtocol - Incomplete = 2 -} + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol -declare class STPCardValidator extends NSObject { + readonly // inherited from NSObjectProtocol - static alloc(): STPCardValidator; // inherited from NSObject + class(): typeof NSObject; - static brandForNumber(cardNumber: string): STPCardBrand; + conformsToProtocol(aProtocol: any /* Protocol */): boolean; - static fragmentLengthForCardBrand(brand: STPCardBrand): number; + isEqual(object: any): boolean; - static lengthForCardBrand(brand: STPCardBrand): number; + isKindOfClass(aClass: typeof NSObject): boolean; - static lengthsForCardBrand(brand: STPCardBrand): NSSet; + isMemberOfClass(aClass: typeof NSObject): boolean; - static maxCVCLengthForCardBrand(brand: STPCardBrand): number; + performSelector(aSelector: string): any; - static maxLengthForCardBrand(brand: STPCardBrand): number; + performSelectorWithObject(aSelector: string, object: any): any; - static new(): STPCardValidator; // inherited from NSObject + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; - static sanitizedNumericStringForString(string: string): string; + respondsToSelector(aSelector: string): boolean; - static stringIsNumeric(string: string): boolean; + retainCount(): number; - static validationStateForCVCCardBrand(cvc: string, brand: STPCardBrand): STPCardValidationState; + self(): this; + } - static validationStateForCard(card: STPCardParams): STPCardValidationState; + declare const enum STPSourceCard3DSecureStatus { - static validationStateForCardInCurrentYearCurrentMonth(card: STPCardParams, currentYear: number, currentMonth: number): STPCardValidationState; + Required = 0, - static validationStateForExpirationMonth(expirationMonth: string): STPCardValidationState; + Optional = 1, - static validationStateForExpirationYearInMonth(expirationYear: string, expirationMonth: string): STPCardValidationState; + NotSupported = 2, - static validationStateForExpirationYearInMonthInCurrentYearCurrentMonth(expirationYear: string, expirationMonth: string, currentYear: number, currentMonth: number): STPCardValidationState; + Unknown = 3 + } - static validationStateForNumberValidatingCardBrand(cardNumber: string, validatingCardBrand: boolean): STPCardValidationState; -} + declare class STPSourceCardDetails extends NSObject implements STPAPIResponseDecodable { -declare class STPCustomer extends NSObject { + static alloc(): STPSourceCardDetails; // inherited from NSObject - static alloc(): STPCustomer; // inherited from NSObject + static decodedObjectFromAPIResponse(response: NSDictionary): STPSourceCardDetails; - static customerWithStripeIDDefaultSourceSources(stripeID: string, defaultSource: STPSource, sources: NSArray): STPCustomer; + static new(): STPSourceCardDetails; // inherited from NSObject - static new(): STPCustomer; // inherited from NSObject + static requiredFields(): NSArray; - readonly defaultSource: STPSource; + readonly brand: STPCardBrand; - readonly sources: NSArray; + readonly country: string; - readonly stripeID: string; -} + readonly expMonth: number; -declare class STPCustomerDeserializer extends NSObject { + readonly expYear: number; - static alloc(): STPCustomerDeserializer; // inherited from NSObject + readonly funding: STPCardFundingType; - static new(): STPCustomerDeserializer; // inherited from NSObject + readonly last4: string; - readonly customer: STPCustomer; + readonly threeDSecure: STPSourceCard3DSecureStatus; - readonly error: NSError; + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable - constructor(o: { data: NSData; urlResponse: NSURLResponse; error: NSError; }); + readonly debugDescription: string; // inherited from NSObjectProtocol - constructor(o: { JSONResponse: any; }); + readonly description: string; // inherited from NSObjectProtocol - initWithDataUrlResponseError(data: NSData, urlResponse: NSURLResponse, error: NSError): this; + readonly hash: number; // inherited from NSObjectProtocol - initWithJSONResponse(json: any): this; -} + readonly isProxy: boolean; // inherited from NSObjectProtocol -declare const enum STPErrorCode { + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol - ConnectionError = 40, + readonly // inherited from NSObjectProtocol - InvalidRequestError = 50, + class(): typeof NSObject; - APIError = 60, + conformsToProtocol(aProtocol: any /* Protocol */): boolean; - CardError = 70, + isEqual(object: any): boolean; - CancellationError = 80, + isKindOfClass(aClass: typeof NSObject): boolean; - CheckoutUnknownError = 5000, + isMemberOfClass(aClass: typeof NSObject): boolean; - CheckoutTooManyAttemptsError = 5001 -} + performSelector(aSelector: string): any; -declare var STPErrorMessageKey: string; + performSelectorWithObject(aSelector: string, object: any): any; -declare var STPErrorParameterKey: string; + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; -declare var STPExpiredCard: string; + respondsToSelector(aSelector: string): boolean; -interface STPFormEncodable extends NSObjectProtocol { + retainCount(): number; - additionalAPIParameters: NSDictionary; -} -declare var STPFormEncodable: { + self(): this; + } - prototype: STPFormEncodable; + declare const enum STPSourceFlow { - propertyNamesToFormFieldNamesMapping(): NSDictionary; + None = 0, - rootObjectName(): string; -}; + Redirect = 1, -declare class STPImageLibrary extends NSObject { + CodeVerification = 2, - static alloc(): STPImageLibrary; // inherited from NSObject + Receiver = 3, - static amexCardImage(): UIImage; + Unknown = 4 + } - static applePayCardImage(): UIImage; + declare class STPSourceOwner extends NSObject implements STPAPIResponseDecodable { - static brandImageForCardBrand(brand: STPCardBrand): UIImage; + static alloc(): STPSourceOwner; // inherited from NSObject - static cvcImageForCardBrand(brand: STPCardBrand): UIImage; + static decodedObjectFromAPIResponse(response: NSDictionary): STPSourceOwner; - static dinersClubCardImage(): UIImage; + static new(): STPSourceOwner; // inherited from NSObject - static discoverCardImage(): UIImage; + static requiredFields(): NSArray; - static jcbCardImage(): UIImage; + readonly address: STPAddress; - static masterCardCardImage(): UIImage; + readonly email: string; - static new(): STPImageLibrary; // inherited from NSObject + readonly name: string; - static templatedBrandImageForCardBrand(brand: STPCardBrand): UIImage; + readonly phone: string; - static unknownCardCardImage(): UIImage; + readonly verifiedAddress: STPAddress; - static visaCardImage(): UIImage; -} + readonly verifiedEmail: string; -declare var STPIncorrectCVC: string; + readonly verifiedName: string; -declare var STPIncorrectNumber: string; + readonly verifiedPhone: string; -declare var STPInvalidCVC: string; + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable -declare var STPInvalidExpMonth: string; + readonly debugDescription: string; // inherited from NSObjectProtocol -declare var STPInvalidExpYear: string; + readonly description: string; // inherited from NSObjectProtocol -declare var STPInvalidNumber: string; + readonly hash: number; // inherited from NSObjectProtocol -declare class STPPaymentActivityIndicatorView extends UIView { + readonly isProxy: boolean; // inherited from NSObjectProtocol - static alloc(): STPPaymentActivityIndicatorView; // inherited from NSObject + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol - static appearance(): STPPaymentActivityIndicatorView; // inherited from UIAppearance + readonly // inherited from NSObjectProtocol - static appearanceForTraitCollection(trait: UITraitCollection): STPPaymentActivityIndicatorView; // inherited from UIAppearance + class(): typeof NSObject; - static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): STPPaymentActivityIndicatorView; // inherited from UIAppearance + conformsToProtocol(aProtocol: any /* Protocol */): boolean; - static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray): STPPaymentActivityIndicatorView; // inherited from UIAppearance + isEqual(object: any): boolean; - static appearanceWhenContainedIn(ContainerClass: typeof NSObject): STPPaymentActivityIndicatorView; // inherited from UIAppearance + isKindOfClass(aClass: typeof NSObject): boolean; - static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray): STPPaymentActivityIndicatorView; // inherited from UIAppearance + isMemberOfClass(aClass: typeof NSObject): boolean; - static new(): STPPaymentActivityIndicatorView; // inherited from NSObject + performSelector(aSelector: string): any; - animating: boolean; + performSelectorWithObject(aSelector: string, object: any): any; - hidesWhenStopped: boolean; + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; - setAnimatingAnimated(animating: boolean, animated: boolean): void; -} + respondsToSelector(aSelector: string): boolean; -declare class STPPaymentCardTextField extends UIControl implements UIKeyInput { + retainCount(): number; - static alloc(): STPPaymentCardTextField; // inherited from NSObject + self(): this; + } - static appearance(): STPPaymentCardTextField; // inherited from UIAppearance + declare class STPSourceParams extends NSObject implements NSCopying, STPFormEncodable { - static appearanceForTraitCollection(trait: UITraitCollection): STPPaymentCardTextField; // inherited from UIAppearance + static alipayParamsWithAmountCurrencyReturnURL(amount: number, currency: string, returnURL: string): STPSourceParams; - static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): STPPaymentCardTextField; // inherited from UIAppearance + static alloc(): STPSourceParams; // inherited from NSObject - static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray): STPPaymentCardTextField; // inherited from UIAppearance + static bancontactParamsWithAmountNameReturnURLStatementDescriptor(amount: number, name: string, returnURL: string, statementDescriptor: string): STPSourceParams; - static appearanceWhenContainedIn(ContainerClass: typeof NSObject): STPPaymentCardTextField; // inherited from UIAppearance + static bitcoinParamsWithAmountCurrencyEmail(amount: number, currency: string, email: string): STPSourceParams; - static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray): STPPaymentCardTextField; // inherited from UIAppearance + static cardParamsWithCard(card: STPCardParams): STPSourceParams; - static brandImageForCardBrand(cardBrand: STPCardBrand): UIImage; + static giropayParamsWithAmountNameReturnURLStatementDescriptor(amount: number, name: string, returnURL: string, statementDescriptor: string): STPSourceParams; - static cvcImageForCardBrand(cardBrand: STPCardBrand): UIImage; + static idealParamsWithAmountNameReturnURLStatementDescriptorBank(amount: number, name: string, returnURL: string, statementDescriptor: string, bank: string): STPSourceParams; - static new(): STPPaymentCardTextField; // inherited from NSObject + static new(): STPSourceParams; // inherited from NSObject - borderColor: UIColor; + static propertyNamesToFormFieldNamesMapping(): NSDictionary; - borderWidth: number; + static rootObjectName(): string; - readonly brandImage: UIImage; + static sepaDebitParamsWithNameIbanAddressLine1CityPostalCodeCountry(name: string, iban: string, addressLine1: string, city: string, postalCode: string, country: string): STPSourceParams; - card: STPCardParams; + static sofortParamsWithAmountReturnURLCountryStatementDescriptor(amount: number, returnURL: string, country: string, statementDescriptor: string): STPSourceParams; - readonly cardNumber: string; + static threeDSecureParamsWithAmountCurrencyReturnURLCard(amount: number, currency: string, returnURL: string, card: string): STPSourceParams; - cardParams: STPCardParams; + amount: number; - cornerRadius: number; + currency: string; - cursorColor: UIColor; + flow: STPSourceFlow; - readonly cvc: string; + metadata: NSDictionary; - cvcPlaceholder: string; + owner: NSDictionary; - delegate: STPPaymentCardTextFieldDelegate; + rawTypeString: string; - readonly expirationMonth: number; + redirect: NSDictionary; - expirationPlaceholder: string; + token: string; - readonly expirationYear: number; + type: STPSourceType; - font: UIFont; + usage: STPSourceUsage; - readonly formattedExpirationMonth: string; + additionalAPIParameters: NSDictionary; // inherited from STPFormEncodable - readonly formattedExpirationYear: string; + readonly debugDescription: string; // inherited from NSObjectProtocol - inputAccessoryView: UIView; + readonly description: string; // inherited from NSObjectProtocol - readonly isValid: boolean; + readonly hash: number; // inherited from NSObjectProtocol - numberPlaceholder: string; + readonly isProxy: boolean; // inherited from NSObjectProtocol - placeholderColor: UIColor; + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol - textColor: UIColor; + readonly // inherited from NSObjectProtocol - textErrorColor: UIColor; + class(): typeof NSObject; - readonly valid: boolean; + conformsToProtocol(aProtocol: any /* Protocol */): boolean; - autocapitalizationType: UITextAutocapitalizationType; // inherited from UITextInputTraits + copyWithZone(zone: interop.Pointer | interop.Reference): any; - autocorrectionType: UITextAutocorrectionType; // inherited from UITextInputTraits + isEqual(object: any): boolean; - readonly debugDescription: string; // inherited from NSObjectProtocol + isKindOfClass(aClass: typeof NSObject): boolean; - readonly description: string; // inherited from NSObjectProtocol + isMemberOfClass(aClass: typeof NSObject): boolean; - enablesReturnKeyAutomatically: boolean; // inherited from UITextInputTraits + performSelector(aSelector: string): any; - readonly hasText: boolean; // inherited from UIKeyInput + performSelectorWithObject(aSelector: string, object: any): any; - readonly hash: number; // inherited from NSObjectProtocol + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; - readonly isProxy: boolean; // inherited from NSObjectProtocol + respondsToSelector(aSelector: string): boolean; - keyboardAppearance: UIKeyboardAppearance; // inherited from UITextInputTraits + retainCount(): number; - keyboardType: UIKeyboardType; // inherited from UITextInputTraits + self(): this; + } - returnKeyType: UIReturnKeyType; // inherited from UITextInputTraits + interface STPSourceProtocol extends NSObjectProtocol { - secureTextEntry: boolean; // inherited from UITextInputTraits + stripeID: string; + } + declare var STPSourceProtocol: { - spellCheckingType: UITextSpellCheckingType; // inherited from UITextInputTraits + prototype: STPSourceProtocol; + }; - readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + declare class STPSourceReceiver extends NSObject implements STPAPIResponseDecodable { - textContentType: string; // inherited from UITextInputTraits + static alloc(): STPSourceReceiver; // inherited from NSObject - readonly // inherited from NSObjectProtocol + static decodedObjectFromAPIResponse(response: NSDictionary): STPSourceReceiver; - brandImageRectForBounds(bounds: CGRect): CGRect; + static new(): STPSourceReceiver; // inherited from NSObject - class(): typeof NSObject; + static requiredFields(): NSArray; - clear(): void; + readonly address: string; - commonInit(): void; + readonly amountCharged: number; - conformsToProtocol(aProtocol: any /* Protocol */): boolean; + readonly amountReceived: number; - cvcFieldRectForBounds(bounds: CGRect): CGRect; + readonly amountReturned: number; - deleteBackward(): void; + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable - expirationFieldRectForBounds(bounds: CGRect): CGRect; + readonly debugDescription: string; // inherited from NSObjectProtocol - fieldsRectForBounds(bounds: CGRect): CGRect; + readonly description: string; // inherited from NSObjectProtocol - insertText(text: string): void; + readonly hash: number; // inherited from NSObjectProtocol - isEqual(object: any): boolean; + readonly isProxy: boolean; // inherited from NSObjectProtocol - isKindOfClass(aClass: typeof NSObject): boolean; + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol - isMemberOfClass(aClass: typeof NSObject): boolean; + readonly // inherited from NSObjectProtocol - numberFieldRectForBounds(bounds: CGRect): CGRect; + class(): typeof NSObject; - performSelector(aSelector: string): any; + conformsToProtocol(aProtocol: any /* Protocol */): boolean; - performSelectorWithObject(aSelector: string, object: any): any; + isEqual(object: any): boolean; - performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + isKindOfClass(aClass: typeof NSObject): boolean; - respondsToSelector(aSelector: string): boolean; + isMemberOfClass(aClass: typeof NSObject): boolean; - retainCount(): number; + performSelector(aSelector: string): any; - self(): this; -} + performSelectorWithObject(aSelector: string, object: any): any; -interface STPPaymentCardTextFieldDelegate extends NSObjectProtocol { + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; - paymentCardTextFieldDidBeginEditingCVC?(textField: STPPaymentCardTextField): void; + respondsToSelector(aSelector: string): boolean; - paymentCardTextFieldDidBeginEditingExpiration?(textField: STPPaymentCardTextField): void; + retainCount(): number; - paymentCardTextFieldDidBeginEditingNumber?(textField: STPPaymentCardTextField): void; + self(): this; + } - paymentCardTextFieldDidChange?(textField: STPPaymentCardTextField): void; + declare class STPSourceRedirect extends NSObject implements STPAPIResponseDecodable { - paymentCardTextFieldDidEndEditingCVC?(textField: STPPaymentCardTextField): void; + static alloc(): STPSourceRedirect; // inherited from NSObject - paymentCardTextFieldDidEndEditingExpiration?(textField: STPPaymentCardTextField): void; + static decodedObjectFromAPIResponse(response: NSDictionary): STPSourceRedirect; - paymentCardTextFieldDidEndEditingNumber?(textField: STPPaymentCardTextField): void; -} -declare var STPPaymentCardTextFieldDelegate: { + static new(): STPSourceRedirect; // inherited from NSObject - prototype: STPPaymentCardTextFieldDelegate; -}; + static requiredFields(): NSArray; -declare class STPPaymentConfiguration extends NSObject implements NSCopying { + readonly returnURL: NSURL; - static alloc(): STPPaymentConfiguration; // inherited from NSObject + readonly status: STPSourceRedirectStatus; - static new(): STPPaymentConfiguration; // inherited from NSObject + readonly url: NSURL; - static sharedConfiguration(): STPPaymentConfiguration; + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable - additionalPaymentMethods: STPPaymentMethodType; + readonly debugDescription: string; // inherited from NSObjectProtocol - appleMerchantIdentifier: string; + readonly description: string; // inherited from NSObjectProtocol - companyName: string; + readonly hash: number; // inherited from NSObjectProtocol - publishableKey: string; + readonly isProxy: boolean; // inherited from NSObjectProtocol - requiredBillingAddressFields: STPBillingAddressFields; + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol - requiredShippingAddressFields: PKAddressField; + readonly // inherited from NSObjectProtocol - shippingType: STPShippingType; + class(): typeof NSObject; - smsAutofillDisabled: boolean; + conformsToProtocol(aProtocol: any /* Protocol */): boolean; - copyWithZone(zone: interop.Pointer | interop.Reference): any; -} + isEqual(object: any): boolean; -declare class STPPaymentContext extends NSObject { + isKindOfClass(aClass: typeof NSObject): boolean; - static alloc(): STPPaymentContext; // inherited from NSObject + isMemberOfClass(aClass: typeof NSObject): boolean; - static new(): STPPaymentContext; // inherited from NSObject + performSelector(aSelector: string): any; - readonly apiAdapter: STPBackendAPIAdapter; + performSelectorWithObject(aSelector: string, object: any): any; - readonly configuration: STPPaymentConfiguration; + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; - delegate: STPPaymentContextDelegate; + respondsToSelector(aSelector: string): boolean; - hostViewController: UIViewController; + retainCount(): number; - readonly loading: boolean; + self(): this; + } - modalPresentationStyle: UIModalPresentationStyle; + declare const enum STPSourceRedirectStatus { - paymentAmount: number; + Pending = 0, - paymentCurrency: string; + Succeeded = 1, - readonly paymentMethods: NSArray; + Failed = 2, - paymentSummaryItems: NSArray; + Unknown = 3 + } - prefilledInformation: STPUserInformation; + declare class STPSourceSEPADebitDetails extends NSObject implements STPAPIResponseDecodable { - readonly selectedPaymentMethod: STPPaymentMethod; + static alloc(): STPSourceSEPADebitDetails; // inherited from NSObject - readonly selectedShippingMethod: PKShippingMethod; + static decodedObjectFromAPIResponse(response: NSDictionary): STPSourceSEPADebitDetails; - readonly shippingAddress: STPAddress; + static new(): STPSourceSEPADebitDetails; // inherited from NSObject - readonly shippingMethods: NSArray; + static requiredFields(): NSArray; - readonly theme: STPTheme; + readonly bankCode: string; - constructor(o: { APIAdapter: STPBackendAPIAdapter; }); + readonly country: string; - constructor(o: { APIAdapter: STPBackendAPIAdapter; configuration: STPPaymentConfiguration; theme: STPTheme; }); + readonly fingerprint: string; - initWithAPIAdapter(apiAdapter: STPBackendAPIAdapter): this; + readonly last4: string; - initWithAPIAdapterConfigurationTheme(apiAdapter: STPBackendAPIAdapter, configuration: STPPaymentConfiguration, theme: STPTheme): this; + readonly mandateReference: string; - presentPaymentMethodsViewController(): void; + readonly mandateURL: NSURL; - presentShippingViewController(): void; + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable - pushPaymentMethodsViewController(): void; + readonly debugDescription: string; // inherited from NSObjectProtocol - pushShippingViewController(): void; + readonly description: string; // inherited from NSObjectProtocol - requestPayment(): void; + readonly hash: number; // inherited from NSObjectProtocol - retryLoading(): void; -} + readonly isProxy: boolean; // inherited from NSObjectProtocol -interface STPPaymentContextDelegate extends NSObjectProtocol { + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol - paymentContextDidChange(paymentContext: STPPaymentContext): void; + readonly // inherited from NSObjectProtocol - paymentContextDidCreatePaymentResultCompletion(paymentContext: STPPaymentContext, paymentResult: STPPaymentResult, completion: (p1: NSError) => void): void; + class(): typeof NSObject; - paymentContextDidFailToLoadWithError(paymentContext: STPPaymentContext, error: NSError): void; + conformsToProtocol(aProtocol: any /* Protocol */): boolean; - paymentContextDidFinishWithStatusError(paymentContext: STPPaymentContext, status: STPPaymentStatus, error: NSError): void; + isEqual(object: any): boolean; - paymentContextDidUpdateShippingAddressCompletion?(paymentContext: STPPaymentContext, address: STPAddress, completion: (p1: STPShippingStatus, p2: NSError, p3: NSArray, p4: PKShippingMethod) => void): void; -} -declare var STPPaymentContextDelegate: { + isKindOfClass(aClass: typeof NSObject): boolean; - prototype: STPPaymentContextDelegate; -}; + isMemberOfClass(aClass: typeof NSObject): boolean; -interface STPPaymentMethod extends NSObjectProtocol { + performSelector(aSelector: string): any; - image: UIImage; + performSelectorWithObject(aSelector: string, object: any): any; - label: string; + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; - templateImage: UIImage; -} -declare var STPPaymentMethod: { + respondsToSelector(aSelector: string): boolean; - prototype: STPPaymentMethod; -}; + retainCount(): number; -declare const enum STPPaymentMethodType { + self(): this; + } - None = 0, + declare const enum STPSourceStatus { - ApplePay = 1, + Pending = 0, - All = 1 -} + Chargeable = 1, -declare class STPPaymentMethodsViewController extends UIViewController { + Consumed = 2, - static alloc(): STPPaymentMethodsViewController; // inherited from NSObject + Canceled = 3, - static new(): STPPaymentMethodsViewController; // inherited from NSObject + Failed = 4, - readonly delegate: STPPaymentMethodsViewControllerDelegate; + Unknown = 5 + } - prefilledInformation: STPUserInformation; + declare const enum STPSourceType { - constructor(o: { configuration: STPPaymentConfiguration; theme: STPTheme; apiAdapter: STPBackendAPIAdapter; delegate: STPPaymentMethodsViewControllerDelegate; }); + Bancontact = 0, - constructor(o: { paymentContext: STPPaymentContext; }); + Bitcoin = 1, - dismissWithCompletion(completion: () => void): void; + Card = 2, - initWithConfigurationThemeApiAdapterDelegate(configuration: STPPaymentConfiguration, theme: STPTheme, apiAdapter: STPBackendAPIAdapter, delegate: STPPaymentMethodsViewControllerDelegate): this; + Giropay = 3, - initWithPaymentContext(paymentContext: STPPaymentContext): this; -} + IDEAL = 4, -interface STPPaymentMethodsViewControllerDelegate extends NSObjectProtocol { + SEPADebit = 5, - paymentMethodsViewControllerDidFailToLoadWithError(paymentMethodsViewController: STPPaymentMethodsViewController, error: NSError): void; + Sofort = 6, - paymentMethodsViewControllerDidFinish(paymentMethodsViewController: STPPaymentMethodsViewController): void; + ThreeDSecure = 7, - paymentMethodsViewControllerDidSelectPaymentMethod(paymentMethodsViewController: STPPaymentMethodsViewController, paymentMethod: STPPaymentMethod): void; -} -declare var STPPaymentMethodsViewControllerDelegate: { + Alipay = 8, - prototype: STPPaymentMethodsViewControllerDelegate; -}; + Unknown = 9 + } -declare class STPPaymentResult extends NSObject { + declare const enum STPSourceUsage { - static alloc(): STPPaymentResult; // inherited from NSObject + Reusable = 0, - static new(): STPPaymentResult; // inherited from NSObject + SingleUse = 1, - readonly source: STPSource; + Unknown = 2 + } - constructor(o: { source: STPSource; }); + declare class STPSourceVerification extends NSObject implements STPAPIResponseDecodable { - initWithSource(source: STPSource): this; -} + static alloc(): STPSourceVerification; // inherited from NSObject -declare const enum STPPaymentStatus { + static decodedObjectFromAPIResponse(response: NSDictionary): STPSourceVerification; - Success = 0, + static new(): STPSourceVerification; // inherited from NSObject - Error = 1, + static requiredFields(): NSArray; - UserCancellation = 2 -} + readonly attemptsRemaining: number; -declare var STPProcessingError: string; + readonly status: STPSourceVerificationStatus; -declare class STPShippingAddressViewController extends UIViewController { + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable - static alloc(): STPShippingAddressViewController; // inherited from NSObject + readonly debugDescription: string; // inherited from NSObjectProtocol - static new(): STPShippingAddressViewController; // inherited from NSObject + readonly description: string; // inherited from NSObjectProtocol - delegate: STPShippingAddressViewControllerDelegate; + readonly hash: number; // inherited from NSObjectProtocol - constructor(o: { configuration: STPPaymentConfiguration; theme: STPTheme; currency: string; shippingAddress: STPAddress; selectedShippingMethod: PKShippingMethod; prefilledInformation: STPUserInformation; }); + readonly isProxy: boolean; // inherited from NSObjectProtocol - constructor(o: { paymentContext: STPPaymentContext; }); + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol - dismissWithCompletion(completion: () => void): void; + readonly // inherited from NSObjectProtocol - initWithConfigurationThemeCurrencyShippingAddressSelectedShippingMethodPrefilledInformation(configuration: STPPaymentConfiguration, theme: STPTheme, currency: string, shippingAddress: STPAddress, selectedShippingMethod: PKShippingMethod, prefilledInformation: STPUserInformation): this; + class(): typeof NSObject; - initWithPaymentContext(paymentContext: STPPaymentContext): this; -} + conformsToProtocol(aProtocol: any /* Protocol */): boolean; -interface STPShippingAddressViewControllerDelegate extends NSObjectProtocol { + isEqual(object: any): boolean; - shippingAddressViewControllerDidCancel(addressViewController: STPShippingAddressViewController): void; + isKindOfClass(aClass: typeof NSObject): boolean; - shippingAddressViewControllerDidEnterAddressCompletion(addressViewController: STPShippingAddressViewController, address: STPAddress, completion: (p1: STPShippingStatus, p2: NSError, p3: NSArray, p4: PKShippingMethod) => void): void; + isMemberOfClass(aClass: typeof NSObject): boolean; - shippingAddressViewControllerDidFinishWithAddressShippingMethod(addressViewController: STPShippingAddressViewController, address: STPAddress, method: PKShippingMethod): void; -} -declare var STPShippingAddressViewControllerDelegate: { + performSelector(aSelector: string): any; - prototype: STPShippingAddressViewControllerDelegate; -}; + performSelectorWithObject(aSelector: string, object: any): any; -declare const enum STPShippingStatus { + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; - Valid = 0, + respondsToSelector(aSelector: string): boolean; - Invalid = 1 -} + retainCount(): number; -declare const enum STPShippingType { + self(): this; + } - Shipping = 0, + declare const enum STPSourceVerificationStatus { - Delivery = 1 -} + Pending = 0, -interface STPSource extends NSObjectProtocol { + Succeeded = 1, - stripeID: string; -} -declare var STPSource: { + Failed = 2, - prototype: STPSource; -}; + Unknown = 3 + } -declare class STPTheme extends NSObject implements NSCopying { + declare var STPStripeErrorCodeKey: string; - static alloc(): STPTheme; // inherited from NSObject + declare var STPStripeErrorTypeKey: string; - static defaultTheme(): STPTheme; + declare class STPTheme extends NSObject implements NSCopying { - static new(): STPTheme; // inherited from NSObject + static alloc(): STPTheme; // inherited from NSObject - accentColor: UIColor; + static defaultTheme(): STPTheme; - barStyle: UIBarStyle; + static new(): STPTheme; // inherited from NSObject - emphasisFont: UIFont; + accentColor: UIColor; - errorColor: UIColor; + barStyle: UIBarStyle; - font: UIFont; + emphasisFont: UIFont; - readonly largeFont: UIFont; + errorColor: UIColor; - primaryBackgroundColor: UIColor; + font: UIFont; - primaryForegroundColor: UIColor; + readonly largeFont: UIFont; - readonly quaternaryBackgroundColor: UIColor; + primaryBackgroundColor: UIColor; - secondaryBackgroundColor: UIColor; + primaryForegroundColor: UIColor; - secondaryForegroundColor: UIColor; + readonly quaternaryBackgroundColor: UIColor; - readonly smallFont: UIFont; + secondaryBackgroundColor: UIColor; - readonly tertiaryBackgroundColor: UIColor; + secondaryForegroundColor: UIColor; - readonly tertiaryForegroundColor: UIColor; + readonly smallFont: UIFont; - translucentNavigationBar: boolean; + readonly tertiaryBackgroundColor: UIColor; - copyWithZone(zone: interop.Pointer | interop.Reference): any; -} + readonly tertiaryForegroundColor: UIColor; -declare class STPToken extends NSObject implements STPAPIResponseDecodable, STPSource { + translucentNavigationBar: boolean; - static alloc(): STPToken; // inherited from NSObject + copyWithZone(zone: interop.Pointer | interop.Reference): any; + } - static decodedObjectFromAPIResponse(response: NSDictionary): STPToken; + declare class STPToken extends NSObject implements STPAPIResponseDecodable, STPSourceProtocol { - static new(): STPToken; // inherited from NSObject + static alloc(): STPToken; // inherited from NSObject - static requiredFields(): NSArray; + static decodedObjectFromAPIResponse(response: NSDictionary): STPToken; - readonly bankAccount: STPBankAccount; + static new(): STPToken; // inherited from NSObject - readonly card: STPCard; + static requiredFields(): NSArray; - readonly created: Date; + readonly bankAccount: STPBankAccount; - readonly livemode: boolean; + readonly card: STPCard; - readonly tokenId: string; + readonly created: Date; - readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable + readonly livemode: boolean; - readonly debugDescription: string; // inherited from NSObjectProtocol + readonly tokenId: string; - readonly description: string; // inherited from NSObjectProtocol + readonly allResponseFields: NSDictionary; // inherited from STPAPIResponseDecodable - readonly hash: number; // inherited from NSObjectProtocol + readonly debugDescription: string; // inherited from NSObjectProtocol - readonly isProxy: boolean; // inherited from NSObjectProtocol + readonly description: string; // inherited from NSObjectProtocol - readonly stripeID: string; // inherited from STPSource + readonly hash: number; // inherited from NSObjectProtocol - readonly superclass: typeof NSObject; // inherited from NSObjectProtocol + readonly isProxy: boolean; // inherited from NSObjectProtocol - readonly // inherited from NSObjectProtocol + readonly stripeID: string; // inherited from STPSourceProtocol - class(): typeof NSObject; + readonly superclass: typeof NSObject; // inherited from NSObjectProtocol - conformsToProtocol(aProtocol: any /* Protocol */): boolean; + readonly // inherited from NSObjectProtocol - isEqual(object: any): boolean; + class(): typeof NSObject; - isKindOfClass(aClass: typeof NSObject): boolean; + conformsToProtocol(aProtocol: any /* Protocol */): boolean; - isMemberOfClass(aClass: typeof NSObject): boolean; + isEqual(object: any): boolean; - performSelector(aSelector: string): any; + isKindOfClass(aClass: typeof NSObject): boolean; - performSelectorWithObject(aSelector: string, object: any): any; + isMemberOfClass(aClass: typeof NSObject): boolean; - performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; + performSelector(aSelector: string): any; - respondsToSelector(aSelector: string): boolean; + performSelectorWithObject(aSelector: string, object: any): any; - retainCount(): number; + performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any; - self(): this; -} + respondsToSelector(aSelector: string): boolean; -declare class STPUserInformation extends NSObject { + retainCount(): number; - static alloc(): STPUserInformation; // inherited from NSObject + self(): this; + } - static new(): STPUserInformation; // inherited from NSObject + declare class STPUserInformation extends NSObject implements NSCopying { - email: string; + static alloc(): STPUserInformation; // inherited from NSObject - phone: string; -} + static new(): STPUserInformation; // inherited from NSObject -declare class Stripe extends NSObject { + billingAddress: STPAddress; - static alloc(): Stripe; // inherited from NSObject + shippingAddress: STPAddress; - static canSubmitPaymentRequest(paymentRequest: PKPaymentRequest): boolean; + copyWithZone(zone: interop.Pointer | interop.Reference): any; + } - static createTokenWithBankAccountCompletion(bankAccount: STPBankAccount, handler: (p1: STPToken, p2: NSError) => void): void; + declare class Stripe extends NSObject { - static createTokenWithBankAccountPublishableKeyCompletion(bankAccount: STPBankAccount, publishableKey: string, handler: (p1: STPToken, p2: NSError) => void): void; + static alloc(): Stripe; // inherited from NSObject - static createTokenWithCardCompletion(card: STPCard, handler: (p1: STPToken, p2: NSError) => void): void; + static canSubmitPaymentRequest(paymentRequest: PKPaymentRequest): boolean; - static createTokenWithCardPublishableKeyCompletion(card: STPCard, publishableKey: string, handler: (p1: STPToken, p2: NSError) => void): void; + static defaultPublishableKey(): string; - static createTokenWithPaymentCompletion(payment: PKPayment, handler: (p1: STPToken, p2: NSError) => void): void; + static deviceSupportsApplePay(): boolean; - static defaultPublishableKey(): string; + static handleStripeURLCallbackWithURL(url: NSURL): boolean; - static deviceSupportsApplePay(): boolean; + static new(): Stripe; // inherited from NSObject - static disableAnalytics(): void; + static paymentRequestWithMerchantIdentifier(merchantIdentifier: string): PKPaymentRequest; - static new(): Stripe; // inherited from NSObject + static paymentRequestWithMerchantIdentifierCountryCurrency(merchantIdentifier: string, countryCode: string, currencyCode: string): PKPaymentRequest; - static paymentRequestWithMerchantIdentifier(merchantIdentifier: string): PKPaymentRequest; + static setDefaultPublishableKey(publishableKey: string): void; + } - static setDefaultPublishableKey(publishableKey: string): void; -} + declare var StripeDomain: string; -declare var StripeDomain: string; + declare var StripeVersionNumber: number; -declare var StripeVersionNumber: number; + declare var StripeVersionString: interop.Reference; -declare var StripeVersionString: interop.Reference; + declare function linkNSErrorCategory(): void; -declare function linkSTPAPIClientApplePayCategory(): void; + declare function linkSTPAPIClientApplePayCategory(): void; -declare function linkUINavigationBarThemeCategory(): void; + declare function linkUINavigationBarThemeCategory(): void; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..775fb57 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,129 @@ +{ + "name": "nativescript-stripe", + "version": "3.2.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@angular/common": { + "version": "https://registry.npmjs.org/@angular/common/-/common-4.4.6.tgz", + "integrity": "sha1-S4FCByTggooOg5uVpV6xp+g5GPI=", + "dev": true, + "requires": { + "tslib": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz" + } + }, + "@angular/compiler": { + "version": "https://registry.npmjs.org/@angular/compiler/-/compiler-4.4.6.tgz", + "integrity": "sha1-LuH68lt1fh0SiXkHS+f65SmzvCA=", + "dev": true, + "requires": { + "tslib": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz" + } + }, + "@angular/core": { + "version": "https://registry.npmjs.org/@angular/core/-/core-4.4.6.tgz", + "integrity": "sha1-EwMf0Q3P5DiHVBmzjyESCVi8I1Q=", + "dev": true, + "requires": { + "tslib": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz" + } + }, + "@angular/forms": { + "version": "https://registry.npmjs.org/@angular/forms/-/forms-4.4.6.tgz", + "integrity": "sha1-/mSs5CQ1wbgPSQNLfEHOjK8UpEo=", + "dev": true, + "requires": { + "tslib": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz" + } + }, + "@angular/http": { + "version": "https://registry.npmjs.org/@angular/http/-/http-4.4.6.tgz", + "integrity": "sha1-CvaAxnEL3AJtlA4iXP0PalwAXQw=", + "dev": true, + "requires": { + "tslib": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz" + } + }, + "@angular/platform-browser": { + "version": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-4.4.6.tgz", + "integrity": "sha1-qYOcVH4bZU+h0kqJeAyLpquNzOA=", + "dev": true, + "requires": { + "tslib": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz" + } + }, + "@angular/router": { + "version": "https://registry.npmjs.org/@angular/router/-/router-4.4.6.tgz", + "integrity": "sha1-D2rSmuD/jSyeo3m9MgRHIXt+yGY=", + "dev": true, + "requires": { + "tslib": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz" + } + }, + "nativescript-angular": { + "version": "https://registry.npmjs.org/nativescript-angular/-/nativescript-angular-4.4.1.tgz", + "integrity": "sha1-eCRonQwtxoKL+xclmBqh9tlCCas=", + "dev": true, + "requires": { + "nativescript-intl": "https://registry.npmjs.org/nativescript-intl/-/nativescript-intl-3.0.0.tgz", + "reflect-metadata": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.10.tgz" + } + }, + "nativescript-intl": { + "version": "https://registry.npmjs.org/nativescript-intl/-/nativescript-intl-3.0.0.tgz", + "integrity": "sha1-gu6b59N3Fys8QpVzRyMDdijhhqc=", + "dev": true + }, + "reflect-metadata": { + "version": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.10.tgz", + "integrity": "sha1-tPg3BEFqytiZiMmxVjXUfgO5NEo=", + "dev": true + }, + "rxjs": { + "version": "https://registry.npmjs.org/rxjs/-/rxjs-5.0.3.tgz", + "integrity": "sha1-/IvfRk6/k4gSdI5BlniPOS/vl1Q=", + "dev": true, + "requires": { + "symbol-observable": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz" + } + }, + "symbol-observable": { + "version": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz", + "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=", + "dev": true + }, + "tns-core-modules": { + "version": "https://registry.npmjs.org/tns-core-modules/-/tns-core-modules-3.2.0.tgz", + "integrity": "sha1-v0cYlbc8teVUnETyU0Hff100+cI=", + "dev": true, + "requires": { + "tns-core-modules-widgets": "https://registry.npmjs.org/tns-core-modules-widgets/-/tns-core-modules-widgets-3.2.0.tgz" + } + }, + "tns-core-modules-widgets": { + "version": "https://registry.npmjs.org/tns-core-modules-widgets/-/tns-core-modules-widgets-3.2.0.tgz", + "integrity": "sha1-bTIK6dHhyudsdEPEpfrqvtsAR3M=", + "dev": true + }, + "tns-platform-declarations": { + "version": "https://registry.npmjs.org/tns-platform-declarations/-/tns-platform-declarations-3.2.0.tgz", + "integrity": "sha1-YDjU5mOsV+zF9g9s0R4upTxVWYo=", + "dev": true + }, + "tslib": { + "version": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz", + "integrity": "sha1-3GBOutZLy/aW1hPabJVKoOfqHrY=", + "dev": true + }, + "typescript": { + "version": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz", + "integrity": "sha1-3z3Nw48764ANS8MiZGsEo/bKfw0=", + "dev": true + }, + "zone.js": { + "version": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.18.tgz", + "integrity": "sha1-jOyzl3/NGzCQVi/0Vw4oR+dStI0=", + "dev": true + } + } +} diff --git a/package.json b/package.json index e9647c3..d48fa63 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "nativescript-stripe", - "version": "3.0.0", + "version": "3.2.0", "description": "", "main": "stripe", "nativescript": { "platforms": { - "android": "3.0.0", - "ios": "3.0.0" + "android": "3.2.0", + "ios": "3.2.0" } }, "scripts": { @@ -41,22 +41,22 @@ "homepage": "https://github.com/triniwiz/nativescript-stripe", "readmeFilename": "README.md", "devDependencies": { - "tns-core-modules": "^3.0.0", - "tns-platform-declarations": "^3.0.0", - "typescript": "^2.2.2", - "@angular/compiler":"~4.0.0", - "@angular/core":"~4.0.0", - "@angular/common":"~4.0.0", - "@angular/platform-browser":"~4.0.0", - "@angular/forms":"~4.0.0", - "@angular/http":"~4.0.0", - "@angular/router":"~4.0.0", - "rxjs":"~5.0.0", - "zone.js":"^0.8.4", - "nativescript-angular": "^3.0.0" + "tns-core-modules": "^3.2.0", + "tns-platform-declarations": "^3.2.0", + "typescript": "^2.3.4", + "@angular/compiler": "~4.4.1", + "@angular/core": "~4.4.1", + "@angular/common": "~4.4.1", + "@angular/platform-browser": "~4.4.1", + "@angular/forms": "~4.4.1", + "@angular/http": "~4.4.1", + "@angular/router": "~4.4.1", + "rxjs": "~5.0.0", + "zone.js": "^0.8.4", + "nativescript-angular": "^4.4.1" }, "dependencies": {}, "peerDependencies": { - "tns-core-modules": "^3.0.0" + "tns-core-modules": "^3.2.0" } } diff --git a/src/ios/card-view.d.ts b/src/ios/card-view.d.ts index 9a2a3ed..cbdeea9 100644 --- a/src/ios/card-view.d.ts +++ b/src/ios/card-view.d.ts @@ -1,8 +1,9 @@ import * as common from "../card-view.common"; import { Card } from "./card"; export declare class CreditCardView extends common.CreditCardView { - private _ios; - constructor(); - readonly ios: STPPaymentCardTextField; + nativeView: STPPaymentCardTextField; + createNativeView(): Object; + initNativeView(): void; + disposeNativeView(): void; readonly card: Card; } diff --git a/src/ios/card-view.ts b/src/ios/card-view.ts index f940aba..31d2d40 100644 --- a/src/ios/card-view.ts +++ b/src/ios/card-view.ts @@ -2,25 +2,52 @@ import * as common from "../card-view.common"; import * as app from "application"; import * as frame from "tns-core-modules/ui/frame"; import { Card } from "./card"; -global.moduleMerge(common, exports); + export class CreditCardView extends common.CreditCardView { - private _ios: STPPaymentCardTextField; - constructor() { - super(); - this._ios = STPPaymentCardTextField.alloc().initWithFrame(CGRectMake(10, 10, 300, 44)); - } - get ios() { - return this._ios; - } - - get card(): Card { - try { - let valid = this._ios.cardParams.validateCardReturningError(); - return new Card(this._ios.cardParams.number, this._ios.cardParams.expMonth, this._ios.cardParams.expYear, this._ios.cardParams.cvc); - } catch (ex) { - return null; - } + nativeView: STPPaymentCardTextField; + + public createNativeView(): Object { + return STPPaymentCardTextField + .alloc() + .initWithFrame(CGRectMake(10, 10, 300, 44)); + } + + /** + * Initializes properties/listeners of the native view. + */ + initNativeView(): void { + // When nativeView is tapped we get the owning JS object through this field. + (this.nativeView).owner = this; + super.initNativeView(); + } + + /** + * Clean up references to the native view and resets nativeView to its original state. + * If you have changed nativeView in some other way except through setNative callbacks + * you have a chance here to revert it back to its original state + * so that it could be reused later. + */ + disposeNativeView(): void { + (this.nativeView).owner = null; + super.disposeNativeView(); + } + + get card(): Card { + try { + const valid = STPCardValidator.validationStateForCard( + this.nativeView.cardParams) === STPCardValidationState.Valid; + return valid ? + new Card( + this.nativeView.cardParams.number, + this.nativeView.cardParams.expMonth, + this.nativeView.cardParams.expYear, + this.nativeView.cardParams.cvc, + ) : + null; + } catch (ex) { + return null; } + } } \ No newline at end of file