def test_cpc_edit_no_transaction_id(self): cpc_data = HpsCPCData() cpc_data.card_holder_po_number = '12345' cpc_data.tax_type = HpsTaxType.sales_tax cpc_data.tax_amount = 0.06 builder = self.service.cpc_edit()\ .with_cpc_data(cpc_data) self.assertRaises(HpsArgumentException, builder.execute)
def test_032_level_ii_no_response(self): card_holder = HpsCardHolder() card_holder.address = HpsAddress() card_holder.address.address = '6860' card_holder.address.zip = '75024' card = HpsCreditCard() card.number = '372700699251018' card.exp_month = 12 card.exp_year = 2025 card.cvv = 1234 response = self.service.charge(111.13)\ .with_card(card)\ .with_card_holder(card_holder)\ .with_cpc_req(True)\ .execute() self.assertIsNotNone(response) self.assertEqual('00', response.response_code) self.assertEqual('0', response.cpc_indicator) cpc_data = HpsCPCData('9876543210', HpsTaxType.tax_exempt) cpc_response = self.service.cpc_edit(response.transaction_id)\ .with_cpc_data(cpc_data)\ .execute() self.assertIsNotNone(cpc_response) self.assertEqual('00', cpc_response.response_code)
def test_027_level_ii_response_s(self): card_holder = HpsCardHolder() card_holder.address = HpsAddress() card_holder.address.address = '6860' card_holder.address.zip = '75024' card = HpsCreditCard() card.number = '5473500000000014' card.exp_month = 12 card.exp_year = 2025 card.cvv = 123 response = self.service.charge(111.08)\ .with_card(card)\ .with_card_holder(card_holder)\ .with_cpc_req(True)\ .execute() self.assertIsNotNone(response) self.assertEqual('00', response.response_code) self.assertEqual('S', response.cpc_indicator) cpc_data = HpsCPCData('9876543210', HpsTaxType.sales_tax, 1.00) cpc_response = self.service.cpc_edit(response.transaction_id)\ .with_cpc_data(cpc_data)\ .execute() self.assertIsNotNone(cpc_response) self.assertEqual('00', cpc_response.response_code)
def test_023_level_ii_response_r(self): card_holder = HpsCardHolder() card_holder.address = HpsAddress() card_holder.address.address = '6860' card_holder.address.zip = '75024' card = HpsCreditCard() card.number = '4012002000060016' card.exp_month = 12 card.exp_year = 2025 card.cvv = 123 response = self.service.charge(123.45)\ .with_card(card)\ .with_card_holder(card_holder)\ .with_cpc_req(True)\ .execute() self.assertIsNotNone(response) self.assertEqual('00', response.response_code) self.assertEqual('R', response.cpc_indicator) cpc_data = HpsCPCData('', HpsTaxType.tax_exempt) cpc_response = self.service.cpc_edit(response.transaction_id)\ .with_cpc_data(cpc_data)\ .execute() self.assertIsNotNone(cpc_response) self.assertEqual('00', cpc_response.response_code)
def test_021_level_ii_response_b(self): card_holder = HpsCardHolder() card_holder.address = HpsAddress() card_holder.address.address = '6860 Dallas Pkwy' card_holder.address.zip = '750241234' card = HpsCreditCard() card.number = '4012002000060016' card.exp_month = 12 card.exp_year = 2025 card.cvv = 123 response = self.service.charge(112.34)\ .with_card(card)\ .with_card_holder(card_holder)\ .with_cpc_req(True)\ .execute() self.assertIsNotNone(response) self.assertEqual('00', response.response_code) self.assertEqual('B', response.cpc_indicator) cpc_data = HpsCPCData('9876543210', HpsTaxType.not_used) cpc_response = self.service.cpc_edit(response.transaction_id)\ .with_cpc_data(cpc_data)\ .execute() self.assertIsNotNone(cpc_response) self.assertEqual('00', cpc_response.response_code)
def test_visa_auth_cpc_req_should_return_purchasing(self): """ Visa auth and CPC Req should return cpcIndicator 'S'. """ charge_response = self.charge_service.authorize( 134.56, 'usd', TestCreditCard.valid_visa, TestCardHolder.valid_card_holder, cpc_req=True ) self.assertEquals('00', charge_response.response_code) self.assertEquals('S', charge_response.cpc_indicator) cpc_data = HpsCPCData() cpc_data.card_holder_po_number = '123456789' cpc_data.tax_type = HpsTaxType.sales_tax cpc_data.tax_amount = '15' edit_response = self.charge_service.cpc_edit(charge_response.transaction_id, cpc_data) self.assertEquals('00', edit_response.response_code)
def test_cpc_edit(self): charge = self.service.charge(10)\ .with_card(TestCreditCard.valid_visa)\ .with_card_holder(TestCardHolder.valid_card_holder)\ .with_allow_duplicates(True)\ .execute() self.assertIsNotNone(charge.transaction_id) cpc_data = HpsCPCData() cpc_data.card_holder_po_number = '12345' cpc_data.tax_type = HpsTaxType.sales_tax cpc_data.tax_amount = 0.06 cpc_edit = self.service.cpc_edit()\ .with_transaction_id(charge.transaction_id)\ .with_cpc_data(cpc_data)\ .execute() self.assertIsNotNone(cpc_edit) self.assertEqual('00', cpc_edit.response_code)