12 Commits

Author SHA1 Message Date
davidshimjs
77480d70c6 Fixed compatibility with phonegap 2.7.0
- Changed interface 'Phonegap.exec' to 'cordova.exec'
- Use paymentWithProduct instead of paymentWithProductIndentifier
because It was deprecated in iOS 5.0
- Changed interface of requestProductData parameters
- Add prefix in NSLog
2013-05-07 15:31:21 +09:00
David H
c7f577e076 Fix IAP for iOS: apply()'s "this" argument needs to be set.
When I changed the JS callbacks to use `apply()`, I left the
"this" argument set to null. This caused code in InAppPurchaseManager.prototype.updatedTransactionCallback
to fail because references to `this` become null instead
of references to the default instance of InAppPurchaseManager.

This commit modifies the apply() calls to use plugins.inAppPurchaseManager as the "this" argument.
2011-12-08 14:43:31 -08:00
David H
dc7445a878 Convert nil to NSNull so they can be stored in NSArray and NSDictionary for JSON encoding.
Also, `errorCode` must be wrapped in NSNumber so it can be stored in an NSArray.
2011-11-04 18:18:36 -07:00
David H
a2cc920877 Make InAppPurchaseManager plugin fix backward compatible with older version of PhoneGap.
The newest version of PhoneGap (or Apache Callback) has switched from using SBJson to JSONKit. If JSONKit is available, we its `JSONString` implementation, otherwise, use SBJson's `JSONRepresentation` implementation.

Also, this commit fixes callback arguments for requestProductData and updatedTransactionCallback.
2011-11-02 12:42:42 -07:00
David H
7729ad9c68 For iOS's inAppPurchaseManager, fix serialization errors in requestProductsData's callback.
Calls to requestProductsData currently fails for
the following two conditions:

1. Title or description contains single quotes
2. Invalid product IDs are returned.

Here's an example JavaScript statement generated:

    window.plugins.inAppPurchaseManager.callbackMap.b0([{
        id: 'com.acme.product.1',
        title: 'Acme's #1 Product',
        description: 'Acme's #1 Product Description.',
        price: '$4.99'
    }, ], [com.acme.product.5, com.acme.product.2, com.acme.product.4, com.acme.product.3]);

Note the single quote in the title and description
(they are not properly escaped). Also, look at the invalid product IDs returned -- they are not quoted.
2011-11-01 19:22:25 -07:00
Tim Fischbach
5e6f888109 fix typo in paymentQueue:restoreCompletedTransactionsFailedWithError: method name 2011-10-25 12:39:23 +02:00
Tim Fischbach
bc093af937 Add callback handlers for restoreCompletedTransactions of ios in app purchase.
After restoring completed transactions, the payment queue observer is
notified by a call to either
paymentQueue:restoreCompletedTransactionsFailedWithError: or
paymentQueueRestoreCompletedTransactionsFinished:.  This patch
delegates calls to these methods to callback functions on the
plugins.inAppPurchaseManager.
2011-10-24 18:17:22 +02:00
Colin Frei
19e420edbb The restored purchase doesn't list the receipt data itself, but the act of restoring generates a new transaction that lists the original-transaction-id, which is more useful than returning nothing at all. 2011-09-19 13:26:39 +02:00
Tim Fischbach
29785c54f3 Let iOS InAppPurchaseManager request product data for multiple productIds in single request.
Adds a requestProductsData method to the InAppPurchaseManager which
takes an array of productIds and invokes a single callback with the
results of the SKProductsRequest.
2011-07-08 13:07:29 +02:00
Tim Fischbach
71994f1660 Invoke callbacks from paymentQueue:updatedTransactions: via plugins.inAppPurchaseManager.
Callback mapping for requestProductData already depends on the
existence of plugins.inAppPurchaseManager. So no need to depend
on InAppPurchaseManager.manager and require another global
variable.
2011-07-08 13:07:27 +02:00
Tim Fischbach
e34c05e825 iOS InAppPurchaseManager plugin should accept all possible transactionStates.
In paymentQueue:updateTransactions there was no case handling
SKPaymentTransactionStatePurchasing which resulted in an superfluous
"Invalid state" log message.
2011-07-08 13:07:07 +02:00
ascorbic
d3b4a0ac86 Add InAppPurchaseManager plugin 2011-02-23 15:10:01 +00:00