PluginProbe
Pay with Vipps and MobilePay for WooCommerce / 6.2.1
Pay with Vipps and MobilePay for WooCommerce v6.2.1
6.2.1 6.2.0 6.1.10 6.1.9 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1.0 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 6.0.0 5.4.3 5.4.2 5.4.1 5.4.0 5.3.4 trunk All 183 releases
woo-vipps / recurring / includes / models / WC_Vipps_Checkout_Session_Transaction.php

WC_Vipps_Checkout_Session_Transaction.php in Pay with Vipps and MobilePay for WooCommerce 6.2.1, at recurring/includes/models/WC_Vipps_Checkout_Session_Transaction.php

55 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || exit;
4
5 class WC_Vipps_Checkout_Session_Transaction extends WC_Vipps_Model {
6 protected array $required_fields = [
7 "amount",
8 "reference",
9 "payment_description"
10 ];
11
12 public ?WC_Vipps_Checkout_Session_Amount $amount = null;
13 public ?string $reference = null;
14 public ?string $payment_description = null;
15 public ?WC_Vipps_Checkout_Session_Transaction_Order_Summary $order_summary = null;
16
17 public function set_amount( $amount ): self {
18 return $this->_set_value( "amount", $amount, WC_Vipps_Checkout_Session_Amount::class );
19 }
20
21 public function set_reference( string $reference ): self {
22 $this->reference = $reference;
23
24 return $this;
25 }
26
27 public function set_payment_description( string $payment_description ): self {
28 $this->payment_description = $payment_description;
29
30 return $this;
31 }
32
33 public function set_order_summary( $order_summary ): self {
34 return $this->_set_value( "order_summary", $order_summary, WC_Vipps_Checkout_Session_Transaction_Order_Summary::class );
35 }
36
37 /**
38 * @throws WC_Vipps_Recurring_Missing_Value_Exception
39 */
40 public function to_array( bool $check_required = false ): array {
41 if ( $check_required ) {
42 $this->check_required();
43 }
44
45 return array_merge(
46 [
47 "amount" => $this->amount,
48 "reference" => $this->reference,
49 "paymentDescription" => $this->payment_description,
50 ],
51 $this->conditional( "orderSummary", $this->order_summary ),
52 );
53 }
54 }
55