diff --git a/Android/PayPalPlugin/AndroidManifest.xml b/Android/PayPalPlugin/AndroidManifest.xml index 9ed944d..00d406a 100644 --- a/Android/PayPalPlugin/AndroidManifest.xml +++ b/Android/PayPalPlugin/AndroidManifest.xml @@ -1,28 +1,41 @@ - - - + - - - + - - - - - - - - - - - - + + + + + + - + + + + + + + + + + + + \ No newline at end of file diff --git a/Android/PayPalPlugin/LICENSE b/Android/PayPalPlugin/LICENSE index 4a77837..3925c9a 100644 --- a/Android/PayPalPlugin/LICENSE +++ b/Android/PayPalPlugin/LICENSE @@ -3,6 +3,7 @@ The MIT License Copyright (C) 2011 Mobile Developer Solutions Copyright (C) 2011, Appception, Inc. +Copyright (C) 2012, Bucka IT, Tomaz Kregar s.p. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Android/PayPalPlugin/README.md b/Android/PayPalPlugin/README.md index 72ddb62..be134a2 100644 --- a/Android/PayPalPlugin/README.md +++ b/Android/PayPalPlugin/README.md @@ -1,19 +1,20 @@ # PhoneGap PayPal-Plugin # -by Paul Beusterien, Mobile Developer Solutions and Carl Stehle, Appception Inc. +by Paul Beusterien, Mobile Developer Solutions, Carl Stehle, Appception Inc. and Tomaz Kregar, Bucka IT ## Adding the Plugin to your project ## -Using this plugin requires Android PhoneGap and the PayPal Mobile Payments Library. The PayPal Mobile Payments Library can be downloaded [here](https://www.x.com/community/ppx/xspaces/mobile/mep). +Using this plugin requires Android Cordova (PhoneGap) and the PayPal Mobile Payments Library. The PayPal Mobile Payments Library can be downloaded [here](https://www.x.com/community/ppx/xspaces/mobile/mep). -1. Create an Android PhoneGap project. Details at http://www.mobiledevelopersolutions.com/home/start +1. Create an Android Cordova project. Details at http://docs.phonegap.com/en/2.0.0/guide_getting-started_android_index.md.html 2. Put PayPal_MPL.jar into your project's libs directory and add it to the build path. In Eclipse, right click on PayPal_MPL.jar and select Add to Build Path. 3. Copy assets/www/ files into your project's assets/www/ directory 4. Copy src/com/phonegap/plugin/ files into your project's src/com/phonegap/plugin/ directory 5. Make sure your AndroidManifest.xml includes a superset of the permissions shown in the reference AndroidManifest.xml 6. Add the com.paypal.android.MEP.PayPalActivity as shown in the reference AndroidManifest.xml -7. Make sure the phonegap.{version}.js filename in index.html matches the filename in your www directory. -8. Deploy and test the app. The default environment is ENV_NONE. +7. Include the plugin registration in /res/xml/config.xml as shown in the reference config.xml +8. Make sure the cordova.{version}.js filename in index.html matches the filename in your www directory. +9. Deploy and test the app. The default environment is ENV_NONE. ## Using the PayPal Sandbox ## @@ -24,7 +25,10 @@ Using this plugin requires Android PhoneGap and the PayPal Mobile Payments Libra ## RELEASE NOTES ## -### 201100618 ### +### 20120829 ### +* Added suppport for Cordova 2.0.0 + +### 20110618 ### * Initial release * By default the PayPalPlugin-Host runs in ENV_NONE (offline) with a dummy PayPal ID. Change to ENV_SANDBOX or ENV_LIVE * Only tested with ENV_NONE and ENV_SANDBOX diff --git a/Android/PayPalPlugin/assets/www/index.html b/Android/PayPalPlugin/assets/www/index.html index e7a51b7..08290dc 100644 --- a/Android/PayPalPlugin/assets/www/index.html +++ b/Android/PayPalPlugin/assets/www/index.html @@ -1,7 +1,7 @@ - + diff --git a/Android/PayPalPlugin/assets/www/paypal.js b/Android/PayPalPlugin/assets/www/paypal.js index ef6367d..da333ee 100644 --- a/Android/PayPalPlugin/assets/www/paypal.js +++ b/Android/PayPalPlugin/assets/www/paypal.js @@ -2,13 +2,13 @@ * * Copyright (C) 2011, Appception, Inc.. All Rights Reserved. * Copyright (C) 2011, Mobile Developer Solutions All Rights Reserved. +* Copyright (C) 2012, Bucka IT, Tomaz Kregar s.p. All Rights Reserved. */ /* * @return Instance of PayPal */ -var PayPal = function() { -}; +var PayPal = function() {}; /** * @param directory @@ -29,7 +29,7 @@ var fail = function(e) { PayPal.prototype.invoke = function(callee, arg, successFunction) { var succ = successFunction ? successFunction : genericSuccess; - return PhoneGap.exec(succ, + return cordova.exec(succ, fail, 'PayPalPlugin', // Telling PhoneGap that we want to run "PayPal Plugin" callee, // Telling the plugin, which action we want to perform @@ -38,34 +38,40 @@ PayPal.prototype.invoke = function(callee, arg, successFunction) { /** * */ -PhoneGap.addConstructor(function() { - // Register the javascript plugin with PhoneGap - PhoneGap.addPlugin('PayPal', new PayPal()); - // Register the native class of plugin with PhoneGap - PluginManager.addService("PayPalPlugin", "com.phonegap.plugin.PayPalPlugin"); -}); +if(cordova.addPlugin) { //versions before 2.0.0 + cordova.addConstructor(function() { + // Register the javascript plugin with PhoneGap + cordova.addPlugin('PayPal', new PayPal()); + }); +} else { + // Creating the native object of plugin + if(!window.plugins) + window.plugins = {}; + if (!window.plugins.PayPal) + window.plugins.PayPal = new PayPal(); +} var mpl = { - construct : function(str) { - window.plugins.PayPal.invoke('construct', str); - }, - prepare : function(ptype) { - window.plugins.PayPal.invoke('prepare', ptype); - }, - getStatus : function() { - return window.plugins.PayPal.invoke('getStatus', null, getStatusCallback); - }, - setPaymentInfo : function(arg) { - window.plugins.PayPal.invoke('setPaymentInfo', arg); - }, - payButton : function(btype) { - window.plugins.PayPal.invoke('pay', btype); - } + construct : function(str) { + window.plugins.PayPal.invoke('construct', str); + }, + prepare : function(ptype) { + window.plugins.PayPal.invoke('prepare', ptype); + }, + getStatus : function() { + return window.plugins.PayPal.invoke('getStatus', null, getStatusCallback); + }, + setPaymentInfo : function(arg) { + window.plugins.PayPal.invoke('setPaymentInfo', arg); + }, + payButton : function(btype) { + window.plugins.PayPal.invoke('pay', btype); + } }; /* diff --git a/Android/PayPalPlugin/res/xml/config.xml b/Android/PayPalPlugin/res/xml/config.xml new file mode 100644 index 0000000..61b91bb --- /dev/null +++ b/Android/PayPalPlugin/res/xml/config.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +