forked from organicmaps/organicmaps
[purchase] trial validation flag dummy. review fixes
This commit is contained in:
parent
f7c01a0085
commit
c6dd40c143
2 changed files with 15 additions and 8 deletions
|
@ -941,18 +941,18 @@ void CallSetRoutingLoadPointsListener(shared_ptr<jobject> listener, bool success
|
|||
RoutingManager::LoadRouteHandler g_loadRouteHandler;
|
||||
|
||||
void CallPurchaseValidationListener(shared_ptr<jobject> listener, Purchase::ValidationCode code,
|
||||
Purchase::ValidationResponse const & validationResponce)
|
||||
Purchase::ValidationResponse const & validationResponse)
|
||||
{
|
||||
JNIEnv * env = jni::GetEnv();
|
||||
jmethodID const methodId = jni::GetMethodID(env, *listener, "onValidatePurchase",
|
||||
"(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V");
|
||||
|
||||
jni::TScopedLocalRef const serverId(env, jni::ToJavaString(env, validationResponce.m_info.m_serverId));
|
||||
jni::TScopedLocalRef const vendorId(env, jni::ToJavaString(env, validationResponce.m_info.m_vendorId));
|
||||
jni::TScopedLocalRef const receiptData(env, jni::ToJavaString(env, validationResponce.m_info.m_receiptData));
|
||||
jni::TScopedLocalRef const serverId(env, jni::ToJavaString(env, validationResponse.m_info.m_serverId));
|
||||
jni::TScopedLocalRef const vendorId(env, jni::ToJavaString(env, validationResponse.m_info.m_vendorId));
|
||||
jni::TScopedLocalRef const receiptData(env, jni::ToJavaString(env, validationResponse.m_info.m_receiptData));
|
||||
|
||||
env->CallVoidMethod(*listener, methodId, static_cast<jint>(code), serverId.get(), vendorId.get(),
|
||||
receiptData.get(), static_cast<jboolean>(validationResponce.m_isTrial));
|
||||
receiptData.get(), static_cast<jboolean>(validationResponse.m_isTrial));
|
||||
}
|
||||
|
||||
void CallStartPurchaseTransactionListener(shared_ptr<jobject> listener, bool success,
|
||||
|
|
|
@ -71,7 +71,7 @@ public class PurchaseOperationObservable implements Framework.PurchaseValidation
|
|||
ValidationStatus status = ValidationStatus.values()[code];
|
||||
if (observer == null)
|
||||
{
|
||||
PendingResult result = new PendingResult(status, serverId, vendorId, purchaseData);
|
||||
PendingResult result = new PendingResult(status, serverId, vendorId, purchaseData, isTrial);
|
||||
mValidationPendingResults.put(orderId, result);
|
||||
return;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class PurchaseOperationObservable implements Framework.PurchaseValidation
|
|||
mLogger.d(TAG, "Post pending validation result to '" + observer + "' for '"
|
||||
+ orderId + "'");
|
||||
observer.onValidatePurchase(result.getStatus(), result.getServerId(), result.getVendorId(),
|
||||
result.getPurchaseData(), true /* Dummy */);
|
||||
result.getPurchaseData(), result.isTrial());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,14 +130,16 @@ public class PurchaseOperationObservable implements Framework.PurchaseValidation
|
|||
private final String mVendorId;
|
||||
@NonNull
|
||||
private final String mPurchaseData;
|
||||
private final boolean mIsTrial;
|
||||
|
||||
private PendingResult(@NonNull ValidationStatus status, @NonNull String serverId,
|
||||
@NonNull String vendorId, @NonNull String purchaseData)
|
||||
@NonNull String vendorId, @NonNull String purchaseData, boolean isTrial)
|
||||
{
|
||||
mStatus = status;
|
||||
mServerId = serverId;
|
||||
mVendorId = vendorId;
|
||||
mPurchaseData = purchaseData;
|
||||
mIsTrial = isTrial;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -163,5 +165,10 @@ public class PurchaseOperationObservable implements Framework.PurchaseValidation
|
|||
{
|
||||
return mPurchaseData;
|
||||
}
|
||||
|
||||
boolean isTrial()
|
||||
{
|
||||
return mIsTrial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue