create a pagseguro checkout
182875
def checkout(self, transparent=False, **kwargs):
        
        self.data['currency'] = self.config.CURRENCY
        self.build_checkout_params(**kwargs)
        if transparent:
            response = self.post(url=self.config.TRANSPARENT_CHECKOUT_URL)
        else:
            response = self.post(url=self.config.CHECKOUT_URL)
        return PagSeguroCheckoutResponse(response.content, config=self.config)
776997
public function shop()
	{

		$terminal = Terminal::whereUserId($this->userId())->first();
		$endpointParams = $this->getEndpointFields($terminal);

		$status = Input::get('resultBankEmulatorPayment');
		$statusSuccess = ($status === 'success');
		$statusError = ($status === 'error');

		$this->make('shop', compact(
			'terminal',
			'endpointParams',
			'statusSuccess',
			'statusError'
		));

	}
438149
public function buildExpressCheckoutRequest()
    {
        $this->addBaseParams();
        $this->addCallBackUrl();
        $this->addBasketParams();
        $this->addDescriptionParams();
        $this->turnOffShippingAddressCollection();
        $this->setMaximumOrderAmount();

        if ($this->getShowCartInPayPal()) {
            $this->addBasketItemParams();
        } else {
            $this->addBasketGrandTotalParams();
        }
        $this->addAddressParams();

        return $this->getPayPalRequest();
    }
759804
public function execute()
    {
        try {
            $nofitication = new \UOL\PagSeguro\Model\NotificationMethod(
                $this->_objectManager->create('\Magento\Framework\App\Config\ScopeConfigInterface'),
                $this->_objectManager->create('\Magento\Sales\Api\OrderRepositoryInterface'),
                $this->_objectManager->create('\Magento\Sales\Api\Data\OrderStatusHistoryInterface'),
                $this->_objectManager->create('Magento\Framework\Module\ModuleList'),
                $this->_objectManager->create('\Magento\Framework\Model\ResourceModel\Db\Context')
            );
            $nofitication->init();
        } catch (\Exception $ex) {
            //log already written in your pagseguro log file if pagseguro log is enabled in admin
            exit;
        }
    }
950994
public function run()
	{
		$context = $this->getContext();
		$config = $context->getConfig();


		/** controller/jobs/order/service/payment/limit-days
		 * Only start capturing payments of orders that were created in the past within the configured number of days
		 *
		 * Capturing payments is normally done immediately after the delivery
		 * status changed to "dispatched" or "delivered". This option prevents
		 * payments from being captured in case anything went wrong and payments
		 * of old orders would be captured now.
		 *
		 * @param integer Number of days
		 * @since 2014.07
		 * @category User
		 * @category Developer
		 */
		$days = $config->get( 'controller/jobs/order/service/payment/limit-days', 90 );
		$date = date( 'Y-m-d 00:00:00', time() - 86400 * $days );

		/** controller/jobs/order/service/payment/capture-days
		 * Automatically capture payments after the configured amount of days
		 *
		 * You can capture authorized payments after a configured amount of days
		 * even if the parcel for the order wasn't dispatched yet. This is useful
		 * for payment methods like credit cards where autorizations are revoked
		 * by the aquirers after some time (usually seven days).
		 *
		 * @param integer Number of days
		 * @since 2014.07
		 * @category User
		 * @category Developer
		 */
		$capDays = $config->get( 'controller/jobs/order/service/payment/capture-days', null );


		$serviceManager = \Aimeos\MShop::create( $context, 'service' );
		$serviceSearch = $serviceManager->createSearch();
		$serviceSearch->setConditions( $serviceSearch->compare( '==', 'service.type', 'payment' ) );

		$orderManager = \Aimeos\MShop::create( $context, 'order' );
		$orderSearch = $orderManager->createSearch();

		$status = array( \Aimeos\MShop\Order\Item\Base::STAT_DISPATCHED, \Aimeos\MShop\Order\Item\Base::STAT_DELIVERED );
		$start = 0;

		do
		{
			$serviceItems = $serviceManager->searchItems( $serviceSearch );

			foreach( $serviceItems as $serviceItem )
			{
				try
				{
					$serviceProvider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() );

					if( !$serviceProvider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_CAPTURE ) ) {
						continue;
					}


					$expr = [];
					$expr[] = $orderSearch->compare( '>', 'order.datepayment', $date );

					if( $capDays !== null )
					{
						$capdate = date( 'Y-m-d 00:00:00', time() - 86400 * $capDays );
						$expr[] = $orderSearch->compare( '<=', 'order.datepayment', $capdate );
					}
					else
					{
						$expr[] = $orderSearch->compare( '==', 'order.statusdelivery', $status );
					}

					$expr[] = $orderSearch->compare( '==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED );
					$expr[] = $orderSearch->compare( '==', 'order.base.service.code', $serviceItem->getCode() );
					$expr[] = $orderSearch->compare( '==', 'order.base.service.type', 'payment' );

					$orderSearch->setConditions( $orderSearch->combine( '&&', $expr ) );


					$orderStart = 0;

					do
					{
						$orderItems = $orderManager->searchItems( $orderSearch );

						foreach( $orderItems as $orderItem )
						{
							try
							{
								$serviceProvider->capture( $orderItem );
							}
							catch( \Exception $e )
							{
								$str = 'Error while capturing payment for order with ID "%1$s": %2$s';
								$context->getLogger()->log( sprintf( $str, $orderItem->getId(), $e->getMessage() ) );
							}
						}

						$orderCount = count( $orderItems );
						$orderStart += $orderCount;
						$orderSearch->setSlice( $orderStart );
					}
					while( $orderCount >= $orderSearch->getSliceSize() );
				}
				catch( \Exception $e )
				{
					$str = 'Error while capturing payments for service with ID "%1$s": %2$s';
					$context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) );
				}
			}

			$count = count( $serviceItems );
			$start += $count;
			$serviceSearch->setSlice( $start );
		}
		while( $count >= $serviceSearch->getSliceSize() );
	}
