-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddPayment.php
More file actions
64 lines (59 loc) · 1.64 KB
/
addPayment.php
File metadata and controls
64 lines (59 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
declare(strict_types=1);
require __DIR__ . '/../../../vendor/autoload.php';
use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__ . '/../../..');
$dotenv->load();
use Qvickly\Api\Payment\RequestDataObjects\Customer;
use Qvickly\Api\Payment\PaymentAPI;
use Qvickly\Api\Payment\RequestDataObjects\Data;
use \Qvickly\Api\Payment\RequestDataObjects\PaymentData;
use \Qvickly\Api\Payment\RequestDataObjects\BillingAddress;
$paymentAPI = new PaymentAPI($_ENV['EID'], $_ENV['SECRET'], testMode: true);
$paymentData = new PaymentData(
[
"method" => "2",
"currency" => "SEK",
"language" => "sv",
"country" => "SE",
"orderid" => "12345abcde",
"bankid" => "true",
"accepturl" => "https://example.com/accept",
"cancelurl" => "https://example.com/cancel",
"callbackurl" => "https://example.com/callback",
"autocancel" => "2800",
]
);
$billing = new BillingAddress(
[
"firstname" => "Test",
"lastname" => "Testsson",
"street" => "Testgatan 1",
"zip" => "12345",
"city" => "Teststad",
"country" => "SE",
"email" => "[email protected]",
"phone" => "0700000000",
]);
$customer = new Customer(
[
"pno" => "550101-1018",
"Billing" => $billing,
]);
$data = new Data(
[
"PaymentData" => $paymentData,
"Customer" => $customer
]
);
$data->addArticle([
"artnr" => "1",
"title" => "Test",
"aprice" => "10000",
"taxrate" => "25",
"quantity" => "1",
"withouttax" => "10000"
]);
$data->updateCart();
$payment = $paymentAPI->addPayment($data);
print_r($payment);