コード例 #1
0
ファイル: client.py プロジェクト: aliscott/gocardless-python
    def create_bill(self, amount, pre_auth_id, name=None, description=None):
        """Creates a new bill under an existing pre_authorization

        :param amount: The amount to bill
        :param pre_auth_id: The id of an existing pre_authorization which
          has not expire
        :param name: A name for this bill
        :param description: A description for this bill

        """
        return Bill.create_under_preauth(amount, pre_auth_id, self, name=name, description=description)
コード例 #2
0
ファイル: client.py プロジェクト: pegler/gocardless-python
    def create_bill(self, amount, pre_auth_id, name=None,
                    description=None, charge_customer_at=None):
        """Creates a new bill under an existing pre_authorization

        :param amount: The amount to bill
        :param pre_auth_id: The id of an existing pre_authorization which
          has not expire
        :param name: A name for this bill
        :param description: A description for this bill
        :param charge_customer_at: When a payment will leave the customer's account

        """
        return Bill.create_under_preauth(amount, pre_auth_id, self, name=name,
                                         description=description, charge_customer_at=charge_customer_at)
コード例 #3
0
 def test_create_bill_calls_client_api_post(self):
     client = mock.Mock()
     client.api_post.return_value = fixtures.bill_json
     result = Bill.create_under_preauth(10, "1234", client, name="aname",
             description="adesc")
     self.assertIsInstance(result, Bill)
     expected_params = {
             "bill":{
                 "amount":10,
                 "pre_authorization_id":"1234",
                 "name":"aname",
                 "description":"adesc"
                 }
             }
     client.api_post.assert_called_with("/bills", expected_params)
コード例 #4
0
 def test_create_bill_calls_client_api_post(self):
     client = mock.Mock()
     client.api_post.return_value = fixtures.bill_json
     result = Bill.create_under_preauth(10,
                                        "1234",
                                        client,
                                        name="aname",
                                        description="adesc",
                                        charge_customer_at="2013-08-27")
     self.assertIsInstance(result, Bill)
     expected_params = {
         "bill": {
             "amount": 10,
             "pre_authorization_id": "1234",
             "name": "aname",
             "description": "adesc",
             "charge_customer_at": "2013-08-27"
         }
     }
     client.api_post.assert_called_with("/bills", expected_params)
コード例 #5
0
    def create_bill(self,
                    amount,
                    pre_auth_id,
                    name=None,
                    description=None,
                    currency=None):
        """Creates a new bill under an existing pre_authorization

        :param amount: The amount to bill
        :param pre_auth_id: The id of an existing pre_authorization which
          has not expire
        :param name: A name for this bill
        :param description: A description for this bill

        """
        return Bill.create_under_preauth(amount,
                                         pre_auth_id,
                                         self,
                                         name=name,
                                         description=description,
                                         currency=currency)
コード例 #6
0
ファイル: client.py プロジェクト: pegler/gocardless-python
 def bill(self, id):
     """
     Find a bill with id `id`
     """
     return Bill.find_with_client(id, self)
コード例 #7
0
 def test_retry_post(self):
     client = mock.Mock()
     bill = Bill(fixtures.bill_json, client)
     bill.retry()
     retry_url = "/bills/{0}/retry".format(fixtures.bill_json["id"])
     client.api_post.assert_called_with(retry_url)
コード例 #8
0
 def test_cancel_put(self):
     client = mock.Mock()
     bill = Bill(fixtures.bill_json, client)
     bill.cancel()
     cancel_url = "/bills/{0}/cancel".format(fixtures.bill_json["id"])
     client.api_put.assert_called_with(cancel_url)
コード例 #9
0
 def bill(self, id):
     """
     Find a bill with id `id`
     """
     return Bill.find_with_client(id, self)
コード例 #10
0
 def test_refund_post(self):
     client = mock.Mock()
     bill = Bill(fixtures.bill_json, client)
     bill.refund()
     refund_url = "/bills/{0}/refund".format(fixtures.bill_json["id"])
     client.api_post.assert_called_with(refund_url)
コード例 #11
0
 def test_cancel_put(self):
     client = mock.Mock()
     bill = Bill(fixtures.bill_json, client)
     bill.cancel()
     cancel_url = "/bills/{0}/cancel".format(fixtures.bill_json["id"])
     client.api_put.assert_called_with(cancel_url)