Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Javad Zobeidi committed Jul 10, 2019
0 parents commit 53867e7
Show file tree
Hide file tree
Showing 102 changed files with 6,132 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
.dart_tool/

.packages
.pub/

build/
4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/Flutter_Plugins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/Flutter_for_Android.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/runConfigurations/example_lib_main_dart.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

519 changes: 519 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b
channel: stable

project_type: plugin
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
103 changes: 103 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# cafebazaar_flutter

CafeBazaar In-App Billing Plugin for flutter

This plugin is just for Android applications

## Getting Started

Import this line in Flutter pubspec
```dart
cafebazaar_flutter: <Last Version>
```

Updating Your Application's Manifest
Adding the com.farsitel.bazaar.permission.PAY_THROUGH_BAZAAR permission to your AndroidManifest.xml file
```dart
<uses-permission android:name="com.farsitel.bazaar.permission.PAY_THROUGH_BAZAAR" />
```

To Use CafeBazzar plugin import below code to your class(your payment class)
```dart
import 'package:cafebazaar_flutter/cafebazaar_flutter.dart';
```

All method be static and don't need to initialize any class


To show application page in cafeBazaar use this code(نمایش صفحه نرم افزار در کافه بازار)
```dart
CafebazaarFlutter.showProgramPage("packageName") // Replace "package Name" with Your application Package Name. you can find package name on gradle file
```

To show comment and privilege in cafeBazaar use this code(ثبت نظر و امتیاز به برنامه)
```dart
CafebazaarFlutter.setComment("packageName") // Replace "package Name" with Your application Package Name. you can find package name on gradle file
```

To show Developer page in cafeBazaar use this code(نمایش صفحه برنامه نویس در کافه بازار)
```dart
CafebazaarFlutter.showDeveloperPage("developerId") // Replace "developerId" with Your developerId in CafeBazaar
```

To show CafeBazaar Login Page page in cafeBazaar use this code(ارجا کاربر به صفحه لاگین کافه بازار)
```dart
CafebazaarFlutter.showCafebazzarLogin()
```


For use In-app purchases on your application use below code
جهت استفاده از پرداخت درون برنامه ای به صورت زیر عملکنید.

First of all initialize payment and ras Key in `initState`
use async and await
```dart
await CafebazaarFlutter.initPay(rsaKey:"Your RSA Key From CafeBazaar");
```



To start a purchase request from your app, call the `launchPurchaseFlow` method on the In-app Billing plugin
```dart
Map<String,dynamic> result = await CafebazaarFlutter.launchPurchaseFlow(
sku: "wm2", consumption: false);
// after pay you get some data from Cafebazaar, if you get response code -1005 the payment is canceled by the user and if get code 0 the payment is Success
```
sku : your product id on CafeBazaar
consumption : if your product is not a subscriber type you must consume it, For product consumption, set the consumption to true
consumption : زمانی که محصول شما از نوع اشتراکی نباشد و از نوع مصرفی می باشد باید ان را مصرف کنید تا در خرید ها بعدی کاربر بتواند ان را خریداری کند بجت مصرف یک محصول consumption را به صورت true تنظیم کنید
payload : The `developerPayload` String is used to specify any additional arguments that you want Bazaar to send back along with the purchase information.





To get Purchase details use below code
```dart
Map<String,dynamic> result = CafebazaarFlutter.showCafebazzarLogin(sku:"your product sku") // you can find sku(product id) in your application in-app section
// you get the payment details if you consumption the product result is null
```
Result
```dart
'{
"orderId":"12999763169054705758.1371079406387615",
"packageName":"com.example.app",
"productId":"exampleSku",
"purchaseTime":1345678900000,
"purchaseState":0,
"developerPayload":"bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ",
"purchaseToken":"rojeslcdyyiapnqcynkjyyjh"
}'
````
Security Recommendation: When you send a purchase request, create a String token that uniquely identifies this purchase request and include this token in the developerPayload.You can use a randomly generated string as the token. When you receive the purchase response from Bazaar, make sure to check the returned data signature, the orderId, and the developerPayload String. For added security, you should perform the checking on your own secure server. Make sure to verify that the orderId is a unique value that you have not previously processed, and the developerPayload String matches the token that you sent previously with the purchase request.
```dart
bool result = await CafebazaarFlutter.verifyDeveloperPayload("your developerPayload");
```

8 changes: 8 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
34 changes: 34 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
group 'ir.javadzobeidi.cafebazaar_flutter'
version '1.0-SNAPSHOT'

buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
}
Loading

0 comments on commit 53867e7

Please sign in to comment.