mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Use order ID instead of "number" for PayPal custom field
Otherwise we cannot find the order in webhook handlers if order number is not order ID
This commit is contained in:
parent
355bac28f9
commit
3b98d8300b
2 changed files with 12 additions and 12 deletions
|
@ -119,9 +119,8 @@ class PurchaseUnitFactory {
|
|||
$reference_id = 'default';
|
||||
$description = '';
|
||||
$payee = $this->payee_repository->payee();
|
||||
$wc_order_id = $order->get_order_number();
|
||||
$custom_id = $this->prefix . $wc_order_id;
|
||||
$invoice_id = $this->prefix . $wc_order_id;
|
||||
$custom_id = $this->prefix . (string) $order->get_id();
|
||||
$invoice_id = $this->prefix . $order->get_order_number();
|
||||
$soft_descriptor = '';
|
||||
$purchase_unit = new PurchaseUnit(
|
||||
$amount,
|
||||
|
|
|
@ -18,13 +18,14 @@ use function Brain\Monkey\Functions\expect;
|
|||
|
||||
class PurchaseUnitFactoryTest extends TestCase
|
||||
{
|
||||
private $wcOrderId = 1;
|
||||
private $wcOrderNumber = '100000';
|
||||
|
||||
public function testWcOrderDefault()
|
||||
{
|
||||
$wcOrderId = 1;
|
||||
$wcOrder = Mockery::mock(\WC_Order::class);
|
||||
$wcOrder
|
||||
->expects('get_order_number')->andReturn($wcOrderId);
|
||||
$wcOrder->expects('get_order_number')->andReturn($this->wcOrderNumber);
|
||||
$wcOrder->expects('get_id')->andReturn($this->wcOrderId);
|
||||
$amount = Mockery::mock(Amount::class);
|
||||
$amountFactory = Mockery::mock(AmountFactory::class);
|
||||
$amountFactory
|
||||
|
@ -76,9 +77,9 @@ class PurchaseUnitFactoryTest extends TestCase
|
|||
$this->assertEquals($payee, $unit->payee());
|
||||
$this->assertEquals('', $unit->description());
|
||||
$this->assertEquals('default', $unit->reference_id());
|
||||
$this->assertEquals('WC-' . $wcOrderId, $unit->custom_id());
|
||||
$this->assertEquals('WC-' . $this->wcOrderId, $unit->custom_id());
|
||||
$this->assertEquals('', $unit->soft_descriptor());
|
||||
$this->assertEquals('WC-' . $wcOrderId, $unit->invoice_id());
|
||||
$this->assertEquals('WC-' . $this->wcOrderNumber, $unit->invoice_id());
|
||||
$this->assertEquals([$item], $unit->items());
|
||||
$this->assertEquals($amount, $unit->amount());
|
||||
$this->assertEquals($shipping, $unit->shipping());
|
||||
|
@ -87,8 +88,8 @@ class PurchaseUnitFactoryTest extends TestCase
|
|||
public function testWcOrderShippingGetsDroppedWhenNoPostalCode()
|
||||
{
|
||||
$wcOrder = Mockery::mock(\WC_Order::class);
|
||||
$wcOrder
|
||||
->expects('get_order_number')->andReturn(1);
|
||||
$wcOrder->expects('get_order_number')->andReturn($this->wcOrderNumber);
|
||||
$wcOrder->expects('get_id')->andReturn($this->wcOrderId);
|
||||
$amount = Mockery::mock(Amount::class);
|
||||
$amountFactory = Mockery::mock(AmountFactory::class);
|
||||
$amountFactory
|
||||
|
@ -142,8 +143,8 @@ class PurchaseUnitFactoryTest extends TestCase
|
|||
public function testWcOrderShippingGetsDroppedWhenNoCountryCode()
|
||||
{
|
||||
$wcOrder = Mockery::mock(\WC_Order::class);
|
||||
$wcOrder
|
||||
->expects('get_order_number')->andReturn(1);
|
||||
$wcOrder->expects('get_order_number')->andReturn($this->wcOrderNumber);
|
||||
$wcOrder->expects('get_id')->andReturn($this->wcOrderId);
|
||||
$amount = Mockery::mock(Amount::class);
|
||||
$amountFactory = Mockery::mock(AmountFactory::class);
|
||||
$amountFactory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue