Step 5 - Update Stripe Details
 @route PUT /checkout/stripe-details
778598
def update_stripe_details
      render :json => false and return if !logged_in?
      
      sc = @site.store_config      
      Stripe.api_key = sc.stripe_secret_key.strip

      u = logged_in_user      
      
      c = nil
      if u.stripe_customer_id
        c = Stripe::Customer.retrieve(u.stripe_customer_id)
        begin          
          c.source = params[:token]
          c.save
        rescue          
          c = nil
        end
      end
      
      if c.nil?
        c = Stripe::Customer.create(
          :source => params[:token],
          :email => u.email,
          :metadata => { :user_id => u.id }          
        )
      end
      
      u.stripe_customer_id = c.id
      u.card_last4     = params[:card][:last4]
      u.card_brand     = params[:card][:brand]  
      u.card_exp_month = params[:card][:exp_month]
      u.card_exp_year  = params[:card][:exp_year]
      u.save
      
      render :json => {
        :success        => true,
        :customer_id    => u.stripe_customer_id,                                                           
        :card_last4     => u.card_last4,     
        :card_brand     => u.card_brand,       
        :card_exp_month => u.card_exp_month, 
        :card_exp_year  => u.card_exp_year
      }      
    end
396568
public function updateOrder()
    {
        $aOrderArticles = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aOrderArticles');

        $oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
        if (is_array($aOrderArticles) && $oOrder->load($this->getEditObjectId())) {
            $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
            $oOrderArticles = $oOrder->getOrderArticles(true);

            $blUseStock = $myConfig->getConfigParam('blUseStock');
            foreach ($oOrderArticles as $oOrderArticle) {
                $sItemId = $oOrderArticle->getId();
                if (isset($aOrderArticles[$sItemId])) {
                    // update stock
                    if ($blUseStock) {
                        $oOrderArticle->setNewAmount($aOrderArticles[$sItemId]['oxamount']);
                    } else {
                        $oOrderArticle->assign($aOrderArticles[$sItemId]);
                        $oOrderArticle->save();
                    }
                }
            }

            // recalculating order
            $oOrder->recalculateOrder();
        }
    }
1314972
function update_status() {
    global $order, $db;
//    $this->zcLog('update_status', 'Checking whether module should be enabled or not.');
    // if store is not running in SSL, cannot offer credit card module, for PCI reasons
    if (!defined('ENABLE_SSL') || ENABLE_SSL != 'true') {
      $this->enabled = FALSE;
      $this->zcLog('update_status', 'Module disabled because SSL is not enabled on this site.');
    }
    // check other reasons for the module to be deactivated:
    if ($this->enabled && (int)$this->zone > 0) {
      $check_flag = false;
      $sql = "SELECT zone_id
              FROM " . TABLE_ZONES_TO_GEO_ZONES . "
              WHERE geo_zone_id = :zoneId
              AND zone_country_id = :countryId
              ORDER BY zone_id";
      $sql = $db->bindVars($sql, ':zoneId', $this->zone, 'integer');
      $sql = $db->bindVars($sql, ':countryId', $order->billing['country']['id'], 'integer');
      $check = $db->Execute($sql);
      while (!$check->EOF) {
        if ($check->fields['zone_id'] < 1) {
          $check_flag = true;
          break;
        } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
          $check_flag = true;
          break;
        }
        $check->MoveNext();
      }

      if (!$check_flag) {
        $this->enabled = false;
        $this->zcLog('update_status', 'Module disabled due to zone restriction. Billing address is not within the Payment Zone selected in the module settings.');
      }

      // module cannot be used for purchase > $10,000 USD
      $order_amount = $this->calc_order_amount($order->info['total'], 'USD');
      if ($order_amount > 10000) {
        $this->enabled = false;
        $this->zcLog('update_status', 'Module disabled because purchase price (' . $order_amount . ') exceeds PayPal-imposed maximum limit of 10,000 USD.');
      }
      if ($order->info['total'] == 0) {
        $this->enabled = false;
        $this->zcLog('update_status', 'Module disabled because purchase amount is set to 0.00.' . "\n" . print_r($order, true));
      }
    }
  }
