Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
 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)
Ejemplo n.º 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)
Ejemplo n.º 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)