613158
def checkoutbranch(accountable, options):
    
    issue = accountable.checkout_branch(options)
    headers = sorted(['id', 'key', 'self'])
    rows = [headers, [itemgetter(header)(issue) for header in headers]]
    print_table(SingleTable(rows))
902785
private function setPagSeguroDiscountsByPaymentMethod()
    {
        $storeId = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
        if ($this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_credit_card', $storeId) == 1) {
            $creditCard = (double)$this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_credit_card_value', $storeId);
            if ($creditCard && $creditCard != 0.00) {
                $this->_paymentRequest->addPaymentMethod()->withParameters(
                    \PagSeguro\Enum\PaymentMethod\Group::CREDIT_CARD,
                    \PagSeguro\Enum\PaymentMethod\Config\Keys::DISCOUNT_PERCENT,
                    $creditCard
                );
            }
        }
        if ($this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_online_debit', $storeId) == 1) {
            $eft = (double)$this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_online_debit_value', $storeId);
            if ($eft && $eft != 0.00) {
                $this->_paymentRequest->addPaymentMethod()->withParameters(
                    \PagSeguro\Enum\PaymentMethod\Group::EFT,
                    \PagSeguro\Enum\PaymentMethod\Config\Keys::DISCOUNT_PERCENT,
                    $eft
                );
            }
        }
        if ($this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_boleto', $storeId) == 1) {
            $boleto = (double)$this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_boleto_value', $storeId);
            if ($boleto && $boleto != 0.00) {
                $this->_paymentRequest->addPaymentMethod()->withParameters(
                    \PagSeguro\Enum\PaymentMethod\Group::BOLETO,
                    \PagSeguro\Enum\PaymentMethod\Config\Keys::DISCOUNT_PERCENT,
                    $boleto
                );
            }
        }
        if ($this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_deposit_account', $storeId)) {
            $deposit = (double)$this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_deposit_account_value', $storeId);
            if ($deposit && $deposit != 0.00) {
                $this->_paymentRequest->addPaymentMethod()->withParameters(
                    \PagSeguro\Enum\PaymentMethod\Group::DEPOSIT,
                    \PagSeguro\Enum\PaymentMethod\Config\Keys::DISCOUNT_PERCENT,
                    $deposit
                );
            }
        }
        if ($this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_balance', $storeId)) {
            $balance = (double)$this->_scopeConfig->getValue('payment/pagseguro_default_lightbox/discount_balance_value', $storeId);
            if ($balance && $balance != 0.00) {
                $this->_paymentRequest->addPaymentMethod()->withParameters(
                    \PagSeguro\Enum\PaymentMethod\Group::BALANCE,
                    \PagSeguro\Enum\PaymentMethod\Config\Keys::DISCOUNT_PERCENT,
                    $balance
                );
            }
        }
    }
