├── sample ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── io │ │ │ └── octo │ │ │ └── bear │ │ │ └── sample │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── io │ │ │ └── octo │ │ │ └── bear │ │ │ └── sample │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── io │ │ └── octo │ │ └── bear │ │ └── sample │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── library ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── id.xml │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── io │ │ │ │ └── octo │ │ │ │ └── bear │ │ │ │ └── pago │ │ │ │ ├── model │ │ │ │ ├── entity │ │ │ │ │ ├── PurchaseType.java │ │ │ │ │ ├── Sku.java │ │ │ │ │ ├── Order.java │ │ │ │ │ ├── Inventory.java │ │ │ │ │ ├── ResponseCode.java │ │ │ │ │ └── Purchase.java │ │ │ │ └── exception │ │ │ │ │ └── BillingException.java │ │ │ │ ├── BillingServiceUtils.java │ │ │ │ ├── ConsumePurchaseCompletable.java │ │ │ │ ├── BillingAvailabilitySingle.java │ │ │ │ ├── BillingActivity.java │ │ │ │ ├── ProductDetailsSingle.java │ │ │ │ ├── BillingServiceConnection.java │ │ │ │ ├── PurchasedItemsSingle.java │ │ │ │ ├── PerformPurchaseSingle.java │ │ │ │ └── Pago.java │ │ └── aidl │ │ │ └── com │ │ │ └── android │ │ │ └── vending │ │ │ └── billing │ │ │ └── IInAppBillingService.aidl │ └── test │ │ └── java │ │ └── io │ │ └── octo │ │ └── bear │ │ └── pago │ │ ├── BundleMatcher.java │ │ ├── BasePagoTest.java │ │ ├── BillingServiceTestingUtils.java │ │ ├── PagoErrorsTest.java │ │ ├── ShadowFaultyIInAppBillingServiceStub.java │ │ ├── PagoExpectedBehaviorTest.java │ │ └── ShadowIInAppBillingServiceStub.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .travis.yml ├── README.md ├── gradlew.bat ├── gradlew └── LICENSE /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':library' 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/* 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Pago 3 | 4 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Pago 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vasyafromrussia/pago/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /library/src/main/res/values/id.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vasyafromrussia/pago/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vasyafromrussia/pago/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vasyafromrussia/pago/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vasyafromrussia/pago/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vasyafromrussia/pago/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Nov 27 01:46:45 MSK 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-bin.zip 7 | -------------------------------------------------------------------------------- /sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /sample/src/test/java/io/octo/bear/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package io.octo.bear.sample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/shc/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/shc/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/src/androidTest/java/io/octo/bear/sample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package io.octo.bear.sample; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("io.octo.bear.pago", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /library/src/main/java/io/octo/bear/pago/model/entity/PurchaseType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Vasily Styagov. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.octo.bear.pago.model.entity; 18 | 19 | /** 20 | * Created by shc on 14.07.16. 21 | */ 22 | 23 | public enum PurchaseType { 24 | 25 | INAPP("inapp"), 26 | SUBSCRIPTION("subs"); 27 | 28 | public String value; 29 | 30 | PurchaseType(String value) { 31 | this.value = value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /library/src/main/java/io/octo/bear/pago/model/entity/Sku.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Vasily Styagov. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.octo.bear.pago.model.entity; 18 | 19 | /** 20 | * Created by shc on 14.07.16. 21 | */ 22 | 23 | public class Sku { 24 | 25 | public final String productId; 26 | public final String price; 27 | 28 | public Sku(String productId, String price) { 29 | this.productId = productId; 30 | this.price = price; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /library/src/main/java/io/octo/bear/pago/model/entity/Order.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Vasily Styagov. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.octo.bear.pago.model.entity; 18 | 19 | /** 20 | * Created by shc on 19.07.16. 21 | */ 22 | public class Order { 23 | 24 | public final Purchase purchase; 25 | public final String signature; 26 | public final String originalJson; 27 | 28 | public Order(Purchase purchase, String signature, String originalJson) { 29 | this.purchase = purchase; 30 | this.signature = signature; 31 | this.originalJson = originalJson; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | android: 4 | components: 5 | - tools 6 | - build-tools-25.0.1 7 | - android-25 8 | - extra-google-google_play_services 9 | - extra-google-m2repository 10 | - extra-android-m2repository 11 | - platform-tools 12 | 13 | notifications: 14 | email: false 15 | 16 | script: 17 | - jdk_switcher use oraclejdk8 18 | - export GRADLE_OPTS="-Xmx1536m -Xms768m -Xss32m" 19 | - ./gradlew clean build 20 | 21 | before_cache: 22 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 23 | 24 | cache: 25 | directories: 26 | - $HOME/.gradle/caches/ 27 | - $HOME/.gradle/wrapper/ 28 | 29 | before_script: 30 | - sudo service postgresql stop || true 31 | - sudo service mysql stop || true 32 | - sudo service memcached stop || true 33 | - sudo service bootlogd stop || true 34 | - sudo service elasticsearch stop || true 35 | - sudo service mongodb stop || true 36 | - sudo service neo4j stop || true 37 | - sudo service cassandra stop || true 38 | - sudo service riak stop || true 39 | - sudo service rsync stop || true 40 | - sudo service x11-common stop || true 41 | -------------------------------------------------------------------------------- /library/src/main/java/io/octo/bear/pago/model/entity/Inventory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Vasily Styagov. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.octo.bear.pago.model.entity; 18 | 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | /** 23 | * Created by shc on 20.07.16. 24 | */ 25 | 26 | public class Inventory { 27 | 28 | private final Map items; 29 | 30 | public Inventory() { 31 | items = new HashMap<>(); 32 | } 33 | 34 | public void addItem(final Sku sku) { 35 | items.put(sku.productId, sku); 36 | } 37 | 38 | public Sku getSku(final String productId) { 39 | return items.get(productId); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 |