1160594
public function updateOrderStatus()
    {
        $orderUpdated = false;
        $order = $this->getOrder();

        if (!is_null($order)) {
            $orderPayment = $this->getOrderPayment();
            $order = $this->recalculateAmounts($order);
            $newOrderStatus = $this->calculateOrderStatus($orderPayment, $order);
            $this->persistNewOrderStatus($order, $newOrderStatus);
            $orderUpdated = true;
        }

        return $orderUpdated;
    }
612185
def update
      @script_listing.user_id = current_user.id
      @script_listing.org_id = current_user.org_id
      if @script_listing.update(script_listing_params)
        redirect_to script_listings_path, notice: 'Listing was successfully updated.'
      else
        render :edit
      end
    end
101056
public function updateTransaction()
    {        
        $cart = $this->cartProvider->getCart();

        if (0 === $cart->countItems() || $this->isTransactionUpdated($cart)) {
            return;
        }

        /** @var TransactionRepository $transactionRepository */
        $transactionRepository = $this->manager->getRepository('EcommerceBundle:Transaction');

        if ($this->session->has('transaction-id')) {
            /** @var Transaction $transaction */
            $transaction = $transactionRepository->find($this->session->get('transaction-id'));

            $transactionRepository->removeItems($transaction);
        } else {
            $transactionKey = $transactionRepository->getNextNumber();

            // create a new transaction
            $transaction = new Transaction();
            $transaction->setTransactionKey($transactionKey);
            $transaction->setStatus(Transaction::STATUS_CREATED);
            $transaction->setActor($this->securityContext->getToken()->getUser());
            $cartItem = $cart->getItems()->first();
            $product = $cartItem->getProduct();
        }

        $orderTotalPrice = 0;

        foreach ($cart->getItems() as $cartItem) {
            /** @var Product $product */
            $product = $cartItem->getProduct();

            $productPurchase = new ProductPurchase();
            $productPurchase->setProduct($product);
            $productPurchase->setBasePrice($cartItem->getUnitPrice());
            $productPurchase->setQuantity($cartItem->getQuantity());
            $productPurchase->setDiscount($product->getDiscount());
            $productPurchase->setTotalPrice($cartItem->getTotal());
            $productPurchase->setTransaction($transaction);
            $productPurchase->setReturned(false);
            //free transport
            if($cartItem->isFreeTransport()){
                $productPurchase->setDeliveryExpenses(0);
            }else{ 
                $productPurchase->setDeliveryExpenses($cartItem->getShippingCost());
            }
            $orderTotalPrice += $cartItem->getProduct()->getPrice() * $cartItem->getQuantity();

            $this->manager->persist($productPurchase);
        }

        $transaction->setTotalPrice($orderTotalPrice);

        $this->manager->persist($transaction);
        $this->manager->flush();

        $this->session->set('transaction-id', $transaction->getId());
        $this->session->save();
        
    }
439794
def update(attributes)
      response = JSON.parse(@client.patch("companies/#{attributes[:id]}", attributes).body)
      Promisepay::Company.new(@client, response['companies'])
    end
537352
def update
      @payment_method = PaymentMethod.find params[:payment_method_id]
      data = JSON.parse Base64.strict_decode64 params[:data]
      render text: "Bad signature\n", status: 401 and return unless @payment_method.check_signature params[:data], params[:signature]
      @order = Order.find data['order_id']

      raise ArgumentError unless @order.payments.completed.empty? &&
        data['currency'] == @order.currency &&
        BigDecimal(data['amount']) == @order.total &&
        data['type'] == 'buy' &&
        (data['status'] == 'success' || (@payment_method.preferred_test_mode && data['status'] == 'sandbox'))

      payment = @order.payments.create amount: @order.total, payment_method: @payment_method
      payment.complete!

      render text: "Thank you.\n"
    end
630077
def update_data_request(data_request_id, update_submission_data_request_data, opts = {})
      data, _status_code, _headers = update_data_request_with_http_info(data_request_id, update_submission_data_request_data, opts)
      data
    end
208259
def update
      @route_name ||= @controller_name ||= controller_name

      if @thing.update(thing_params)
        redirect_to things_path(@route_name), notice: "#{@controller_name.titleize} successfully updated."
      else
        @model = @thing.model_name.name.constantize
        render 'admin/edit'
      end
    end
