コード例 #1
0
def prepare_bluevia_refund(data):
    issued_at = calendar.timegm(time.gmtime())
    return sign_bluevia_jwt({
                'iss': 'developerIdentifier',  # placeholder
                'typ': 'tu.com/payments/v1/refund',
                'aud': 'tu.com',
                'iat': issued_at,
                'exp': issued_at + 3600,  # expires in 1 hour
                'request': {
                    'refund': data['id'],
                    'reason': 'refund'
                }
            })
コード例 #2
0
def prepare_bluevia_pay(data):
    issued_at = calendar.timegm(time.gmtime())
    return sign_bluevia_jwt({
                'iss': 'marketplaceID',  # placeholder
                'typ': 'tu.com/payments/inapp/v1',
                'aud': 'tu.com',
                'iat': issued_at,
                'exp': issued_at + 3600,  # expires in 1 hour
                'request': {
                    'name': data['app_name'],
                    'description': data['app_description'],
                    'price': data['prices'],
                    'defaultPrice': data['currency'],
                    'postbackURL': data['postback_url'],
                    'chargebackURL': data['chargeback_url'],
                    'productData': data['product_data']
                }
            })
コード例 #3
0
 def test_notifies(self, _notify):
     data = sign_bluevia_jwt(refund)
     res = self.client.post(self.url, data, content_type='application/json')
     eq_(res.status_code, 200)
     assert _notify.called
コード例 #4
0
 def test_encode(self):
     data = sign_bluevia_jwt(refund)
     res = self.client.post(self.url, data, content_type='application/json')
     eq_(res.status_code, 200)
     eq_(self.sale.is_refunded(), True)
コード例 #5
0
 def test_notifies(self, _notify):
     data = sign_bluevia_jwt(refund)
     res = self.client.post(self.url, data, content_type='application/json')
     eq_(res.status_code, 200)
     assert _notify.called
コード例 #6
0
 def test_encode(self):
     data = sign_bluevia_jwt(refund)
     res = self.client.post(self.url, data, content_type='application/json')
     eq_(res.status_code, 200)
     eq_(self.sale.is_refunded(), True)