original_string: public function success(Request $request)
      {
          $user = $this->getUser4Id($request->getUserId());
          if (!$user) {
              throw new InValidUserException('User not found');
          }
  
          // we already added add the reward, so skip this =)
          if ($this->isStatusSuccess($request) && $this->isDonateAlreadyAdded($request)) {
              // no exception, or the other side spam the service ...
              throw new AlreadyAddedException('already added');
          }
  
          // check if donate should add coins or remove
          $request->setAmount(abs($request->getAmount()));
          $coins = $this->isStatusSuccess($request) ? $request->getAmount() : -$request->getAmount();
          $request->setAmount($this->paymentNotifyCoins->getAmount($user, (int)$coins));
  
          // save the message if gamebackend-service is unavailable
          $errorMessage = '';
          $throwable = null;
          try {
              $this->coinService->addCoins($user, $request->getAmount());
          } catch (Throwable $throwable) {
              $request->setStatus($request::STATUS_ERROR);
              $errorMessage = $throwable->getMessage();
          }
  
          if ($request->isReasonToBan()) {
              $expire = (int)$this->collectionOptions->getConfig()['payment-api']['ban-time'] + time();
              $reason = 'Donate - ChargeBack';
  
              $this->userBlockService->blockUser($user, $expire, $reason);
          }
  
          $this->saveDonateLog($request, $user, $errorMessage);
  
          if (null !== $throwable) {
              throw $throwable;
          }
  
          return true;
      }
code: public function success(Request $request)
      {
          $user = $this->getUser4Id($request->getUserId());
          if (!$user) {
              throw new InValidUserException('User not found');
          }
  
          // we already added add the reward, so skip this =)
          if ($this->isStatusSuccess($request) && $this->isDonateAlreadyAdded($request)) {
              // no exception, or the other side spam the service ...
              throw new AlreadyAddedException('already added');
          }
  
          // check if donate should add coins or remove
          $request->setAmount(abs($request->getAmount()));
          $coins = $this->isStatusSuccess($request) ? $request->getAmount() : -$request->getAmount();
          $request->setAmount($this->paymentNotifyCoins->getAmount($user, (int)$coins));
  
          // save the message if gamebackend-service is unavailable
          $errorMessage = '';
          $throwable = null;
          try {
              $this->coinService->addCoins($user, $request->getAmount());
          } catch (Throwable $throwable) {
              $request->setStatus($request::STATUS_ERROR);
              $errorMessage = $throwable->getMessage();
          }
  
          if ($request->isReasonToBan()) {
              $expire = (int)$this->collectionOptions->getConfig()['payment-api']['ban-time'] + time();
              $reason = 'Donate - ChargeBack';
  
              $this->userBlockService->blockUser($user, $expire, $reason);
          }
  
          $this->saveDonateLog($request, $user, $errorMessage);
  
          if (null !== $throwable) {
              throw $throwable;
          }
  
          return true;
      }
code_tokens: public function success ( Request $ request ) { $ user = $ this -> getUser4Id ( $ request -> getUserId ( ) ) ; if ( ! $ user ) { throw new InValidUserException ( 'User not found' ) ; } // we already added add the reward, so skip this =) if ( $ this -> isStatusSuccess ( $ request ) && $ this -> isDonateAlreadyAdded ( $ request ) ) { // no exception, or the other side spam the service ... throw new AlreadyAddedException ( 'already added' ) ; } // check if donate should add coins or remove $ request -> setAmount ( abs ( $ request -> getAmount ( ) ) ) ; $ coins = $ this -> isStatusSuccess ( $ request ) ? $ request -> getAmount ( ) : - $ request -> getAmount ( ) ; $ request -> setAmount ( $ this -> paymentNotifyCoins -> getAmount ( $ user , ( int ) $ coins ) ) ; // save the message if gamebackend-service is unavailable $ errorMessage = '' ; $ throwable = null ; try { $ this -> coinService -> addCoins ( $ user , $ request -> getAmount ( ) ) ; } catch ( Throwable $ throwable ) { $ request -> setStatus ( $ request :: STATUS_ERROR ) ; $ errorMessage = $ throwable -> getMessage ( ) ; } if ( $ request -> isReasonToBan ( ) ) { $ expire = ( int ) $ this -> collectionOptions -> getConfig ( ) [ 'payment-api' ] [ 'ban-time' ] + time ( ) ; $ reason = 'Donate - ChargeBack' ; $ this -> userBlockService -> blockUser ( $ user , $ expire , $ reason ) ; } $ this -> saveDonateLog ( $ request , $ user , $ errorMessage ) ; if ( null !== $ throwable ) { throw $ throwable ; } return true ; }
docstring: Method the add the reward
  
  @param Request $request
  @return boolean
  @throws Throwable
docstring_tokens: Method the add the reward