github.com/stripe/stripe-go/v76@v76.25.0/testhelpers/issuing/transaction/client.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  // Package transaction provides the /issuing/transactions APIs
     8  package transaction
     9  
    10  import (
    11  	"net/http"
    12  
    13  	stripe "github.com/stripe/stripe-go/v76"
    14  )
    15  
    16  // Client is used to invoke /issuing/transactions APIs.
    17  type Client struct {
    18  	B   stripe.Backend
    19  	Key string
    20  }
    21  
    22  // CreateForceCapture is the method for the `POST /v1/test_helpers/issuing/transactions/create_force_capture` API.
    23  func CreateForceCapture(params *stripe.TestHelpersIssuingTransactionCreateForceCaptureParams) (*stripe.IssuingTransaction, error) {
    24  	return getC().CreateForceCapture(params)
    25  }
    26  
    27  // CreateForceCapture is the method for the `POST /v1/test_helpers/issuing/transactions/create_force_capture` API.
    28  func (c Client) CreateForceCapture(params *stripe.TestHelpersIssuingTransactionCreateForceCaptureParams) (*stripe.IssuingTransaction, error) {
    29  	transaction := &stripe.IssuingTransaction{}
    30  	err := c.B.Call(
    31  		http.MethodPost,
    32  		"/v1/test_helpers/issuing/transactions/create_force_capture",
    33  		c.Key,
    34  		params,
    35  		transaction,
    36  	)
    37  	return transaction, err
    38  }
    39  
    40  // CreateUnlinkedRefund is the method for the `POST /v1/test_helpers/issuing/transactions/create_unlinked_refund` API.
    41  func CreateUnlinkedRefund(params *stripe.TestHelpersIssuingTransactionCreateUnlinkedRefundParams) (*stripe.IssuingTransaction, error) {
    42  	return getC().CreateUnlinkedRefund(params)
    43  }
    44  
    45  // CreateUnlinkedRefund is the method for the `POST /v1/test_helpers/issuing/transactions/create_unlinked_refund` API.
    46  func (c Client) CreateUnlinkedRefund(params *stripe.TestHelpersIssuingTransactionCreateUnlinkedRefundParams) (*stripe.IssuingTransaction, error) {
    47  	transaction := &stripe.IssuingTransaction{}
    48  	err := c.B.Call(
    49  		http.MethodPost,
    50  		"/v1/test_helpers/issuing/transactions/create_unlinked_refund",
    51  		c.Key,
    52  		params,
    53  		transaction,
    54  	)
    55  	return transaction, err
    56  }
    57  
    58  // Refund is the method for the `POST /v1/test_helpers/issuing/transactions/{transaction}/refund` API.
    59  func Refund(id string, params *stripe.TestHelpersIssuingTransactionRefundParams) (*stripe.IssuingTransaction, error) {
    60  	return getC().Refund(id, params)
    61  }
    62  
    63  // Refund is the method for the `POST /v1/test_helpers/issuing/transactions/{transaction}/refund` API.
    64  func (c Client) Refund(id string, params *stripe.TestHelpersIssuingTransactionRefundParams) (*stripe.IssuingTransaction, error) {
    65  	path := stripe.FormatURLPath(
    66  		"/v1/test_helpers/issuing/transactions/%s/refund",
    67  		id,
    68  	)
    69  	transaction := &stripe.IssuingTransaction{}
    70  	err := c.B.Call(http.MethodPost, path, c.Key, params, transaction)
    71  	return transaction, err
    72  }
    73  
    74  func getC() Client {
    75  	return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
    76  }