diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-12-18 14:42:42 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-12-18 14:42:42 +0100 |
commit | ef18bb0b9facc2d85db138dd65720c14a33953c5 (patch) | |
tree | 7c3fb4401a5335c144f120aedfc19bac25e70fb0 /python | |
parent | 8c16250cf921bac3198e8917a38a90297de77c3f (diff) | |
download | Puppet-ef18bb0b9facc2d85db138dd65720c14a33953c5.tar.gz Puppet-ef18bb0b9facc2d85db138dd65720c14a33953c5.tar.zst Puppet-ef18bb0b9facc2d85db138dd65720c14a33953c5.zip |
Finish payment process for buying vps server
Diffstat (limited to 'python')
-rw-r--r-- | python/buy_vps_server.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/python/buy_vps_server.py b/python/buy_vps_server.py index 2803e32..44ae786 100644 --- a/python/buy_vps_server.py +++ b/python/buy_vps_server.py | |||
@@ -48,7 +48,16 @@ order = client.post('/order/cart/{}/checkout'.format(cart_id), | |||
48 | order_id = order["orderId"] | 48 | order_id = order["orderId"] |
49 | print(order_id) | 49 | print(order_id) |
50 | 50 | ||
51 | # Suite à tester : | 51 | payment_mean = client.get('/me/order/{}/availableRegisteredPaymentMean'.format(order_id))[0]['paymentMean'] |
52 | # /me/order/{orderId}/availableRegisteredPaymentMean | 52 | payment_mean_id = client.get('/me/paymentMean/{}'.format(payment_mean))[0] |
53 | # /me/paymentMean ? /me/order/{orderId}/debt/pay ? | ||
54 | 53 | ||
54 | payment_mean_status = client.get('/me/paymentMean/{}/{}'.format(payment_mean, payment_mean_id)) | ||
55 | |||
56 | if payment_mean_status["state"] != "valid": | ||
57 | raise "Bouh" | ||
58 | |||
59 | paid_order = client.post('/me/order/{}/payWithRegisteredPaymentMean'.format(order_id), | ||
60 | paymentMean=payment_mean, paymentMeanId=payment_mean_id) | ||
61 | |||
62 | if 'paymentDate' in paid_order: | ||
63 | print("successful") | ||