Commit 4d12f004da242e415fd01404a84246dea28ace2f
1 parent
e6cea6c2
add payment data generation method
Showing
2 changed files
with
18 additions
and
1 deletions
| @@ -453,6 +453,22 @@ def test_complaint_data(): | @@ -453,6 +453,22 @@ def test_complaint_data(): | ||
| 453 | return munchify({'data': data}) | 453 | return munchify({'data': data}) |
| 454 | 454 | ||
| 455 | 455 | ||
| 456 | +def test_payment_data(token, complaint_value, complaint_uaid): | ||
| 457 | + data = { | ||
| 458 | + "amount": str(complaint_value), | ||
| 459 | + "currency": "UAH", | ||
| 460 | + "description": generate_payment_description(token, complaint_uaid) | ||
| 461 | + } | ||
| 462 | + return data | ||
| 463 | + | ||
| 464 | + | ||
| 465 | +def generate_payment_description(token, complaint_uaid): | ||
| 466 | + full_hash = hashlib.sha512(token).hexdigest() | ||
| 467 | + short_hash = full_hash[0:8] | ||
| 468 | + description = complaint_uaid + '-' + short_hash | ||
| 469 | + return description | ||
| 470 | + | ||
| 471 | + | ||
| 456 | def test_accept_complaint_data(): | 472 | def test_accept_complaint_data(): |
| 457 | data = { | 473 | data = { |
| 458 | "status": "accepted", | 474 | "status": "accepted", |
| @@ -84,7 +84,8 @@ from .initial_data import ( | @@ -84,7 +84,8 @@ from .initial_data import ( | ||
| 84 | test_accept_complaint_data, | 84 | test_accept_complaint_data, |
| 85 | test_reject_complaint_data, | 85 | test_reject_complaint_data, |
| 86 | test_cancellation_data, | 86 | test_cancellation_data, |
| 87 | - test_cancel_pending_data | 87 | + test_cancel_pending_data, |
| 88 | + test_payment_data | ||
| 88 | ) | 89 | ) |
| 89 | from barbecue import chef | 90 | from barbecue import chef |
| 90 | from restkit import request | 91 | from restkit import request |
Please
register
or
login
to post a comment