spec/integration/braintree/transaction_spec.rb in braintree-2.35.0 vs spec/integration/braintree/transaction_spec.rb in braintree-2.36.0
- old
+ new
@@ -1314,10 +1314,27 @@
result.success?.should == true
result.transaction.paypal_details.should_not be_nil
result.transaction.paypal_details.debug_id.should_not be_nil
end
+ it "can create a transaction with a fake apple pay nonce" do
+ customer = Braintree::Customer.create!
+ result = Braintree::Transaction.create(
+ :type => "sale",
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
+ :payment_method_nonce => "fake-apple-pay-visa-nonce"
+ )
+ result.success?.should == true
+ result.transaction.should_not be_nil
+ apple_pay_details = result.transaction.apple_pay_details
+ apple_pay_details.should_not be_nil
+ apple_pay_details.card_type.should == Braintree::ApplePayCard::CardType::Visa
+ apple_pay_details.expiration_month.to_i.should > 0
+ apple_pay_details.expiration_year.to_i.should > 0
+ apple_pay_details.cardholder_name.should_not be_nil
+ end
+
it "can create a transaction with a payee email" do
customer = Braintree::Customer.create!
nonce = nonce_for_new_payment_method(
:paypal_account => {
:consent_code => "PAYPAL_CONSENT_CODE",
@@ -1551,11 +1568,11 @@
:options => {
:submit_for_settlement => true
}
)
result.success?.should == true
- result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
+ result.transaction.status.should == Braintree::Transaction::Status::Settling
end
end
context "void" do
it "successfully voids a paypal transaction that's been authorized" do
@@ -1635,13 +1652,10 @@
end
it "returns an error result if unsettled" do
transaction = Braintree::Transaction.sale!(
:amount => Braintree::Test::TransactionAmounts::Authorize,
- :payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
- :options => {
- :submit_for_settlement => true
- }
+ :payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment
)
result = Braintree::Transaction.refund(transaction.id)
result.success?.should == false
result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::CannotRefundUnlessSettled
end