638350
def create_tipo_equipamento(self):
        """"""
        return TipoEquipamento(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
981215
def create_usuario_grupo(self):
        """"""
        return UsuarioGrupo(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
1036565
def create(pickup_options)
      response = @connection.post PARCELPICKUP_URL, body: pickup_options.to_json.to_ascii, headers: { 'Content-Type' => 'application/json' }
      RecursiveOpenStruct.new(response.parsed, recurse_over_arrays: true)
    end
773919
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $order = $observer->getEvent()->getOrder();

        //verify pagseguro transaction
        if ($order->getStatus() == 'pagseguro_iniciado') {
            $orderId = $order->getId();
            $environment = $this->_scopeConfig->getValue('payment/pagseguro/environment');
            
            //save order in pagseguro_orders table
            $this->saveOrderAndEnvironment($orderId, $environment);

            //$this->getEnvironmentName($environment);
            $this->updateSalesOrderGridEnvironment($orderId, $environment);
        }

        return $this;
    }
1370576
def checkout_and_create_branch(repo, name):
    """"""
    local_branch = repo.branches[name] if name in repo.branches else None
    if not local_branch:
        if name in repo.remotes.origin.refs:
            # If origin branch exists but not local, git.checkout is the fatest way
            # to create local branch with origin link automatically
            msg = repo.git.checkout(name)
            _LOGGER.debug(msg)
            return
        # Create local branch, will be link to origin later
        local_branch = repo.create_head(name)
    local_branch.checkout()
595701
def checkout(self, ref, cb=None):
        """"""
        if self.is_api:
            return self._checkout_api(ref, cb=cb)
        else:
            return self._checkout_fs(ref, cb=cb)
598761
public function request()
    {
        $this->getTransactions();
        if (! is_null($this->_PagSeguroPaymentList->getTransactions())) {
            $partiallyRefundedOrdersArray = $this->getPartiallyRefundedOrders();

            foreach ($this->_PagSeguroPaymentList->getTransactions() as $payment) {
                $order = $this->decryptOrderById($payment);

                if (!in_array($order->getId(), $partiallyRefundedOrdersArray)) {
                    if (! $this->addPayment($this->decryptOrderById($payment), $payment))
                        continue;
                }
            }
        }
        return $this->_arrayPayments;
    }
808459
def create_order(email,
                 request,
                 addresses=None,
                 shipping_address=None,
                 billing_address=None,
                 shipping_option=None,
                 capture_payment=False):
    
    basket_items, _ = get_basket_items(request)
    if addresses:
        # Longclaw < 0.2 used 'shipping_name', longclaw > 0.2 uses a consistent
        # prefix (shipping_address_xxxx)
        try:
            shipping_name = addresses['shipping_name']
        except KeyError:
            shipping_name = addresses['shipping_address_name']

        shipping_country = addresses['shipping_address_country']
        if not shipping_country:
            shipping_country = None
        shipping_address, _ = Address.objects.get_or_create(name=shipping_name,
                                                            line_1=addresses[
                                                                'shipping_address_line1'],
                                                            city=addresses[
                                                                'shipping_address_city'],
                                                            postcode=addresses[
                                                                'shipping_address_zip'],
                                                            country=shipping_country)
        shipping_address.save()
        try:
            billing_name = addresses['billing_name']
        except KeyError:
            billing_name = addresses['billing_address_name']
        billing_country = addresses['shipping_address_country']
        if not billing_country:
            billing_country = None
        billing_address, _ = Address.objects.get_or_create(name=billing_name,
                                                           line_1=addresses[
                                                               'billing_address_line1'],
                                                           city=addresses[
                                                               'billing_address_city'],
                                                           postcode=addresses[
                                                               'billing_address_zip'],
                                                           country=billing_country)
        billing_address.save()
    else:
        shipping_country = shipping_address.country

    ip_address = get_real_ip(request)
    if shipping_country and shipping_option:
        site_settings = Configuration.for_site(request.site)
        shipping_rate = get_shipping_cost(
            site_settings,
            shipping_address.country.pk,
            shipping_option)['rate']
    else:
        shipping_rate = Decimal(0)

    order = Order(
        email=email,
        ip_address=ip_address,
        shipping_address=shipping_address,
        billing_address=billing_address,
        shipping_rate=shipping_rate
    )
    order.save()

    # Create the order items & compute total
    total = 0
    for item in basket_items:
        total += item.total()
        order_item = OrderItem(
            product=item.variant,
            quantity=item.quantity,
            order=order
        )
        order_item.save()

    if capture_payment:
        desc = 'Payment from {} for order id #{}'.format(email, order.id)
        try:
            transaction_id = GATEWAY.create_payment(request,
                                                    total + shipping_rate,
                                                    description=desc)
            order.payment_date = timezone.now()
            order.transaction_id = transaction_id
            # Once the order has been successfully taken, we can empty the basket
            destroy_basket(request)
        except PaymentError:
            order.status = order.FAILURE

        order.save()

    return order
368408
def create
      @order ||= Effective::Order.new(view_context.current_cart)
      EffectiveOrders.authorize!(self, :create, @order)

      @order.assign_attributes(checkout_params)

      if (@order.confirm! rescue false)
        redirect_to(effective_orders.order_path(@order))
      else
        flash.now[:danger] = "Unable to proceed: #{flash_errors(@order)}. Please try again."
        render :new
      end
    end
78599
def create_usuario(self):
        """"""
        return Usuario(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)