// CreateOrder creates ACME Order resources and saves them to the DB.
CreateOrder creates ACME Order resources and saves them to the DB.
// CreateOrder creates ACME Order resources and saves them to the DB .
func (db *DB) CreateOrder(ctx context.Context, o *acme.Order) error {
	var err error
	o.ID, err = randID()
	if err != nil {
		return err
	}
	now := clock.Now()
	dbo := &dbOrder{
		ID:               o.ID,
		AccountID:        o.AccountID,
		ProvisionerID:    o.ProvisionerID,
		Status:           o.Status,
		CreatedAt:        now,
		ExpiresAt:        o.ExpiresAt,
		Identifiers:      o.Identifiers,
		NotBefore:        o.NotBefore,
		NotAfter:         o.NotAfter,
		AuthorizationIDs: o.AuthorizationIDs,
	}
	if err := db.save(ctx, o.ID, dbo, nil, "order", orderTable); err != nil {
		return err
	}
	_, err = db.updateAddOrderIDs(ctx, o.AccountID, o.ID)
	if err != nil {
		return err
	}
	return nil
}
func ( db * DB ) CreateOrder ( ctx context . Context , o * acme . Order ) error { var err error o . ID , err = randID ( ) if err != nil { return err } now := clock . Now ( ) dbo := & dbOrder { ID : o . ID , AccountID : o . AccountID , ProvisionerID : o . ProvisionerID , Status : o . Status , CreatedAt : now , ExpiresAt : o . ExpiresAt , Identifiers : o . Identifiers , NotBefore : o . NotBefore , NotAfter : o . NotAfter , AuthorizationIDs : o . AuthorizationIDs , } if err := db . save ( ctx , o . ID , dbo , nil , " " , orderTable ) ; err != nil { return err } _ , err = db . updateAddOrderIDs ( ctx , o . AccountID , o . ID ) if err != nil { return err } return nil }
CreateOrder creates ACME Order resources and saves them to the DB.
CreateOrder creates ACME Order resources and saves them to the DB .