Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Fix Paypal Payflow (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorhorobets-bolt committed Jun 22, 2022
1 parent 1b9a051 commit 24c7f89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gateways/paypalpayflow/paypalpayflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package paypalpayflow
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"

Expand Down Expand Up @@ -75,8 +74,9 @@ func (client *PaypalPayflowClient) sendRequest(request *Request) (*Response, *ht

req, err := http.NewRequest("POST", client.url, strings.NewReader(data))
if err != nil {
log.Fatal(err)
return nil, nil, err
}

req.Header.Add("User-Agent", common.UserAgent())
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

Expand Down
8 changes: 6 additions & 2 deletions gateways/paypalpayflow/request_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,16 @@ func buildVoidParams(request *sleet.VoidRequest) *Request {
}

func buildRefundParams(request *sleet.RefundRequest) *Request {
amount := sleet.AmountToDecimalString(request.Amount)
var amount *string = nil
if request.Amount != nil {
res := sleet.AmountToDecimalString(request.Amount)
amount = &res
}
return &Request{
TrxType: REFUND,
OriginalID: &request.TransactionReference,
Verbosity: &defaultVerbosity,
Tender: &defaultTender,
Amount: &amount,
Amount: amount,
}
}

0 comments on commit 24c7f89

Please sign in to comment.