This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SpaceShip(models.Model): | |
# Sample merchant product | |
model = models.CharField(max_length=255, blank=False, null=False) | |
price = models.DecimalField(max_digits=99, decimal_places=2) | |
currency = models.CharField(max_length=55, default='KES', blank=False, null=False) | |
def __str__(self): | |
return self.model | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@receiver(post_save, sender=Payment) | |
def call_payment_api(sender, instance, created, **kwargs): | |
if created: | |
# Initiate a Beyonic Collection Request to request money from the user | |
import beyonic | |
beyonic.api_key = settings.BEYONIC_API_KEY | |
response = beyonic.CollectionRequest.create( | |
phonenumber=instance.phone_number, | |
amount=instance.item.price, | |
currency=instance.item.currency, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SpaceShipListView(ListView): | |
model = SpaceShip | |
class SpaceShipPayment(View): | |
def get(self, request, *args, **kwargs): | |
""" | |
Get the item_id and phone_number from request to create a new payment | |
:param request: | |
:param args: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load qr_code %} | |
<h1>SpaceShips</h1> | |
<ul> | |
{% for spaceship in object_list %} | |
<li> | |
{{ spaceship.model }} | |
{% qr_from_text spaceship.pk size=8 version=12 %} | |
</li> | |
{% empty %} | |
<li>No spaceships yet.</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
private lateinit var mResultTextView: TextView | |
private lateinit var mPhonenumberTextView: TextView | |
private var b: Boolean? = false | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:beyonic_flutter_library/beyonicservice.dart'; | |
import 'package:beyonic_flutter_library/models/payments.dart'; | |
beyonic_service = BeyonicService(apiKey: your_api_key); | |
// load list of payments | |
Future <List<Payment>> _payments = beyonic_service.load(Payment.all, offset: 0); | |
// load single payment | |
Future <Payment> _payment = beyonic_service.load(Payment.single); |
OlderNewer