cordova-khipu 2.6.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # cordova-khipu
2
+
3
+ Cordova plugin for Khipu
4
+
5
+
6
+ ## iOS pre setup
7
+
8
+
9
+ The default deployment target of a cordova app is 11, which is too low for Khipu, please set the ios deployment target to, at least, 12.
10
+
11
+ In order to do that make sure the `config.xml` of your app to have a `platform` section for `ios` with the desired `deployment-target`.
12
+
13
+ ```xml
14
+ <platform name="ios">
15
+ <preference name="deployment-target" value="12.0" />
16
+ </platform>
17
+ ```
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ cordova plugin add cordova-khipu
23
+ ```
24
+
25
+ ## iOS setup
26
+
27
+ No need for aditional steps
28
+
29
+ ## Android setup
30
+
31
+ No need for aditional steps
32
+
33
+ ## Usage
34
+
35
+ The `cordova-khipu` plugin makes the `Khipu.startOperation` method available in the `window` object.
36
+
37
+ The first parameter is the `operationId` of the payment to authorize with all the options (datailed in the example).
38
+
39
+ The second parameter is a callback funcion that will be invoked if the authorization process completed and the third if it failed.
40
+
41
+
42
+ ```javascript
43
+
44
+ window.Khipu.startOperation({
45
+ operationId: '<paymentId>',
46
+ options: {
47
+ title: '<Title to display in the payment process>', // Title for the top bar during the payment process.
48
+ titleImageUrl: '<Image to display centered in the topbar>', // Url of the image to display in the top bar.
49
+ locale: 'es_CL', // Regional settings for the interface language. The standard format combines an ISO 639-1 language code and an ISO 3166 country code. For example, "es_CL" for Spanish (Chile).
50
+ theme: 'light', // The theme of the interface, can be 'dark', 'light' or 'system'
51
+ showFooter: true, // If true, a message is displayed at the bottom with the Khipu logo.
52
+ showMerchantLogo: true, // If true, the merchant's logo is displayed in the top bar.
53
+ showPaymentDetails: true, // If true, the payment code and a link to view the details are displayed.
54
+ skipExitPage: false, // If true, skips the exit page at the end of the payment process, whether successful or failed.
55
+ colors: {
56
+ lightTopBarContainer: '<colorHex>', // Optional background color for the top bar in light mode.
57
+ lightOnTopBarContainer: '<colorHex>', // Optional color of the elements on the top bar in light mode.
58
+ lightPrimary: '<colorHex>', // Optional primary color in light mode.
59
+ lightOnPrimary: '<colorHex>', // Optional color of elements on the primary color in light mode.
60
+ lightBackground: '<colorHex>', // Optional general background color in light mode.
61
+ lightOnBackground: '<colorHex>', // Optional color of elements on the general background in light mode.
62
+ darkTopBarContainer: '<colorHex>', // Optional background color for the top bar in dark mode.
63
+ darkOnTopBarContainer: '<colorHex>', // Optional color of the elements on the top bar in dark mode.
64
+ darkPrimary: '<colorHex>', // Optional primary color in dark mode.
65
+ darkOnPrimary: '<colorHex>', // Optional color of elements on the primary color in dark mode.
66
+ darkBackground: '<colorHex>', // Optional general background color in dark mode.
67
+ darkOnBackground: '<colorHex>', // Optional color of elements on the general background in dark mode.
68
+ }
69
+ }
70
+ },
71
+ (success) => {
72
+ console.log(JSON.stringify(success))
73
+ },
74
+ (error) => {
75
+ console.error(JSON.stringify(error))
76
+ }
77
+ )
78
+ ```
79
+
80
+ The `data` and `error` object passed to the callback functions are of the type `KhipuResult`
81
+
82
+ #### KhipuResult
83
+
84
+ | Prop | Type |
85
+ | ------------------- | ------------------------------------------------------- |
86
+ | **`operationId`** | <code>string</code> |
87
+ | **`exitTitle`** | <code>string</code> |
88
+ | **`exitMessage`** | <code>string</code> |
89
+ | **`exitUrl`** | <code>string</code> |
90
+ | **`result`** | <code>'OK' \| 'ERROR' \| 'WARNING' \| 'CONTINUE'</code> |
91
+ | **`failureReason`** | <code>string</code> |
92
+ | **`continueUrl`** | <code>string</code> |
93
+ | **`events`** | <code>KhipuEvent[]</code> |
94
+
95
+
96
+ #### KhipuEvent
97
+
98
+ | Prop | Type |
99
+ | --------------- | ------------------- |
100
+ | **`name`** | <code>string</code> |
101
+ | **`timestamp`** | <code>string</code> |
102
+ | **`type`** | <code>string</code> |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-khipu",
3
- "version": "2.6.0",
3
+ "version": "2.7.1",
4
4
  "description": "Khipu Cordova Plugin",
5
5
  "cordova": {
6
6
  "id": "cordova-khipu",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
- <plugin id="cordova-khipu" version="2.6.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <plugin id="cordova-khipu" version="2.7.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
3
3
  <name>Cordova Khipu</name>
4
4
  <js-module name="Khipu" src="www/cordova-khipu.js">
5
5
  <clobbers target="window.Khipu"/>
@@ -31,4 +31,5 @@
31
31
  <source-file src="src/ios/KhipuPlugin.swift"/>
32
32
  </platform>
33
33
  <dependency id="cordova-plugin-add-swift-support" version="2.0.2"/>
34
+ <hook type="after_prepare" src="scripts/enable-gradle-kotlin-plugin.js"/>
34
35
  </plugin>
@@ -0,0 +1,26 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ module.exports = function (context) {
5
+ const gradleConfigPath = path.join(
6
+ context.opts.projectRoot,
7
+ 'platforms',
8
+ 'android',
9
+ 'cdv-gradle-config.json'
10
+ );
11
+
12
+ if (fs.existsSync(gradleConfigPath)) {
13
+ const gradleConfig = require(gradleConfigPath);
14
+ gradleConfig.IS_GRADLE_PLUGIN_KOTLIN_ENABLED = true;
15
+
16
+ fs.writeFileSync(
17
+ gradleConfigPath,
18
+ JSON.stringify(gradleConfig, null, 4),
19
+ 'utf-8'
20
+ );
21
+
22
+ console.log('Updated cdv-gradle-config.json: IS_GRADLE_PLUGIN_KOTLIN_ENABLED = true');
23
+ } else {
24
+ console.warn('cdv-gradle-config.json not found!');
25
+ }
26
+ };