cordova-sumup-plugin
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -7,3 +7,3 @@ { | ||
"module": "./www/sumup.js", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"homepage": "https://github.com/mariusbackes/cordova-plugin-sumup", | ||
@@ -10,0 +10,0 @@ "repository": { |
@@ -33,12 +33,24 @@ # Cordova plugin for SumUp SDK | ||
You can use this plugin in every JavaScript (ES 2015) or TypeScript application. | ||
Just import the plugin: | ||
Get global access to the plugin methods with the keyword **SumUp**. | ||
`import * as SumUp from 'cordova-sumup-plugin';` | ||
#### Ionic Native | ||
A wrapper for Ionic Native will be available soon! | ||
### Methods | ||
If you get access to the plugin with plain JavaScript by using **SumUp** the plugin will return | ||
a success and an error callback. Example: | ||
```js | ||
SumUp.methodName([parameter], function(success) { | ||
console.log(success); | ||
}, function(error) { | ||
console.log(error); | ||
}) | ||
``` | ||
#### Login | ||
`SumUp.login(accessToken?: string): Promise<SumUpResponse>` | ||
`SumUp.login(accessToken?: string)` | ||
@@ -54,3 +66,3 @@ User will be logged in, in his SumUp account. The parameter **accessToken** is optional. | ||
`SumUp.auth(accessToken: string): Promise<SumUpResponse>` | ||
`SumUp.auth(accessToken: string)` | ||
@@ -62,3 +74,3 @@ Authenticates the account with the given access token. | ||
`SumUp.getSettings(): Promise<SumUpResponse>` | ||
`SumUp.getSettings()` | ||
@@ -69,3 +81,3 @@ Opens a new window with the all account settings of an logged in user. | ||
`SumUp.logout(): Promise<SumUpResponse>` | ||
`SumUp.logout()` | ||
@@ -76,3 +88,3 @@ Logout a user from the account. | ||
`SumUp.isLoggedIn(): Promise<SumUpLoginStatus>` | ||
`SumUp.isLoggedIn()` | ||
@@ -83,3 +95,3 @@ Checks whether the user is logged in or not and returns an object with the field **isLoggedIn** which is a boolean value. | ||
`SumUp.prepare(): Promise<SumUpResponse>` | ||
`SumUp.prepare()` | ||
@@ -91,3 +103,3 @@ Prepares the terminal for a payment. Checks whether the CardReader is ready to tramsmit | ||
`SumUp.closeConnection(): Promise<SumUpResponse>` | ||
`SumUp.closeConnection()` | ||
@@ -98,3 +110,3 @@ Tries to close the connection to the card terminal. | ||
`SumUp.pay(amount: number, currencycode: string): Promise<SumUpPayment>` | ||
`SumUp.pay(amount: number, currencycode: string)` | ||
@@ -264,1 +276,7 @@ Opens a native SumUp window to proceed a payment. | ||
id from your config.xml | ||
## Changelog | ||
- 1.0.2: Bugfix on successful payment response | ||
- 1.0.1: Bugfix on CardReader transmission state. | ||
- 1.0.0: Initial version support for Android. |
@@ -33,5 +33,4 @@ declare module "cordova-sumup-plugin" { | ||
* @param {string} [accessToken] | ||
* @returns {Promise<SumUpResponse>} | ||
*/ | ||
export function login(accessToken?: string): Promise<SumUpResponse>; | ||
export function login(accessToken?: string): void; | ||
@@ -42,5 +41,4 @@ /** | ||
* @param {string} [accessToken] | ||
* @returns {Promise<SumUpResponse>} | ||
*/ | ||
export function auth(accessToken: string): Promise<SumUpResponse>; | ||
export function auth(accessToken: string): void; | ||
@@ -51,5 +49,4 @@ /** | ||
* @export | ||
* @returns {Promise<SumUpResponse>} | ||
*/ | ||
export function getSettings(): Promise<SumUpResponse>; | ||
export function getSettings(): void; | ||
@@ -60,5 +57,4 @@ /** | ||
* @export | ||
* @returns {Promise<SumUpResponse>} | ||
*/ | ||
export function logout(): Promise<SumUpResponse>; | ||
export function logout(): void; | ||
@@ -69,5 +65,4 @@ /** | ||
* @export | ||
* @returns {Promise<SumUpLoginStatus>} | ||
*/ | ||
export function isLoggedIn(): Promise<SumUpLoginStatus>; | ||
export function isLoggedIn(): void; | ||
@@ -79,5 +74,4 @@ /** | ||
* @export | ||
* @returns {Promise<void>} | ||
*/ | ||
export function prepare(): Promise<SumUpResponse>; | ||
export function prepare(): void; | ||
@@ -88,5 +82,4 @@ /** | ||
* @export | ||
* @returns {Promise<void>} | ||
*/ | ||
export function closeConnection(): Promise<SumUpResponse>; | ||
export function closeConnection(): void; | ||
@@ -99,8 +92,4 @@ /** | ||
* @param {string} currencycode | ||
* @returns {Promise<SumUpPayment>} If the payment is successful | ||
*/ | ||
export function pay( | ||
amount: number, | ||
currencycode: string | ||
): Promise<SumUpPayment>; | ||
export function pay(amount: number, currencycode: string): void; | ||
} |
const CLASS = "SumUp"; | ||
module.exports = { | ||
login: accessToken => { | ||
return new Promise((resolve, reject) => | ||
cordova.exec( | ||
resolve, | ||
reject, | ||
CLASS, | ||
"login", | ||
accessToken ? [accessToken] : [] | ||
) | ||
login: (accessToken, success, failure) => { | ||
cordova.exec( | ||
success, | ||
failure, | ||
CLASS, | ||
"login", | ||
accessToken ? [accessToken] : [] | ||
); | ||
}, | ||
auth: accessToken => { | ||
return new Promise((resolve, reject) => | ||
cordova.exec( | ||
resolve, | ||
reject, | ||
CLASS, | ||
"auth", | ||
accessToken ? [accessToken] : [] | ||
) | ||
auth: (accessToken, success, failure) => { | ||
cordova.exec( | ||
success, | ||
failure, | ||
CLASS, | ||
"auth", | ||
accessToken ? [accessToken] : [] | ||
); | ||
}, | ||
getSettings: () => { | ||
return new Promise((resolve, reject) => | ||
cordova.exec(resolve, reject, CLASS, "getSettings", []) | ||
); | ||
getSettings: (success, failure) => { | ||
cordova.exec(success, failure, CLASS, "getSettings", []); | ||
}, | ||
logout: () => { | ||
return new Promise((resolve, reject) => | ||
cordova.exec(resolve, reject, "SumUp", "logout", []) | ||
); | ||
logout: (success, failure) => { | ||
cordova.exec(success, failure, CLASS, "logout", []); | ||
}, | ||
isLoggedIn: () => { | ||
return new Promise((resolve, reject) => | ||
cordova.exec(resolve, reject, CLASS, "isLoggedIn", []) | ||
); | ||
isLoggedIn: (success, failure) => { | ||
cordova.exec(success, failure, CLASS, "isLoggedIn", []); | ||
}, | ||
prepare: () => { | ||
return new Promise((resolve, reject) => | ||
cordova.exec(resolve, reject, CLASS, "prepare", []) | ||
); | ||
prepare: (success, failure) => { | ||
cordova.exec(success, failure, CLASS, "prepare", []); | ||
}, | ||
closeConnection: () => { | ||
return new Promise((resolve, reject) => | ||
cordova.exec(resolve, reject, CLASS, "closeConnection", []) | ||
); | ||
closeConnection: (success, failure) => { | ||
cordova.exec(success, failure, CLASS, "closeConnection", []); | ||
}, | ||
pay: (amount, currencycode) => { | ||
return new Promise((resolve, reject) => | ||
cordova.exec(resolve, reject, CLASS, "pay", [amount, currencycode]) | ||
); | ||
pay: (amount, currencycode, success, failure) => { | ||
cordova.exec(success, failure, CLASS, "pay", [amount, currencycode]); | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
162399
39
673
274
1
1