Repository navigation
Expand file tree
/
Copy pathexample.secciRequest.installmentEmail.php
More file actions
99 lines (88 loc) · 3.29 KB
/
Copy pathexample.secciRequest.installmentEmail.php
File metadata and controls
99 lines (88 loc) · 3.29 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
require __DIR__ . '/vendor/autoload.php';
require_once "ratepay_credentials.php";
/****************************************************
* The SecciRequest requests the CCD2 SECCI information *
****************************************************/
$mbHead = new RatePAY\ModelBuilder();
$mbHead->setArray([
'SystemId' => "Example",
'Credential' => [
'ProfileId' => PROFILE_ID,
'Securitycode' => SECURITYCODE
]
]);
// Building content model
$mbContent = new RatePAY\ModelBuilder('Content');
$mbContent->setArray([
'ShoppingBasket' => [
'Items' => [
[
'Item' => [
'Description' => "Artikel A",
'ArticleNumber' => "123",
'Quantity' => 6,
'UnitPriceGross' => 10.00,
'TaxRate' => 19,
]
], [
'Item' => [
'Description' => "Artikel B",
'ArticleNumber' => "234",
'Quantity' => 1,
'UnitPriceGross' => 100.00,
'TaxRate' => 19,
]
], [
'Item' => [
'Description' => "Artikel C",
'ArticleNumber' => "345",
'Quantity' => 2,
'UnitPriceGross' => 50.00,
'TaxRate' => 19,
'Discount' => -10.00,
]
]
],
'Shipping' => [
'Description' => "Versandkosten",
'UnitPriceGross' => 5.00,
'TaxRate' => 19,
],
'Discount' => [
'Description' => "Rabatt",
'UnitPriceGross' => -15.00,
'TaxRate' => 19,
]
],
'Secci' => [
'DeliveryMethod' => 'EMAIL',
'Email' => 'abc@gmail.com',
'Language' => 'DE',
'CountryCode' => 'DE',
],
'Payment' => [
'Method' => 'INSTALLMENT',
'Amount' => 230.00,
'InstallmentDetails' => [
'InstallmentNumber' => 3,
'InstallmentAmount' => 78.76,
'LastInstallmentAmount' => 78.74,
'InterestRate' => 13.7,
'PaymentFirstday' => 28,
],
'DebitPayType' => "DIRECT-DEBIT"
],
]);
$rb = new RatePAY\RequestBuilder(true); // Sandbox mode = true
$secciRequest = $rb->callSecciRequest($mbHead, $mbContent);
if (!$secciRequest->isSuccessful()) die("SecciRequest not successful");
var_dump($secciRequest->getResult());
// The SecciRequest response object provides the following methods:
// getAttestationToken(); // Returns the attestation token which has to be added to the PaymentRequest {string}
// getDocumentId(); // Returns document id {string}
// getDocument(); // Returns the document as a string {string}
// getContentType(); // Returns the content type of the document {string}
/*********************************************************************************************************************************
* The library throws decidedly exceptions. It's recommended to surround model building and request calls with try-catch-blocks. *
*********************************************************************************************************************************/