#!/bin/bash # # This little guy repairs an invoice machine and makes a specific refund succeed, # in spite of the fact that provider no longer service refunds. # set -e CWD="$(dirname $0)" source "${CWD}/lib/logging" function usage { echo -e "Given ID of an invoice and a payment make it look like the payment was refunded successfully." echo echo -e "Usage: $(em ${SCRIPTNAME} invoice_id [payment_id] [refund_id])" echo -e " $(em invoice_id) Invoice ID (string)." echo -e " $(em payment_id) Payment ID (string), $(em 1) by default." echo -e " $(em refund_id) Refund ID (string), last one by default." # echo -e " $(em amount) Amount (number)." # echo -e " $(em currency) Currency code (string)." echo echo -e "More information:" echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift" exit 127 } INVOICE="${1}" PAYMENT="${2:-1}" REFUND="${3}" # AMOUNT="${3}" # CURCODE="${4}" [ -z "${INVOICE}" -o -z "${PAYMENT}" ] && usage # CASH=$(cat <