Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PaymentRepository::findAllowedPayments() で、共通の支払方法が無い場合でも支払方法が取得できてしまう #1162

Closed
nanasess opened this issue Nov 9, 2015 · 10 comments
Labels
Milestone

Comments

@nanasess
Copy link
Contributor

nanasess commented Nov 9, 2015

#1156 の「また、購入確認画面で配送先の支払方法を変更すると、本来は選択できないはずの支払方法が選択できるようになってしまう。」の原因になっていると思われる。

@nanasess
Copy link
Contributor Author

nanasess commented Nov 9, 2015

以下、再現テストケース。共通する支払方法は存在しないはずだが、 $this->actual = 3 となってしまう。

    public function testFindAllowedPaymentWithExclusion()
    {
        $productTypes = array(1, 2);
        $productTypes = array_unique($productTypes);

        // ProductType 1 と 2 で, 共通する支払い方法を削除しておく
        $PaymentOption = $this
            ->app['orm.em']
            ->getRepository('\Eccube\Entity\PaymentOption')
            ->findOneBy(
                array(
                    'delivery_id' => 1,
                    'payment_id' => 3
                )
            );
        $this->assertNotNull($PaymentOption);
        $this->app['orm.em']->remove($PaymentOption);
        $this->app['orm.em']->flush();

        $deliveries = $this->app['eccube.repository.delivery']->getDeliveries($productTypes);

        // 支払方法を取得
        $payments = $this->app['eccube.repository.payment']->findAllowedPayments($deliveries);

        $this->expected = 0;
        $this->actual = count($payments);
        $this->verify('商品種別共通の支払い方法は'.$this->expected.'種類です');
    }

@shhirose
Copy link
Contributor

shhirose commented Nov 9, 2015

#1158 で修正を PR しています。

@nanasess
Copy link
Contributor Author

nanasess commented Nov 9, 2015

👍

@shhirose
Copy link
Contributor

shhirose commented Nov 9, 2015

このテストケースを #1158 に組み込んでしまっていいですか?

nanasess added a commit to nanasess/ec-cube that referenced this issue Nov 10, 2015
@nanasess
Copy link
Contributor Author

@shhirose はい、ありがとうございます。 nanasess@040fddf にコミットしてますので、 以下のように取り込んでいただけると嬉しいです。

curl -s https://github.com/nanasess/ec-cube/commit/040fddfd45fa432520f0d004c6617fc9b8dc88c7.patch | git am

@shhirose
Copy link
Contributor

パッチを適応しようとしたら以下の様なエラーが出てしましました。
これはどうすればいいのでしょうか。
※もし原因がわかれば教えて下さい。

# curl -s https://github.com/nanasess/ec-cube/commit/040fddfd45fa432520f0d004c6617fc9b8dc88c7.patch | git am
Applying: issue #1162 のテストケースを追加
error: tests/Eccube/Tests/Repository/PaymentRepositoryTest.php: does not match index
Patch failed at 0001 issue #1162 のテストケースを追加
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

@nanasess
Copy link
Contributor Author

tests/Eccube/Tests/Repository/PaymentRepositoryTest.php が見つからないというエラーですね。。。

@nanasess
Copy link
Contributor Author

@shhirose Pull Request しましたので、こちらを取り込んでいただけたらと思います
shhirose#1

shhirose added a commit to shhirose/ec-cube that referenced this issue Nov 10, 2015
issue EC-CUBE#1162 のテストケースを追加
@shhirose
Copy link
Contributor

ありがとうございます。
取り込みました。

@nanasess nanasess added the bug label Nov 12, 2015
@nanasess nanasess added this to the 3.0.6 milestone Nov 12, 2015
@nanasess
Copy link
Contributor Author

Fix #1158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants