예제 #1
0
    def setUp(self) -> None:
        super(SubscriptionIntegrationTest, self).setUp()
        self.client = getnet.Client(
            os.environ.get("GETNET_SELLER_ID"),
            os.environ.get("GETNET_CLIENT_ID"),
            os.environ.get("GETNET_CLIENT_SECRET"),
            getnet.api.HOMOLOG,
        )
        self.service = Service(self.client)

        customer_service = customers.Service(self.client)
        customer = Customer(**customer_sample.copy())
        customer.customer_id = str(uuid.uuid4())
        customer.document_number = str(random())[2:13]
        self.customer = customer_service.create(customer)

        plan_service = plans.Service(self.client)
        self.plan = plan_service.create(
            plans.Plan(
                seller_id=self.client.seller_id,
                name="Plan Demo",
                description="Plan Demo",
                amount=1990,
                currency="BRL",
                product_type="service",
                period={
                    "type": "monthly",
                    "billing_cycle": 12,
                },
            ))

        self.card = Card(**card_sample.copy())
예제 #2
0
    def testCreate(self):
        data = sample.copy()
        data["document_number"] = "01234567888"

        customer = self.service.create(Customer(**data))
        self.assertIsInstance(customer, Customer)
        self.assertEqual(data.get("customer_id"), customer.customer_id)
예제 #3
0
    def testGet(self):
        data = sample.copy()
        data["customer_id"] = "test_integration_get"
        data["document_number"] = "01234567811"
        created_customer = self.service.create(Customer(**data))

        customer = self.service.get(created_customer.customer_id)

        self.assertIsInstance(customer, Customer)
        self.assertEqual(created_customer, customer)
        self.assertEqual(created_customer.customer_id, customer.customer_id)
예제 #4
0
 def setUp(self) -> None:
     super(PaymentCreditIntegrationTest, self).setUp()
     self.client = getnet.Client(
         os.environ.get("GETNET_SELLER_ID"),
         os.environ.get("GETNET_CLIENT_ID"),
         os.environ.get("GETNET_CLIENT_SECRET"),
         getnet.api.HOMOLOG,
     )
     self.service = Service(self.client)
     self.order = Order("6d2e4380-d8a3-4ccb-9138-c289182818a3", 0,
                        "physical_goods")
     self.customer = Customer(**customer_sample.copy())
예제 #5
0
 def setUp(self) -> None:
     data = sample.copy()
     data["status"] = "active"
     self.sample = data
예제 #6
0
 def setUp(self) -> None:
     self.order = Order("6d2e4380-d8a3-4ccb-9138-c289182818a3", 0,
                        "physical_goods")
     self.customer = Customer(**customer_sample.copy())
     self.card = Card(**card_sample.copy())