Permalink
Browse files

Create temp paypal web experience profiles

  • Loading branch information...
brycekahle committed Jun 14, 2018
1 parent 0122eac commit 94f2ab733a20ee5cab1589e584cdc0b6fa114d31
Showing with 14 additions and 20 deletions.
  1. +5 −1 api/payments_test.go
  2. +4 −4 glide.lock
  3. +1 −1 glide.yaml
  4. +4 −14 payments/paypal/paypal.go
View
@@ -431,7 +431,11 @@ func TestPaymentPreauthorize(t *testing.T) {
loginCount++
case "/v1/payment-experience/web-profiles":
w.Header().Add("Content-Type", "application/json")
fmt.Fprint(w, `[{"id":"expid","name":"gocommerce"}]`)
if r.Method == http.MethodGet {
fmt.Fprint(w, `[{"id":"expid","name":"gocommerce"}]`)
} else {
fmt.Fprint(w, `{"id":"expid","name":"gocommerce-asdf"}`)
}
case "/v1/payments/payment":
w.Header().Add("Content-Type", "application/json")
fmt.Fprint(w, `{"id":"`+paymentID+`"}`)
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -25,7 +25,7 @@ import:
- package: github.com/mattes/vat
- package: github.com/pkg/errors
version: ^0.7.1
- package: github.com/logpacker/PayPal-Go-SDK
- package: github.com/netlify/PayPal-Go-SDK
- package: github.com/go-chi/chi
version: v3.1.0
- package: github.com/sirupsen/logrus
View
@@ -8,10 +8,11 @@ import (
"strconv"
"sync"
paypalsdk "github.com/logpacker/PayPal-Go-SDK"
paypalsdk "github.com/netlify/PayPal-Go-SDK"
"github.com/netlify/gocommerce/conf"
gcontext "github.com/netlify/gocommerce/context"
"github.com/netlify/gocommerce/payments"
"github.com/pborman/uuid"
"github.com/pkg/errors"
)
@@ -183,20 +184,9 @@ func (p *paypalPaymentProvider) getExperience() (*paypalsdk.WebProfile, error) {
return p.profile, nil
}
experiences, err := p.client.GetWebProfiles()
if err != nil {
return nil, errors.Wrap(err, "failed getting web profiles")
}
for _, profile := range experiences {
if profile.Name == "gocommerce" {
p.profile = &profile
return p.profile, nil
}
}
profile, err := p.client.CreateWebProfile(paypalsdk.WebProfile{
Name: "gocommerce",
Name: "gocommerce-" + uuid.NewRandom().String(),
Temporary: true,
InputFields: paypalsdk.InputFields{
NoShipping: 1,
},

0 comments on commit 94f2ab7

Please sign in to comment.