コード例 #1
0
 def test_generate_timestamp(self):
     timestamp = pympesa.generate_timestamp()
     print timestamp
     self.assertIsInstance(timestamp, str)
     self.assertTrue(timestamp.isdigit())
     self.assertEqual(int(timestamp[:4]), datetime.datetime.now().year)
     self.assertEqual(int(timestamp[4:6]), datetime.datetime.now().month)
     self.assertEqual(int(timestamp[6:8]), datetime.datetime.now().day)
コード例 #2
0
ファイル: test_pympesa.py プロジェクト: tonykurya/pympesa
 def test_lipa_na_mpesa_online_payment(self):
     self.skipTest("Not Working")
     resp = self.client.lipa_na_mpesa_online_payment(
         BusinessShortCode=self.online_short_code,
         Password=self.online_pass_key,
         Timestamp=pympesa.generate_timestamp(),
         TransactionType="CustomerPayBillOnline",
         Amount=100,
         PartyA=self.test_msisdn,
         PartyB=self.short_code_1,
         PhoneNumber=self.test_msisdn,
         CallBackURL=self.validation_url,
         AccountReference="pympesa-dev-test",
         TransactionDesc="pympesa-dev-test")
     self.assertEqual(resp.status_code, 200)
     result = resp.json()
     self.assertIn("ResponseCode", result)