diff --git a/Test/Unit/OrderTest.php b/Test/Unit/OrderTest.php index 445c5234..65878cf1 100644 --- a/Test/Unit/OrderTest.php +++ b/Test/Unit/OrderTest.php @@ -17,13 +17,13 @@ public function setUp() } public function testOrderWithTax() - { + { $vindiProductId = 'taxa'; $amount = 1.00; $order = $this->createOrderMock($amount, 0.00, 0.00); $list = $this->createVindiProductManagementMock($vindiProductId)->findOrCreateProductsFromOrder($order); - + $this->makeAssertions($list, $vindiProductId, $amount); } @@ -36,7 +36,7 @@ public function testOrderWithDiscount() $list = $this->createVindiProductManagementMock($vindiProductId)->findOrCreateProductsFromOrder($order); $this->makeAssertions($list, $vindiProductId, $amount); - } + } public function testOrderWithShipping() { @@ -67,7 +67,7 @@ private function createApiMock($desiredTestResponse = null) ->getMock(); $requestResponses = []; - + $requestResponses[] = [ 'product' => [ 'id' => 'fake_sku' @@ -144,10 +144,10 @@ private function createItemMock($qty = 1, $type = 'simple', $price = 10.99) $itemMock->method('getName') ->willReturn('FAKE_NAME'); - + $itemMock->method('getPrice') ->willReturn($price); - + $itemMock->method('getProduct') ->willReturn($this->createProductMock($type)); @@ -166,4 +166,4 @@ private function createProductMock($type) return $productMock; } -} \ No newline at end of file +} diff --git a/Ui/DataProvider/Subscription/Form/Modifier/PaymentProfile.php b/Ui/DataProvider/Subscription/Form/Modifier/PaymentProfile.php index 0446e6b5..285e6cf6 100644 --- a/Ui/DataProvider/Subscription/Form/Modifier/PaymentProfile.php +++ b/Ui/DataProvider/Subscription/Form/Modifier/PaymentProfile.php @@ -88,11 +88,15 @@ public function modifyMeta(array $meta) public function getPaymentProfiles() { $options = []; - $customer = $this->getCustomerId(); - $request = $this->api->request('payment_profiles?query=customer_id%3D' . $customer . '&status=active', 'GET'); + + $endpoint = 'payment_profiles?query=customer_id%3D' . $this->getCustomerId() . '%20status%3Dactive%20type%3DPaymentProfile%3A%3ACreditCard'; + + $request = $this->api->request($endpoint,'GET'); + if (!is_array($request) && !array_key_exists('payment_profiles', $request)) { return $options; } + foreach ($request['payment_profiles'] as $profile) { $options[] = [ 'value' => $profile['id'],