diff --git a/commerce_recurring.commerce_adjustment_types.yml b/commerce_recurring.commerce_adjustment_types.yml index ad01bbc562fefc1c3897335cda761e49d932a2e4..ad0f55cc1f131033668ec9dbb3a1dcda39521b2d 100644 --- a/commerce_recurring.commerce_adjustment_types.yml +++ b/commerce_recurring.commerce_adjustment_types.yml @@ -1,6 +1,6 @@ -recurring: - label: 'Recurring' - singular_label: 'recurring adjustment' - plural_label: 'recurring adjustments' +subscription: + label: 'Subscription' + singular_label: 'subscription adjustment' + plural_label: 'subscription adjustments' has_ui: false weight: 10 diff --git a/commerce_recurring.services.yml b/commerce_recurring.services.yml index 4601f32736b1d86659de81a34cf0f5f8fda06998..abdd17f66ef2d56c8fdb61b0d3e2ddb0ee991ad8 100644 --- a/commerce_recurring.services.yml +++ b/commerce_recurring.services.yml @@ -14,7 +14,7 @@ services: class: Drupal\commerce_recurring\InitialOrderProcessor arguments: ['@datetime.time'] tags: - - { name: commerce_order.order_processor, priority: 40 } + - { name: commerce_order.order_processor, priority: 40, adjustment_type: subscription } commerce_recurring.recurring_order_processor: class: Drupal\commerce_recurring\RecurringOrderProcessor diff --git a/src/InitialOrderProcessor.php b/src/InitialOrderProcessor.php index 994e162bea67e2a96f0cae0c4e36443ed94af155..1bcd317f0588fed3ef098a9e74b39b00803000b4 100644 --- a/src/InitialOrderProcessor.php +++ b/src/InitialOrderProcessor.php @@ -67,7 +67,7 @@ class InitialOrderProcessor implements OrderProcessorInterface { if (!$prorated_unit_price->equals($unit_price)) { $difference = $unit_price->subtract($prorated_unit_price); $order_item->addAdjustment(new Adjustment([ - 'type' => 'recurring', + 'type' => 'subscription', 'label' => t('Proration'), 'amount' => $difference->multiply('-1'), 'source_id' => $billing_schedule->id(), @@ -77,7 +77,7 @@ class InitialOrderProcessor implements OrderProcessorInterface { else { // A postpaid purchased entity is free in the initial order. $order_item->addAdjustment(new Adjustment([ - 'type' => 'recurring', + 'type' => 'subscription', 'label' => t('Pay later'), 'amount' => $order_item->getAdjustedUnitPrice()->multiply('-1'), 'source_id' => $billing_schedule->id(), diff --git a/tests/src/Kernel/InitialOrderProcessorTest.php b/tests/src/Kernel/InitialOrderProcessorTest.php index 3d71ab3b5887df32df66c6eebdebc1678dbbfcf4..127b4cb08af7ce4d4257d034ab89358cf7228d81 100644 --- a/tests/src/Kernel/InitialOrderProcessorTest.php +++ b/tests/src/Kernel/InitialOrderProcessorTest.php @@ -74,7 +74,7 @@ class InitialOrderProcessorTest extends RecurringKernelTestBase { $this->assertNotEquals($order_item->getUnitPrice(), $order_item->getAdjustedUnitPrice()); $adjustments = $order_item->getAdjustments(); $adjustment = reset($adjustments); - $this->assertEquals('recurring', $adjustment->getType()); + $this->assertEquals('subscription', $adjustment->getType()); $this->assertEquals(t('Proration'), $adjustment->getLabel()); }