-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #221 from SkynetLabs/ivo/fix_stripe_subs_cancelling
Fix Stripe duplicate sub canceling.
- Loading branch information
Showing
5 changed files
with
54 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package api | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
"github.com/stripe/stripe-go/v72" | ||
) | ||
|
||
// TestStripePrices ensures that we work with the correct set of prices. | ||
func TestStripePrices(t *testing.T) { | ||
// Set the Stripe key to a live key. | ||
stripe.Key = "sk_live_FAKE_LIVE_KEY" | ||
// Make sure we got the prod prices we expect. | ||
if !reflect.DeepEqual(StripePrices(), stripePricesProd) { | ||
t.Fatal("Expected prod prices, got something else.") | ||
} | ||
// Set the Stripe key to a test key. | ||
stripe.Key = "sk_test_FAKE_TEST_KEY" | ||
// Make sure we got the prod prices we expect. | ||
if !reflect.DeepEqual(StripePrices(), stripePricesTest) { | ||
t.Fatal("Expected test prices, got something else.") | ||
} | ||
} | ||
|
||
// TestStripeTestMode ensures that we detect test mode accurately. | ||
func TestStripeTestMode(t *testing.T) { | ||
// Set the Stripe key to a live key. | ||
stripe.Key = "sk_live_FAKE_LIVE_KEY" | ||
// Expect test mode to be off. | ||
if StripeTestMode() { | ||
t.Fatal("Expected live mode, got test mode.") | ||
} | ||
// Set the Stripe key to a test key. | ||
stripe.Key = "sk_test_FAKE_TEST_KEY" | ||
// Expect test mode to be on. | ||
if !StripeTestMode() { | ||
t.Fatal("Expected test mode, got live mode.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters