@@ -7390,4 +7390,72 @@ public function test_findTransactionWithPaymentAccountReferenceInGooglePayDetail
73907390 $ this ->assertNotNull ($ transaction ->googlePayCardDetails );
73917391 $ this ->assertArrayHasKey ('paymentAccountReference ' , $ transaction ->googlePayCardDetails ->toArray ());
73927392 }
7393+
7394+ public function testSale_withValidProcessingMerchantCategoryCode ()
7395+ {
7396+ $ result = Braintree \Transaction::sale ([
7397+ 'amount ' => '100.00 ' ,
7398+ 'creditCard ' => [
7399+ 'number ' => '5105105105105100 ' ,
7400+ 'expirationDate ' => '05/2025 ' ,
7401+ ],
7402+ 'processingMerchantCategoryCode ' => '5411 '
7403+ ]);
7404+
7405+ $ this ->assertTrue ($ result ->success );
7406+ }
7407+
7408+ public function testSale_withInvalidProcessingMerchantCategoryCodeTooLong ()
7409+ {
7410+ $ result = Braintree \Transaction::sale ([
7411+ 'amount ' => '100.00 ' ,
7412+ 'creditCard ' => [
7413+ 'number ' => '5105105105105100 ' ,
7414+ 'expirationDate ' => '05/2025 ' ,
7415+ ],
7416+ 'processingMerchantCategoryCode ' => '54111 '
7417+ ]);
7418+
7419+ $ this ->assertFalse ($ result ->success );
7420+ $ this ->assertEquals (
7421+ Braintree \Error \Codes::TRANSACTION_PROCESSING_MERCHANT_CATEGORY_CODE_IS_INVALID ,
7422+ $ result ->errors ->forKey ('transaction ' )->onAttribute ('processingMerchantCategoryCode ' )[0 ]->code
7423+ );
7424+ }
7425+
7426+ public function testSale_withInvalidProcessingMerchantCategoryCodeNonNumeric ()
7427+ {
7428+ $ result = Braintree \Transaction::sale ([
7429+ 'amount ' => '100.00 ' ,
7430+ 'creditCard ' => [
7431+ 'number ' => '5105105105105100 ' ,
7432+ 'expirationDate ' => '05/2025 ' ,
7433+ ],
7434+ 'processingMerchantCategoryCode ' => 'abcd '
7435+ ]);
7436+
7437+ $ this ->assertFalse ($ result ->success );
7438+ $ this ->assertEquals (
7439+ Braintree \Error \Codes::TRANSACTION_PROCESSING_MERCHANT_CATEGORY_CODE_IS_INVALID ,
7440+ $ result ->errors ->forKey ('transaction ' )->onAttribute ('processingMerchantCategoryCode ' )[0 ]->code
7441+ );
7442+ }
7443+
7444+ public function testSale_withInvalidProcessingMerchantCategoryCodeTooShort ()
7445+ {
7446+ $ result = Braintree \Transaction::sale ([
7447+ 'amount ' => '100.00 ' ,
7448+ 'creditCard ' => [
7449+ 'number ' => '5105105105105100 ' ,
7450+ 'expirationDate ' => '05/2025 ' ,
7451+ ],
7452+ 'processingMerchantCategoryCode ' => '541 '
7453+ ]);
7454+
7455+ $ this ->assertFalse ($ result ->success );
7456+ $ this ->assertEquals (
7457+ Braintree \Error \Codes::TRANSACTION_PROCESSING_MERCHANT_CATEGORY_CODE_IS_INVALID ,
7458+ $ result ->errors ->forKey ('transaction ' )->onAttribute ('processingMerchantCategoryCode ' )[0 ]->code
7459+ );
7460+ }
73937461}
0 commit comments