Skip to content

Commit

Permalink
Merge pull request #8 from frozzare/revert-5-make-go-swish-work-again
Browse files Browse the repository at this point in the history
Revert "Make go swish work again"
  • Loading branch information
frozzare authored Nov 16, 2018
2 parents 34c8199 + 9d60ec1 commit c4c8777
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 52 deletions.
48 changes: 27 additions & 21 deletions certs/root.pem
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
-----BEGIN CERTIFICATE-----
MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAw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6hFbQjL1XCBZn0W/ZguP9p7CSkq
VUzDA0vYTZO+fLSLXGMX4v2sKz3i1pCj7VZMLSSTjgDPlgqfG/o2OdS39WiEoguVUCOhZ8BctNnY
pDXepLj4r3Tlbq17scIwtFZ6Lfw4oiOgMmw2txybcwDtPXvVNgxXMEoJZwOckM+zagOFxWKgNu8F
MeRzcbCm82/nn7NE6+Gi5DLBPX03q9DMZ31DmebOFOcdiAdOTjTklmaN0JEjAGJBh6IBsZ0wwqvA
5s1h5RehB9olq0b0KgwHX+kkiGcpOkH5cZVFm6qKHAHh
-----END CERTIFICATE-----
Binary file modified certs/test.p12
Binary file not shown.
34 changes: 17 additions & 17 deletions endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ var (

// PaymentRequest represents a payment request from Swish API.
type PaymentRequest struct {
AdditionalInformation string `json:"additionalInformation,omitempty"`
Amount float64 `json:"amount,omitempty"`
CallbackURL string `json:"callbackUrl,omitempty"`
Currency string `json:"currency,omitempty"`
DateCreated string `json:"dateCreated,omitempty"`
DatePaid string `json:"datePaid,omitempty"`
ErrorCode string `json:"errorCode,omitempty"`
ErrorMessage string `json:"errorMessage,omitempty"`
ID string `json:"id,omitempty"`
Message string `json:"message,omitempty"`
PayeeAlias string `json:"payeeAlias,omitempty"`
PayeePaymentReference string `json:"payeePaymentReference,omitempty"`
PayerPaymentReference string `json:"payerPaymentReference,omitempty"`
PayerAlias string `json:"payerAlias,omitempty"`
PaymentReference string `json:"paymentReference,omitempty"`
OriginalPaymentReference string `json:"originalPaymentReference,omitempty"`
Status string `json:"status,omitempty"`
AdditionalInformation string `json:"additionalInformation,omitempty"`
Amount string `json:"amount,omitempty"`
CallbackURL string `json:"callbackUrl,omitempty"`
Currency string `json:"currency,omitempty"`
DateCreated string `json:"dateCreated,omitempty"`
DatePaid string `json:"datePaid,omitempty"`
ErrorCode string `json:"errorCode,omitempty"`
ErrorMessage string `json:"errorMessage,omitempty"`
ID string `json:"id,omitempty"`
Message string `json:"message,omitempty"`
PayeeAlias string `json:"payeeAlias,omitempty"`
PayeePaymentReference string `json:"payeePaymentReference,omitempty"`
PayerPaymentReference string `json:"payerPaymentReference,omitempty"`
PayerAlias string `json:"payerAlias,omitempty"`
PaymentReference string `json:"paymentReference,omitempty"`
OriginalPaymentReference string `json:"originalPaymentReference,omitempty"`
Status string `json:"status,omitempty"`
}

// CreatePaymentRequest will create a payment request to Swish and return a payment
Expand Down
24 changes: 12 additions & 12 deletions endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ func TestCreatePaymentRequest(t *testing.T) {
return resp, nil
},
expectedResult: &PaymentRequest{
ID: "AB23D7406ECE4542A80152D909EF9F6B",
ID: "AB23D7406ECE4542A80152D909EF9F6B",
PayeePaymentReference: "0123456789",
CallbackURL: "https://example.com/api/swishcb/paymentrequests",
PayerAlias: "46701234567",
PayeeAlias: "1234760039",
Amount: 100,
Amount: "100",
Currency: "SEK",
Message: "Kingston USB Flash Drive 8 GB",
},
Expand Down Expand Up @@ -83,7 +83,7 @@ func TestCreatePaymentRequest(t *testing.T) {
CallbackURL: "https://example.com/api/swishcb/paymentrequests",
PayerAlias: "46701234567",
PayeeAlias: "1234760039",
Amount: 100,
Amount: "100",
Currency: "SEK",
Message: "Kingston USB Flash Drive 8 GB",
})
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestPaymentRequest(t *testing.T) {
"callbackUrl": "https://example.com/api/swishcb/paymentrequests",
"payerAlias": "46701234567",
"payeeAlias": "1234760039",
"amount": 100,
"amount": "100",
"currency": "SEK",
"message": "Kingston USB Flash Drive 8 GB",
"status": "PAID",
Expand All @@ -127,13 +127,13 @@ func TestPaymentRequest(t *testing.T) {
`), nil
},
expectedResult: &PaymentRequest{
ID: "AB23D7406ECE4542A80152D909EF9F6B",
ID: "AB23D7406ECE4542A80152D909EF9F6B",
PayeePaymentReference: "0123456789",
PaymentReference: "6D6CD7406ECE4542A80152D909EF9F6B",
CallbackURL: "https://example.com/api/swishcb/paymentrequests",
PayerAlias: "46701234567",
PayeeAlias: "1234760039",
Amount: 100,
Amount: "100",
Currency: "SEK",
Message: "Kingston USB Flash Drive 8 GB",
Status: "PAID",
Expand Down Expand Up @@ -194,12 +194,12 @@ func TestCreateRefundRequest(t *testing.T) {
return resp, nil
},
expectedResult: &PaymentRequest{
ID: "AB23D7406ECE4542A80152D909EF9F6B",
ID: "AB23D7406ECE4542A80152D909EF9F6B",
OriginalPaymentReference: "AB23D7406ECE4542A80152D909EF9F6B",
PayerPaymentReference: "0123456789",
CallbackURL: "https://example.com/api/swishcb/paymentrequests",
PayerAlias: "46701234567",
Amount: 100,
Amount: "100",
Currency: "SEK",
Message: "Refund for Kingston USB Flash Drive 8 GB",
},
Expand Down Expand Up @@ -253,7 +253,7 @@ func TestCreateRefundRequest(t *testing.T) {
PayerPaymentReference: "0123456789",
CallbackURL: "https://example.com/api/swishcb/paymentrequests",
PayerAlias: "46701234567",
Amount: 100,
Amount: "100",
Currency: "SEK",
Message: "Refund for Kingston USB Flash Drive 8 GB",
})
Expand Down Expand Up @@ -287,7 +287,7 @@ func TestRefundRequest(t *testing.T) {
"callbackUrl": "https://example.com/api/swishcb/refunds",
"payerAlias": "46701234567",
"payeeAlias": "1234760039",
"amount": 100,
"amount": "100",
"currency": "SEK",
"message": "Refund for Kingston USB Flash Drive 8 GB",
"status": "PAID",
Expand All @@ -297,13 +297,13 @@ func TestRefundRequest(t *testing.T) {
`), nil
},
expectedResult: &PaymentRequest{
ID: "AB23D7406ECE4542A80152D909EF9F6B",
ID: "AB23D7406ECE4542A80152D909EF9F6B",
PayeePaymentReference: "0123456789",
PaymentReference: "6D6CD7406ECE4542A80152D909EF9F6B",
CallbackURL: "https://example.com/api/swishcb/refunds",
PayerAlias: "46701234567",
PayeeAlias: "1234760039",
Amount: 100,
Amount: "100",
Currency: "SEK",
Message: "Refund for Kingston USB Flash Drive 8 GB",
Status: "PAID",
Expand Down
4 changes: 2 additions & 2 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ func init() {

func create(w http.ResponseWriter, r *http.Request) {
res, err := client.CreatePaymentRequest(context.Background(), &swish.PaymentRequest{
CallbackURL: "https://c06610e4.ngrok.io/callback",
CallbackURL: "https://c06610e4.ngrok.io",
PayeePaymentReference: "0123456789",
PayeeAlias: "1231181189",
Amount: 100.00,
Amount: "100.00",
Currency: "SEK",
Message: "Kingston USB Flash Drive 8 GB",
})
Expand Down

0 comments on commit c4c8777

Please sign in to comment.