Skip to content

Commit ac2cb26

Browse files
authored
Merge pull request #8 from dachcom-digital/total_tax
update deps, added totalTax to transaction extender
2 parents 0fa00d4 + 0435922 commit ac2cb26

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

Api.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function prepareTransaction(ArrayObject $details, string $returnUrl, stri
5656
$lineItem = $this->createPostFinanceModel(LineItemCreate::class, [
5757
'quantity' => 1,
5858
'amountIncludingTax' => $transactionExtender['amount'] / 100,
59+
'taxes' => $transactionExtender['totalTaxes'] ?? null,
5960
'uniqueId' => $transactionExtender['id'],
6061
'name' => $transactionExtender['id'],
6162
'sku' => $transactionExtender['id'],

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Payum Gateway For [PostFinance Checkout](https://checkout.postfinance.ch)
55
- PHP 8.0+
66
- [Payum](https://github.com/Payum/Payum)
77

8+
## Information
9+
This extension currently **does not** support multiple line items.
10+
It only creates one line item which contains all the total information of the given order.
11+
12+
***
13+
814
## BackOffice
915

1016
### Environments
@@ -13,7 +19,13 @@ Use multiple spaces to determine test/production.
1319
### Webhook
1420
You need to define a global webhook: `https://your-domain.com/payment/notify/unsafe/[YOUR_POSTFINANCE_FLEX_GATEWAY_NAME]`
1521

22+
***
23+
1624
## Changelog
25+
26+
### 1.2.0
27+
- dependency `postfinancecheckout/sdk:^4.1` added
28+
- added `totalTaxes` to transaction extender to allow tax rates submission to line item
1729
### 1.1.1
1830
- change payment state to `authorized` if transaction state is `completed`
1931
### 1.1.0

Transaction/Transaction.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Transaction
1111
protected int|float $amount;
1212
protected ?string $currency;
1313
protected ?string $language = null;
14+
protected ?array $totalTaxes = null;
1415
protected ?array $allowedPaymentMethodBrands = null;
1516
protected ?array $allowedPaymentMethodConfigurations = null;
1617

@@ -57,6 +58,16 @@ public function setLanguage(?string $language): void
5758
$this->language = $language;
5859
}
5960

61+
public function getTotalTaxes(): ?array
62+
{
63+
return $this->totalTaxes;
64+
}
65+
66+
public function setTotalTaxes(?array $totalTaxes): void
67+
{
68+
$this->totalTaxes = $totalTaxes;
69+
}
70+
6071
public function getAllowedPaymentMethodBrands(): ?array
6172
{
6273
return $this->allowedPaymentMethodBrands;
@@ -104,6 +115,7 @@ public function toArray(): array
104115
'amount' => $this->getAmount(),
105116
'currency' => $this->getCurrency(),
106117
'language' => $this->getLanguage(),
118+
'totalTaxes' => $this->getTotalTaxes(),
107119
'allowedPaymentMethodBrands' => $this->getAllowedPaymentMethodBrands(),
108120
'allowedPaymentMethodConfigurations' => $this->getAllowedPaymentMethodConfigurations(),
109121
'shippingAddress' => $this->shippingAddress === null ? [] : (array) ObjectSerializer::sanitizeForSerialization($this->shippingAddress),
@@ -113,7 +125,5 @@ public function toArray(): array
113125
return array_filter($data, static function ($row) {
114126
return $row !== null;
115127
});
116-
117128
}
118-
119129
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
}
2424
],
2525
"require": {
26-
"payum/core": "^1.6"
26+
"payum/core": "^1.6",
27+
"postfinancecheckout/sdk": "^4.1"
2728
},
2829
"extra": {
2930
"branch-alias": {

0 commit comments

Comments
 (0)