stripe-tests 2.2.1 → 2.2.2
raw patch · 4 files changed
+139/−130 lines, 4 filesdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson
API changes (from Hackage documentation)
Files
- stripe-tests.cabal +2/−2
- tests/Web/Stripe/Test/AllTests.hs +1/−1
- tests/Web/Stripe/Test/Card.hs +93/−84
- tests/Web/Stripe/Test/Transfer.hs +43/−43
stripe-tests.cabal view
@@ -1,5 +1,5 @@ name: stripe-tests-version: 2.2.1+version: 2.2.2 synopsis: Tests for Stripe API bindings for Haskell license: MIT license-file: LICENSE@@ -22,7 +22,7 @@ library hs-source-dirs: tests- build-depends: aeson >= 0.8 && < 0.10 || >= 0.11 && < 1.1+ build-depends: aeson >= 0.8 && < 0.10 || >= 0.11 && < 1.3 , base >= 4.7 && < 5 , bytestring >= 0.10 && < 0.11 , free >= 4.10 && < 4.13
tests/Web/Stripe/Test/AllTests.hs view
@@ -46,7 +46,7 @@ invoiceItemTests stripe disputeTests stripe transferTests stripe- recipientTests stripe+-- recipientTests stripe applicationFeeTests stripe applicationFeeRefundTests stripe accountTests stripe
tests/Web/Stripe/Test/Card.hs view
@@ -115,23 +115,25 @@ cardAddressZip `shouldBe` (Just cardzip) describe "Recipient Card tests" $ do- it "Can create a RecipientCard by CardNumber" $ do- result <- stripe $ do- r@Recipient{..} <- createRecipient name Individual -&- debitinfo- void $ deleteRecipient recipientId- return r- result `shouldSatisfy` isRight- let Right Recipient {..} = result- length (list recipientCards) `shouldBe` 1+ -- # Deprecated #+ -- it "Can create a RecipientCard by CardNumber" $ do+ -- result <- stripe $ do+ -- r@Recipient{..} <- createRecipient name Individual -&- debitinfo+ -- void $ deleteRecipient recipientId+ -- return r+ -- result `shouldSatisfy` isRight+ -- let Right Recipient {..} = result+ -- length (list recipientCards) `shouldBe` 1 - it "Can create a RecipientCard by Card TokenId" $ do- result <- stripe $ do- Token { tokenId = tkid } <- createCardToken (Just debitinfo)- Recipient { recipientId = rid } <- createRecipient name Individual- rcard <- createRecipientCardByToken rid tkid- void $ deleteRecipient rid- return rcard- result `shouldSatisfy` isRight+ -- Deprecated+ -- it "Can create a RecipientCard by Card TokenId" $ do+ -- result <- stripe $ do+ -- Token { tokenId = tkid } <- createCardToken (Just debitinfo)+ -- Recipient { recipientId = rid } <- createRecipient name Individual+ -- rcard <- createRecipientCardByToken rid tkid+ -- void $ deleteRecipient rid+ -- return rcard+ -- result `shouldSatisfy` isRight it "Fails to create a RecipientCard by BankAccount TokenId" $ do result <- stripe $ do@@ -142,80 +144,87 @@ return rcard result `shouldSatisfy` isLeft - it "Can retrieve a RecipientCard" $ do- result <- stripe $ do- Recipient{..} <- createRecipient name Individual -&- debitinfo- let (Id cardid) = fromJust recipientDefaultCard- rcard <- getRecipientCard recipientId cardid- void $ deleteRecipient recipientId- return rcard- result `shouldSatisfy` isRight+ -- # Deprecated+ -- it "Can retrieve a RecipientCard" $ do+ -- result <- stripe $ do+ -- Recipient{..} <- createRecipient name Individual -&- debitinfo+ -- let (Id cardid) = fromJust recipientDefaultCard+ -- rcard <- getRecipientCard recipientId cardid+ -- void $ deleteRecipient recipientId+ -- return rcard+ -- result `shouldSatisfy` isRight - it "Can retrieve a RecipientCard Expanded" $ do- result <- stripe $ do- Recipient{..} <- createRecipient name Individual -&- debitinfo- let (Id cardid) = fromJust recipientDefaultCard- rcard <- getRecipientCard recipientId cardid -&- ExpandParams ["recipient"]- void $ deleteRecipient recipientId- return rcard- result `shouldSatisfy` isRight+ -- # Deprecated+ -- it "Can retrieve a RecipientCard Expanded" $ do+ -- result <- stripe $ do+ -- Recipient{..} <- createRecipient name Individual -&- debitinfo+ -- let (Id cardid) = fromJust recipientDefaultCard+ -- rcard <- getRecipientCard recipientId cardid -&- ExpandParams ["recipient"]+ -- void $ deleteRecipient recipientId+ -- return rcard+ -- result `shouldSatisfy` isRight - it "Can retrieve a Recipient's Cards" $ do- result <- stripe $ do- Recipient{..} <- createRecipient name Individual -&- debitinfo- rcard <- getRecipientCards recipientId- void $ deleteRecipient recipientId- return rcard- result `shouldSatisfy` isRight+ -- # Deprecated+ -- it "Can retrieve a Recipient's Cards" $ do+ -- result <- stripe $ do+ -- Recipient{..} <- createRecipient name Individual -&- debitinfo+ -- rcard <- getRecipientCards recipientId+ -- void $ deleteRecipient recipientId+ -- return rcard+ -- result `shouldSatisfy` isRight - it "Can retrieve a Recipient's Cards Expanded" $ do- result <- stripe $ do- Recipient{..} <- createRecipient name Individual -&- debitinfo- rcard <- getRecipientCards recipientId -&- ExpandParams ["data.recipient"]- void $ deleteRecipient recipientId- return rcard- result `shouldSatisfy` isRight+ -- # Deprecated+ -- it "Can retrieve a Recipient's Cards Expanded" $ do+ -- result <- stripe $ do+ -- Recipient{..} <- createRecipient name Individual -&- debitinfo+ -- rcard <- getRecipientCards recipientId -&- ExpandParams ["data.recipient"]+ -- void $ deleteRecipient recipientId+ -- return rcard+ -- result `shouldSatisfy` isRight - it "Can delete a Recipient Card" $ do- result <- stripe $ do- Recipient{..} <- createRecipient name Individual -&- debitinfo- let (Id defaultCard) = fromJust recipientDefaultCard- rcard <- deleteRecipientCard recipientId defaultCard- void $ deleteRecipient recipientId- return rcard- result `shouldSatisfy` isRight+ -- # Deprecated+ -- it "Can delete a Recipient Card" $ do+ -- result <- stripe $ do+ -- Recipient{..} <- createRecipient name Individual -&- debitinfo+ -- let (Id defaultCard) = fromJust recipientDefaultCard+ -- rcard <- deleteRecipientCard recipientId defaultCard+ -- void $ deleteRecipient recipientId+ -- return rcard+ -- result `shouldSatisfy` isRight - it "Can update a Recipient's Card" $ do- result <- stripe $ do- Recipient{..} <- createRecipient name Individual -&- debitinfo- let (Id cardid) = fromJust recipientDefaultCard- rcard@RecipientCard{..} <-- updateRecipientCard recipientId cardid- -&- cardname- -&- cardcity- -&- cardcountry- -&- cardaddressOne- -&- cardaddressTwo- -&- cardaddressState- -&- cardzip- void $ deleteRecipient recipientId- return rcard- result `shouldSatisfy` isRight- let Right RecipientCard{..} = result- recipientCardName `shouldBe` (Just cardname)- recipientCardAddressCity `shouldBe` (Just cardcity)- recipientCardAddressCountry `shouldBe` (Just cardcountry)- recipientCardAddressLine1 `shouldBe` (Just cardaddressOne)- recipientCardAddressLine2 `shouldBe` (Just cardaddressTwo)- recipientCardAddressState `shouldBe` (Just cardaddressState)- recipientCardAddressZip `shouldBe` (Just cardzip)+ -- # Deprecated+ -- it "Can update a Recipient's Card" $ do+ -- result <- stripe $ do+ -- Recipient{..} <- createRecipient name Individual -&- debitinfo+ -- let (Id cardid) = fromJust recipientDefaultCard+ -- rcard@RecipientCard{..} <-+ -- updateRecipientCard recipientId cardid+ -- -&- cardname+ -- -&- cardcity+ -- -&- cardcountry+ -- -&- cardaddressOne+ -- -&- cardaddressTwo+ -- -&- cardaddressState+ -- -&- cardzip+ -- void $ deleteRecipient recipientId+ -- return rcard+ -- result `shouldSatisfy` isRight+ -- let Right RecipientCard{..} = result+ -- recipientCardName `shouldBe` (Just cardname)+ -- recipientCardAddressCity `shouldBe` (Just cardcity)+ -- recipientCardAddressCountry `shouldBe` (Just cardcountry)+ -- recipientCardAddressLine1 `shouldBe` (Just cardaddressOne)+ -- recipientCardAddressLine2 `shouldBe` (Just cardaddressTwo)+ -- recipientCardAddressState `shouldBe` (Just cardaddressState)+ -- recipientCardAddressZip `shouldBe` (Just cardzip) - it "Fails to add a Credit Card to a Recipient" $ do- result <- stripe $ do- r <- createRecipient name Individual -&- cardinfo- void $ deleteRecipient (recipientId r)- return r- result `shouldSatisfy` isLeft+ -- # Deprecated+ -- it "Fails to add a Credit Card to a Recipient" $ do+ -- result <- stripe $ do+ -- r <- createRecipient name Individual -&- cardinfo+ -- void $ deleteRecipient (recipientId r)+ -- return r+ -- result `shouldSatisfy` isLeft where cardinfo = (mkNewCard credit em ey) { newCardCVC = Just cvc }
tests/Web/Stripe/Test/Transfer.hs view
@@ -17,34 +17,34 @@ transferTests :: StripeSpec transferTests stripe = describe "Transfer tests" $ do- it "Create a new transfer" $ do- result <- stripe $ do- Recipient { recipientId = rid } <-- createRecipient name Individual -&- bankinfo- transfer <- createTransfer rid (Amount 100) USD- void $ deleteRecipient rid- return transfer- result `shouldSatisfy` isRight- it "Retrieves a transfer" $ do- result <- stripe $ do- Recipient { recipientId = rid } <-- createRecipient name Individual -&- bankinfo- Transfer { transferId = tid }- <- createTransfer rid (Amount 100) USD- t <- getTransfer tid- void $ deleteRecipient rid- return t- result `shouldSatisfy` isRight- it "Retrieves a transfer expandable" $ do- result <- stripe $ do- Recipient { recipientId = rid } <-- createRecipient name Individual -&- bankinfo- Transfer { transferId = tid }- <- createTransfer rid (Amount 100) USD- t <- getTransfer tid -&- ExpandParams ["recipient", "balance_transaction"]- void $ deleteRecipient rid- return t- result `shouldSatisfy` isRight+ -- it "Create a new transfer" $ do+ -- result <- stripe $ do+ -- Recipient { recipientId = rid } <-+ -- createRecipient name Individual -&- bankinfo+ -- transfer <- createTransfer rid (Amount 100) USD+ -- void $ deleteRecipient rid+ -- return transfer+ -- result `shouldSatisfy` isRight+ -- it "Retrieves a transfer" $ do+ -- result <- stripe $ do+ -- Recipient { recipientId = rid } <-+ -- createRecipient name Individual -&- bankinfo+ -- Transfer { transferId = tid }+ -- <- createTransfer rid (Amount 100) USD+ -- t <- getTransfer tid+ -- void $ deleteRecipient rid+ -- return t+ -- result `shouldSatisfy` isRight+ -- it "Retrieves a transfer expandable" $ do+ -- result <- stripe $ do+ -- Recipient { recipientId = rid } <-+ -- createRecipient name Individual -&- bankinfo+ -- Transfer { transferId = tid }+ -- <- createTransfer rid (Amount 100) USD+ -- t <- getTransfer tid -&- ExpandParams ["recipient", "balance_transaction"]+ -- void $ deleteRecipient rid+ -- return t+ -- result `shouldSatisfy` isRight it "Retrieves transfers" $ do result <- stripe $ do t <- getTransfers return t@@ -56,21 +56,21 @@ ] return t result `shouldSatisfy` isRight- it "Updates a transfer" $ do- result <- stripe $ do- Recipient { recipientId = rid } <-- createRecipient name Individual -&- bankinfo- Transfer { transferId = tid }- <- createTransfer rid (Amount 100) USD- t <- updateTransfer tid- -&- (Description "hey there")- -&- (MetaData [("hey", "there")])- void $ deleteRecipient rid- return t- result `shouldSatisfy` isRight- let Right Transfer {..} = result- transferMetaData `shouldBe` (MetaData [("hey", "there")])- transferDescription `shouldBe` (Just (Description "hey there"))+ -- it "Updates a transfer" $ do+ -- result <- stripe $ do+ -- Recipient { recipientId = rid } <-+ -- createRecipient name Individual -&- bankinfo+ -- Transfer { transferId = tid }+ -- <- createTransfer rid (Amount 100) USD+ -- t <- updateTransfer tid+ -- -&- (Description "hey there")+ -- -&- (MetaData [("hey", "there")])+ -- void $ deleteRecipient rid+ -- return t+ -- result `shouldSatisfy` isRight+ -- let Right Transfer {..} = result+ -- transferMetaData `shouldBe` (MetaData [("hey", "there")])+ -- transferDescription `shouldBe` (Just (Description "hey there")) it "Can't Cancel a committed transfer" $ do result <- stripe $ do Recipient { recipientId = rid } <-