github.com/decred/politeia@v1.4.0/politeiawww/cmd/pictl/userpaymentsrescan.go (about)

     1  // Copyright (c) 2017-2019 The Decred developers
     2  // Use of this source code is governed by an ISC
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	v1 "github.com/decred/politeia/politeiawww/api/www/v1"
     9  	"github.com/decred/politeia/politeiawww/cmd/shared"
    10  )
    11  
    12  // userPaymentsRescanCmd rescans the logged in user's paywall address and
    13  // makes sure that all payments have been credited to the user's account.
    14  type userPaymentsRescanCmd struct {
    15  	Args struct {
    16  		UserID string `positional-arg-name:"userid"` // User ID
    17  	} `positional-args:"true" required:"true"`
    18  }
    19  
    20  // Execute executes the userPaymentsRescanCmd command.
    21  //
    22  // This function satisfies the go-flags Commander interface.
    23  func (cmd *userPaymentsRescanCmd) Execute(args []string) error {
    24  	upr := &v1.UserPaymentsRescan{
    25  		UserID: cmd.Args.UserID,
    26  	}
    27  
    28  	err := shared.PrintJSON(upr)
    29  	if err != nil {
    30  		return err
    31  	}
    32  
    33  	uprr, err := client.UserPaymentsRescan(upr)
    34  	if err != nil {
    35  		return err
    36  	}
    37  
    38  	return shared.PrintJSON(uprr)
    39  }
    40  
    41  // userPaymentsRescanHelpMsg is the output of the help command when
    42  // 'rescanuserpayments' is specified.
    43  var userPaymentsRescanHelpMsg = `userpaymentsrescan 
    44  
    45  Rescan user payments to check for missed payments.
    46  
    47  Arguments:
    48  1. userid        (string, required)   User id`