package features_paypal import ( "github.com/gofiber/fiber/v2" "net/http" "net/http/httptest" mockserver "github.com/plutov/paypal/v4/mockserver" srvPayouts "github.com/plutov/paypal/v4/mockserver/payments_payouts_batch_v1" srvShipping "github.com/plutov/paypal/v4/mockserver/shipping_shipment_tracking_v1" "MY/webapp/config" ) var PAYPAL *httptest.Server = nil func createTestServer() *httptest.Server { mock := &mockserver.MockServer{} mux := http.NewServeMux() payoutsSI := srvPayouts.NewStrictHandler(mock, nil) srvPayouts.HandlerWithOptions(payoutsSI, srvPayouts.StdHTTPServerOptions{ BaseRouter: mux, }) shippingSI := srvShipping.NewStrictHandler(mock, nil) srvShipping.HandlerWithOptions(shippingSI, srvShipping.StdHTTPServerOptions{ BaseRouter: mux, }) return httptest.NewServer(mux) } func Setup(app *fiber.App) { // if you don't set the URL then use a fake mock if config.Settings.Paypal.URL == "" { PAYPAL = createTestServer() config.Settings.Paypal.URL = PAYPAL.URL } SetupApi(app) SetupViews(app) }