Create a shipment for an order. When no data arg is given, a shipment for all order lines is assumed.
506496
def create_shipment(self, data=None):
        """"""
        if data is None:
            data = {'lines': []}
        return Shipments(self.client).on(self).create(data)
313532
private Order create(
            final String number,
            final String customerName,
            final LocalDate date,
            final String preferences,
            final ExecutionContext executionContext) {
        return executionContext.add(this, orders.create(number, customerName, date, preferences));
    }
637538
def create_new_sale(self, amount, purpose, payment_reference=None, order_id=None, channel_id=None, capture=True):
        
        request_data = {
            "amount": self.base.convert_decimal_to_hundreds(amount),
            "currency": self.currency,
            "purpose": purpose,
            "capture": capture
        }

        if payment_reference:
            request_data['paymentreference'] = payment_reference

        if order_id:
            request_data['orderid'] = order_id

        if channel_id:
            request_data['channelid'] = channel_id

        url = "%s%s" % (self.api_endpoint, constants.NEW_SALE_ENDPOINT)

        username = self.base.get_username()
        password = self.base.get_password(username=username, request_url=url)

        response = requests.post(url, json=request_data, auth=HTTPBasicAuth(username=username, password=password))

        if not self.base.verify_response(response.json()):
            raise SignatureValidationException('Server signature verification has failed')

        response_json = response.json()

        return response_json.get('transactionid'), response_json.get('paymenttokennumber'), response_json.get('status')
12854
def build_shipment_request(origin, destination, package, line_items = [], options = {})
      builder = Nokogiri::XML::Builder.new do |xml|
        xml.public_send('non-contract-shipment', :xmlns => "http://www.canadapost.ca/ws/ncshipment") do
          xml.public_send('delivery-spec') do
            shipment_service_code_node(xml, options)
            shipment_sender_node(xml, origin, options)
            shipment_destination_node(xml, destination, options)
            shipment_options_node(xml, options)
            shipment_parcel_node(xml, package)
            shipment_notification_node(xml, options)
            shipment_preferences_node(xml, options)
            references_node(xml, options)             # optional > user defined custom notes
            shipment_customs_node(xml, destination, line_items, options)
            # COD Remittance defaults to sender
          end
        end
      end
      builder.to_xml
    end
1354154
def create_order_with_token(request):
    
    # Get the request data
    try:
        address = request.data['address']
        shipping_option = request.data.get('shipping_option', None)
        email = request.data['email']
        transaction_id = request.data['transaction_id']
    except KeyError:
        return Response(data={"message": "Missing parameters from request data"},
                        status=status.HTTP_400_BAD_REQUEST)

    # Create the order
    order = create_order(
        email,
        request,
        addresses=address,
        shipping_option=shipping_option,
    )

    order.payment_date = timezone.now()
    order.transaction_id = transaction_id
    order.save()
    # Once the order has been successfully taken, we can empty the basket
    destroy_basket(request)

    return Response(data={"order_id": order.id}, status=status.HTTP_201_CREATED)
303707
public function create()
    {
        $instance = self::createFreeShipping($this);
        $this->setId($instance->getId());
        return $instance;
    }
1231577
def find_shipment(shipment_key)
      shipment = shipments.select { |s| s[:shipment_key] == shipment_key }.first
      Shipment.new(shipment)
    end
678395
def deploy(self, args, **extra_args):
        
        if not isinstance(args, argparse.Namespace):
            raise TypeError(logger.error("args should of an instance of argparse.Namespace"))

        # create new freight forwarder
        freight_forwarder = FreightForwarder()

        # create commercial invoice this is the contact given to freight forwarder to dispatch containers and images
        commercial_invoice = freight_forwarder.commercial_invoice(
            'deploy',
            args.data_center,
            args.environment,
            args.service
        )

        # deploy containers.
        bill_of_lading = freight_forwarder.deploy_containers(commercial_invoice, args.tag, args.env)

        # pretty lame... Need to work on return values through to app to make them consistent.
        exit_code = 0 if bill_of_lading else 1

        if exit_code != 0:
            exit(exit_code)
29977
def stock_save!
      stock.save!
    rescue ActiveRecord::RecordInvalid => e
      shipment.order.errors.add 'order_items.quantity', Comable.t('errors.messages.out_of_stock', name: stock.name_with_sku)
      raise e, Comable.t('errors.messages.out_of_stock', name: stock.name_with_sku)
    end
833284
def create_queue(self, *args, **kwargs):
        """"""
        q = queue.Queue(*args, **kwargs)
        q.Empty = queue.Empty
        return q
1099851
private void createAllOrderers() throws NetworkConfigurationException {

        // Sanity check
        if (orderers != null) {
            throw new NetworkConfigurationException("INTERNAL ERROR: orderers has already been initialized!");
        }

        orderers = new HashMap<>();

        // orderers is a JSON object containing a nested object for each orderers
        JsonObject jsonOrderers = getJsonObject(jsonConfig, "orderers");

        if (jsonOrderers != null) {

            for (Entry<String, JsonValue> entry : jsonOrderers.entrySet()) {
                String ordererName = entry.getKey();

                JsonObject jsonOrderer = getJsonValueAsObject(entry.getValue());
                if (jsonOrderer == null) {
                    throw new NetworkConfigurationException(format("Error loading config. Invalid orderer entry: %s", ordererName));
                }

                Node orderer = createNode(ordererName, jsonOrderer, "url");
                if (orderer == null) {
                    throw new NetworkConfigurationException(format("Error loading config. Invalid orderer entry: %s", ordererName));
                }
                orderers.put(ordererName, orderer);
            }
        }

    }
1253715
def _create(self, postData) :
        """"""
        if self.infos is None :
            r = self.connection.session.post(self.indexesURL, params = {"collection" : self.collection.name}, data = json.dumps(postData, default=str))
            data = r.json()
            if (r.status_code >= 400) or data['error'] :
                raise CreationError(data['errorMessage'], data)
            self.infos = data
791176
def get_shipment(self, resource_id):
        """"""
        return Shipments(self.client).on(self).get(resource_id)
753757
def create(provider, names, opts=None, **kwargs):
    '''
    
    '''
    client = _get_client()
    if isinstance(opts, dict):
        client.opts.update(opts)
    info = client.create(provider, names, **kwargs)
    return info
31374
public function shipmentException($orderId, $datetime, $observation)
    {
        $transformer = new ShipmentExceptionTransformer($orderId, $datetime, $observation);
        $body        = $transformer->output();

        /** @var \SkyHub\Api\Handler\Response\HandlerInterface $responseHandler */
        $responseHandler = $this->service()->post($this->baseUrlPath("$orderId/shipment_exception"), $body);
        return $responseHandler;
    }
224664
public function create(Order &$order)
    {
        $data = $order->exportData();
        $endpoint = '/admin/orders.json';
        $response = $this->request(
            $endpoint, 'POST', array(
            'order' => $data
            )
        );
        $order->setData($response['order']);
    }
611205
private function _addShipmentToOrder($shipmentNumber)
    {
        print "Select an item to add to shipment #" . ($shipmentNumber + 1) . ":" . PHP_EOL;
        $items = $this->exampleClass->getItemNames();
        for ($i = 0; $i < count($items); $i++) {
            print " " . $i . " - " . $items[$i] . PHP_EOL;
        }

        do {
            print "Select the number of the item to add to this shipment:";
            $itemToAdd = trim(fgets(STDIN));
        } while (!is_numeric($itemToAdd));
        
        print PHP_EOL;
        
        $this->exampleClass->addShipmentToOrder($itemToAdd);
    }