@dicty/payment 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Package.swift +28 -0
- package/README.md +36 -4
- package/ios/Tests/PaymentPluginTests/PaymentPluginTests.swift +15 -0
- package/package.json +9 -17
package/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "DictyPayment",
|
|
6
|
+
platforms: [.iOS(.v14)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "DictyPayment",
|
|
10
|
+
targets: ["PaymentPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "PaymentPlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/PaymentPlugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "PaymentPluginTests",
|
|
25
|
+
dependencies: ["PaymentPlugin"],
|
|
26
|
+
path: "ios/Tests/PaymentPluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/README.md
CHANGED
|
@@ -1,14 +1,46 @@
|
|
|
1
|
-
# @dicty/
|
|
1
|
+
# @dicty/payment
|
|
2
2
|
|
|
3
|
-
Dicty
|
|
3
|
+
Dicty Payment Plugin for Capacitor apps
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`@dicty/payment` bridges Capacitor projects to native Apple in-app purchases and Google Pay flows. It ships with TypeScript definitions, a React context provider, and native shims for iOS, Android, and the web fallback.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
|
-
npm install @dicty/
|
|
12
|
+
npm install @dicty/payment
|
|
9
13
|
npx cap sync
|
|
10
14
|
```
|
|
11
15
|
|
|
16
|
+
After syncing, open Android Studio/Xcode to let Gradle/CocoaPods refresh native dependencies.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Payment } from '@dicty/payment';
|
|
22
|
+
|
|
23
|
+
const available = await Payment.isAppleInAppPurchaseAvailable();
|
|
24
|
+
if (available) {
|
|
25
|
+
const { products } = await Payment.getAppleInAppPurchaseProducts({ id: ['premium_monthly'] });
|
|
26
|
+
await Payment.buyAppleInAppPurchase({ id: products[0].id });
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
For React apps, wrap your tree with the provider:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { PaymentPluginProvider } from '@dicty/payment/react';
|
|
34
|
+
|
|
35
|
+
<PaymentPluginProvider>{children}</PaymentPluginProvider>;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Development
|
|
39
|
+
|
|
40
|
+
- `npm run build` cleans, regenerates docs, compiles TypeScript, and bundles output via Rollup.
|
|
41
|
+
- `npm run verify` runs iOS, Android, and web checks; execute before publishing changes.
|
|
42
|
+
- `npm run fmt` formats TypeScript, Java, and Swift sources; `npm run lint` performs the read-only equivalent.
|
|
43
|
+
|
|
12
44
|
## API
|
|
13
45
|
|
|
14
46
|
<docgen-index>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import PaymentPlugin
|
|
3
|
+
|
|
4
|
+
class PaymentTests: XCTestCase {
|
|
5
|
+
func testEcho() {
|
|
6
|
+
// This is an example of a functional test case for a plugin.
|
|
7
|
+
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
8
|
+
|
|
9
|
+
let implementation = Payment()
|
|
10
|
+
let value = "Hello, World!"
|
|
11
|
+
let result = implementation.echo(value)
|
|
12
|
+
|
|
13
|
+
XCTAssertEqual(value, result)
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicty/payment",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Dicty
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "Dicty Payment plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin.cjs.js",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
@@ -11,28 +11,19 @@
|
|
|
11
11
|
"android/src/main/",
|
|
12
12
|
"android/build.gradle",
|
|
13
13
|
"dist/",
|
|
14
|
-
"ios/Sources
|
|
14
|
+
"ios/Sources",
|
|
15
|
+
"ios/Tests",
|
|
16
|
+
"Package.swift",
|
|
15
17
|
"DictyPayment.podspec"
|
|
16
18
|
],
|
|
17
19
|
"author": "Dicty",
|
|
18
20
|
"license": "MIT",
|
|
19
21
|
"repository": {
|
|
20
22
|
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/
|
|
23
|
+
"url": "git+https://github.com/dicty-app/payment.git"
|
|
22
24
|
},
|
|
23
25
|
"bugs": {
|
|
24
|
-
"url": "https://github.com/
|
|
25
|
-
},
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"type": "./dist/esm/index.d.ts",
|
|
29
|
-
"import": "./dist/esm/index.js"
|
|
30
|
-
},
|
|
31
|
-
"./react": {
|
|
32
|
-
"type": "./dist/esm/provider/react/PaymentPluginProvider.d.ts",
|
|
33
|
-
"import": "./dist/esm/provider/react/PaymentPluginProvider.js"
|
|
34
|
-
},
|
|
35
|
-
"./*": "./*"
|
|
26
|
+
"url": "https://github.com/dicty-app/payment/issues"
|
|
36
27
|
},
|
|
37
28
|
"keywords": [
|
|
38
29
|
"capacitor",
|
|
@@ -75,9 +66,10 @@
|
|
|
75
66
|
"typescript": "^5.9.3"
|
|
76
67
|
},
|
|
77
68
|
"peerDependencies": {
|
|
78
|
-
"@capacitor/core": "
|
|
69
|
+
"@capacitor/core": ">=7.0.0",
|
|
79
70
|
"react": "^19.2.0"
|
|
80
71
|
},
|
|
72
|
+
"prettier": "@ionic/prettier-config",
|
|
81
73
|
"swiftlint": "@ionic/swiftlint-config",
|
|
82
74
|
"eslintConfig": {
|
|
83
75
|
"extends": "@ionic/eslint-config/recommended"
|