1218725
def update
      

      @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]
      
      @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]
      
      
      @client.versioned_update({"redirect_urls" => 1, "app_ids" => 1})

      if @client.op_success?
        render "show"
      else
        render "edit"
      end
      
    end
576714
def update(self, params, path, **kwargs):
        
        self.client.request('POST', params, path, **kwargs)
1157373
def update
      if @resource.update(resource_params)
        redirect_to [main_app, @resource], notice: t('.notice', default: update_message)
      else
        render :edit
      end
    end
512040
public function update()
	{
		// Get group config
		$groupsConfig = \Component::params('com_groups');

		// Path to group folder
		$directory  = PATH_APP . DS . trim($groupsConfig->get('uploadpath', '/site/groups'), DS);
		$directory .= DS . $this->group->get('gidNumber');

		// Get task, defaults to update
		$task = ($this->arguments->getOpt(3)) ? $this->arguments->getOpt(3) : 'update';

		// Set our group directory & call update
		$this->arguments->setOpt('r', $directory);
		\App::get('client')->call('repository', $task, $this->arguments, $this->output);
	}
931917
function (details) {
    this.id = details.id;
    this.address = details.address;
    this.type = details.type;
    this.ipVersion = details.ipVersion;
  }
464784
public function update()
	{
		$mode = $this->output->getMode();

		if ($this->arguments->getOpt('f'))
		{
			if ($mode != 'minimal')
			{
				$this->output->addLine(
					'Updating the repository...',
					array(
						'color' => 'blue'
					),
					false
				);
			}

			// Check status and stash as needed
			if (!$this->mechanism->isClean())
			{
				$this->mechanism->stash();
			}

			// Create rollback point first
			$this->mechanism->createRollbackPoint();

			// Check whether or not we're allowing fast forward pulls only
			$allowNonFf = $this->arguments->getOpt('allow-non-ff');

			// Now do the update
			$response = $this->mechanism->update(false, $allowNonFf);
			if ($response['status'] == 'success')
			{
				// Now, check to see whether or not we need to go ahead and push this merge elsewhere
				if ($ref = $this->arguments->getOpt('git-auto-push-ref', false))
				{
					$response = $this->mechanism->push($ref);
					if ($response['status'] === 'success')
					{
						if ($mode != 'minimal')
						{
							$this->output->addLine(
								'complete',
								array(
									'color' => 'green'
								)
							);
						}
					}
					else
					{
						$this->output->addLine(
							strtolower($response['message']),
							array(
								'color' => 'red'
							)
						);
					}
				}
				else
				{
					if ($mode != 'minimal')
					{
						$this->output->addLine(
							'complete',
							array(
								'color' => 'green'
							)
						);
					}
				}

				// Also check to see if we need to update packages
				if ($this->arguments->getOpt('install-packages', false))
				{
					App::get('client')->call('repository:package', 'install', new Arguments([]), $this->output);
				}
			}
			else if ($response['status'] == 'fatal')
			{
				$this->output->addLine(
					strtolower($response['message']),
					array(
						'color' => 'red'
					)
				);
			}
			else
			{
				$this->output->addSpacer();
				$this->output->addRaw($response['raw']);
			}
		}
		else
		{
			$response = $this->mechanism->update();

			if (!empty($response))
			{
				if ($mode != 'minimal')
				{
					$this->output->addLine('The repository is behind by ' . count($response) . ' update(s):');
				}
				$logs = array();
				foreach ($response as $log)
				{
					if ($mode == 'minimal')
					{
						$this->output->addLine($log);
					}
					else
					{
						$logs[] = array(
							'message' => $log,
							'type' => array(
								'indentation' => 2,
								'color'       => 'blue'
							)
						);
					}
				}

				if ($mode != 'minimal')
				{
					$this->output->addLinesFromArray($logs);
				}
			}
			else
			{
				if ($mode != 'minimal')
				{
					$this->output->addLine('The repository is already up-to-date');
				}
			}
		}
	}
1358626
def update_detail(self, request):
        
        entity = request.context_params[self.detail_property_name]
        updated_entity = self.update_entity(
            request,
            entity, **request.context_params['data'])
        request.context_params[self.updated_property_name] = updated_entity
        return request