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

Commit

Permalink
Add merchant order reference to Paypal Payflow auth request (#259)
Browse files Browse the repository at this point in the history
Use the COMMENT1 field for merchant order reference in paypal payflow auth request.
  • Loading branch information
linw50 authored Aug 1, 2023
1 parent 1ac8771 commit 7a2db48
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions gateways/paypalpayflow/paypalpayflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (client *PaypalPayflowClient) sendRequest(ctx context.Context, request *Req
"BILLTOCOUNTRY": request.BillToCountry,
"CARDONFILE": request.CardOnFile,
"TXID": request.TxID,
"COMMENT1": request.Comment1,
}
for k, v := range fields {
switch v := v.(type) {
Expand Down
1 change: 1 addition & 0 deletions gateways/paypalpayflow/request_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func buildAuthorizeParams(request *sleet.AuthorizationRequest) *Request {
BillToCountry: request.BillingAddress.CountryCode,
CardOnFile: CardOnFile,
TxID: request.PreviousExternalTransactionID,
Comment1: &request.MerchantOrderReference,
}
}

Expand Down
4 changes: 4 additions & 0 deletions gateways/paypalpayflow/request_builders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func TestBuildAuthRequest(t *testing.T) {
BillToStreet: visaBase.BillingAddress.StreetAddress1,
BillToStreet2: visaBase.BillingAddress.StreetAddress2,
BillToCountry: visaBase.BillingAddress.CountryCode,
Comment1: &visaBase.MerchantOrderReference,
},
},
{
Expand All @@ -78,6 +79,7 @@ func TestBuildAuthRequest(t *testing.T) {
BillToStreet: visaBase.BillingAddress.StreetAddress1,
BillToStreet2: visaBase.BillingAddress.StreetAddress2,
BillToCountry: visaBase.BillingAddress.CountryCode,
Comment1: &visaBase.MerchantOrderReference,
},
},
{
Expand All @@ -98,6 +100,7 @@ func TestBuildAuthRequest(t *testing.T) {
BillToStreet: visaBase.BillingAddress.StreetAddress1,
BillToStreet2: visaBase.BillingAddress.StreetAddress2,
BillToCountry: visaBase.BillingAddress.CountryCode,
Comment1: &visaBase.MerchantOrderReference,
},
},
{
Expand All @@ -118,6 +121,7 @@ func TestBuildAuthRequest(t *testing.T) {
BillToStreet: visaBase.BillingAddress.StreetAddress1,
BillToStreet2: visaBase.BillingAddress.StreetAddress2,
BillToCountry: visaBase.BillingAddress.CountryCode,
Comment1: &visaBase.MerchantOrderReference,
},
},
}
Expand Down
1 change: 1 addition & 0 deletions gateways/paypalpayflow/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Request struct {
BillToCountry *string // country code
CardOnFile *string
TxID *string
Comment1 *string // merchant order reference
}

type Response map[string]string

0 comments on commit 7a2db48

Please sign in to comment.