Skip to content

Commit a750f36

Browse files
authored
Merge pull request #59 from pronamic/core-230-payment-line-quantity-type
Update for quantity `Number`.
2 parents 15b0849 + a13e6c2 commit a750f36

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Processor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ public function entry_post_save( $lead, $form ) {
381381
}
382382

383383
if ( array_key_exists( 'quantity', $product ) ) {
384-
$line->set_quantity( intval( $product['quantity'] ) );
384+
$line->set_quantity( Number::from_mixed( $product['quantity'] ) );
385385
}
386386

387387
if ( array_key_exists( 'options', $product ) && is_array( $product['options'] ) ) {
@@ -400,7 +400,7 @@ public function entry_post_save( $lead, $form ) {
400400
}
401401

402402
// Quantity.
403-
$line->set_quantity( null === $product_quantity ? 1 : $product_quantity );
403+
$line->set_quantity( $product_quantity ?? new Number( 1 ) );
404404

405405
// Price.
406406
if ( array_key_exists( 'price', $option ) ) {
@@ -435,7 +435,7 @@ public function entry_post_save( $lead, $form ) {
435435
$line = $payment->lines->new_line();
436436

437437
$line->set_type( PaymentLineType::SHIPPING );
438-
$line->set_quantity( 1 );
438+
$line->set_quantity( new Number( 1 ) );
439439

440440
if ( array_key_exists( 'id', $shipping ) ) {
441441
$line->set_id( $shipping['id'] );

0 commit comments

Comments
 (0)