|
| 1 | +<?php |
| 2 | +require_once '../configuration.php'; |
| 3 | +require_once SDK_ROOTPATH . '/../vendor/autoload.php'; |
| 4 | + |
| 5 | + |
| 6 | +//Split order |
| 7 | +try { |
| 8 | + \Cloudipsp\Configuration::setMerchantId(600001); |
| 9 | + //Generating pcidss order to capture see more https://docs.fondy.eu/docs/page/4/ |
| 10 | + $TestOrderData = [ |
| 11 | + 'order_id' => 'settelment_' . time(), |
| 12 | + 'card_number' => '4444555511116666', |
| 13 | + 'cvv2' => '333', |
| 14 | + 'expiry_date' => '1232', |
| 15 | + 'currency' => 'USD', |
| 16 | + 'preauth' => 'Y', |
| 17 | + 'amount' => 1000, |
| 18 | + 'client_ip' => '127.2.2.1' |
| 19 | + ]; |
| 20 | + //Call method to generate order for capture |
| 21 | + $captured_order_data = Cloudipsp\Pcidss::start($TestOrderData); //next order will be captured |
| 22 | + //Minimal data set, all other required params will generated automatically |
| 23 | + $data = [ |
| 24 | + 'currency' => 'USD', |
| 25 | + 'amount' => 1000, // convert to 10.00$ |
| 26 | + 'order_desc' => 'tests SDK', |
| 27 | + 'operation_id' => $TestOrderData['order_id'] |
| 28 | + ]; |
| 29 | + //some other params |
| 30 | + $receiver = [ |
| 31 | + [ |
| 32 | + 'requisites' => [ |
| 33 | + 'amount' => 500, |
| 34 | + 'merchant_id' => 600001 |
| 35 | + ], |
| 36 | + 'type' => 'merchant' |
| 37 | + ], |
| 38 | + [ |
| 39 | + 'requisites' => [ |
| 40 | + 'amount' => 500, |
| 41 | + 'merchant_id' => 700001 |
| 42 | + ], |
| 43 | + 'type' => 'merchant' |
| 44 | + ] |
| 45 | + ]; |
| 46 | + $data['receiver'] = $receiver; |
| 47 | + //Call method to generate url |
| 48 | + \Cloudipsp\Configuration::setApiVersion('2.0'); |
| 49 | + $url = Cloudipsp\Order::settlement($data); |
| 50 | + //getting returned data |
| 51 | + ?> |
| 52 | + <!doctype html> |
| 53 | + <html lang="en-US"> |
| 54 | + <head> |
| 55 | + <meta charset="UTF-8"> |
| 56 | + <title>Capture pre-purchase</title> |
| 57 | + <style> |
| 58 | + table tr td, table tr th { |
| 59 | + padding: 10px; |
| 60 | + } |
| 61 | + </style> |
| 62 | + </head> |
| 63 | + <body> |
| 64 | + <table style="margin: auto;" border="1"> |
| 65 | + <thead> |
| 66 | + <tr> |
| 67 | + <th style="text-align: center" colspan="2">Request Data</th> |
| 68 | + </tr> |
| 69 | + <tr> |
| 70 | + <th style="text-align: left" |
| 71 | + colspan="2"><?php printf("<pre>%s</pre>", json_encode(['request' => $data], JSON_PRETTY_PRINT)) ?></th> |
| 72 | + </tr> |
| 73 | + </thead> |
| 74 | + <tbody> |
| 75 | + <tr> |
| 76 | + <td>Normal Response:</td> |
| 77 | + <td> |
| 78 | + <pre><?php print_r($url->getData()) ?></pre> |
| 79 | + </td> |
| 80 | + </tr> |
| 81 | + </tbody> |
| 82 | + </table> |
| 83 | + </body> |
| 84 | + </html> |
| 85 | + <?php |
| 86 | +} catch (\Exception $e) { |
| 87 | + echo "Fail: " . $e->getMessage(); |
| 88 | +} |
0 commit comments