/** * @param $user_id * @return array */ public function getUserStatus($user_id) { $url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_GAMIFICATION . Endpoints::GAMIFICATION_SUMMARY; $url = sprintf($url, $user_id); $result = $this->authenticationService->getTransport()->fetch($url); return $result['results']; }
/** * @param $user_id * @return bool * @throws \CodeMojo\Client\Http\InvalidArgumentException * @throws \CodeMojo\OAuth2\Exception */ public function markActivityComplete($user_id) { $url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_REFERRAL . Endpoints::REFERRAL_CLAIM; $url = sprintf($url, $user_id); $result = $this->authenticationService->getTransport()->fetch($url, array(), 'PUT', array(), 0); return $result['code'] == APIResponse::RESPONSE_SUCCESS; }
public function grabReward($customer_id, $deliver_to, $reward_id, $additional_info = array()) { $url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_REWARDS . Endpoints::REWARDS_GRAB; $url = sprintf($url, $this->app_id, $reward_id); $params = array('customer_id' => $customer_id, 'lat' => @$additional_info['lat'], 'lon' => @$additional_info['lon'], "email" => $deliver_to, "phone" => $deliver_to, "age" => @$additional_info['age'], "gender" => @$additional_info['gender'], 'test' => @$additional_info['testing'], 'communicate' => @$additional_info['communicate']); $result = $this->authenticationService->getTransport()->fetch($url, $params, 'POST', array(), 0); if (isset($result['code']) && $result['code'] == APIResponse::RESPONSE_SUCCESS) { return $result['offer']; } else { if ($result['code'] == APIResponse::WALLET_BALANCE_EXHAUSTED) { throw new RewardsExhaustedException("Cannot be grabbed, all rewards exhausted"); } } return null; }
public function refundPartial($transaction_id, $sku_value) { $url = $this->authenticationService->getServerEndPoint() . Endpoints::VERSION . Endpoints::BASE_LOYALTY . Endpoints::WALLET_TRANSACTION_REFUND; $url = sprintf($url, $transaction_id); $result = $this->authenticationService->getTransport()->fetch($url, array('value' => $sku_value), 'POST', array(), 0); if ($result["code"] == APIResponse::RESOURCE_NOT_FOUND) { throw new ResourceNotFoundException("Transaction ID not found", 0x8); return false; } elseif ($result["code"] == APIResponse::WALLET_BALANCE_EXHAUSTED) { throw new BalanceExhaustedException("Redemption value more than actual value", 0x8); return false; } return $result["code"] == APIResponse::RESPONSE_SUCCESS; }