/** * Get the productId that identifies the product. * Platform: Android and iOS. * @return The string that identifies the product, or an * empty string in case of error. */ MAUtil::String Purchase::getProductId() const { char buffer[BUF_SIZE]; int result = maPurchaseGetName(mHandle, buffer, BUF_SIZE); if (result < 0) { return ""; } return buffer; }
/** * Test maPurchaseGetName() syscall. * Expected result code: MA_PURCHASE_RES_BUFFER_TOO_SMALL */ void Test9::testSyscall() { char buffer[2]; int result = maPurchaseGetName(mPurchase->getHandle(), buffer, 2); if (result != MA_PURCHASE_RES_BUFFER_TOO_SMALL) { char bigBuffer[BUF_MAX]; sprintf(bigBuffer, "Result code %d received instead of " "MA_PURCHASE_RES_BUFFER_TOO_SMALL(%d)", result, MA_PURCHASE_RES_BUFFER_TOO_SMALL); this->setFailedReason(bigBuffer); mApplicationController.testFailed(*this); } else { mApplicationController.testSucceeded(*this); } }