@@ -14,6 +14,7 @@ final class CreatePaymentApiTestSuite: XCTestCase {
1414// var merchantSIS: PaytrailMerchant! // Shop-in-shops merchant
1515 var payload : PaymentRequestBody !
1616 var payloadInvalid : PaymentRequestBody !
17+ var payloadNoItems : PaymentRequestBody !
1718 var payloadSIS : PaymentRequestBody !
1819 var providerImageUrl : String !
1920 var providerImageUrlInvalid : String !
@@ -37,6 +38,15 @@ final class CreatePaymentApiTestSuite: XCTestCase {
3738 redirectUrls: CallbackUrls ( success: " google.com " , cancel: " google.com " ) ,
3839 callbackUrls: nil )
3940
41+ payloadNoItems = PaymentRequestBody ( stamp: UUID ( ) . uuidString,
42+ reference: " 3759170 " ,
43+ amount: 3050 ,
44+ currency: . eur,
45+ language: . fi,
46+ customer: Customer ( email: " test.customer@example.com " ) ,
47+ redirectUrls: CallbackUrls ( success: " google.com " , cancel: " google.com " ) ,
48+ callbackUrls: nil )
49+
4050 payloadSIS = PaymentRequestBody ( stamp: UUID ( ) . uuidString,
4151 reference: " 3759170 " ,
4252 amount: 3050 ,
@@ -87,6 +97,17 @@ final class CreatePaymentApiTestSuite: XCTestCase {
8797 }
8898 }
8999
100+ /// Test Success 200 - Payment create success with normal merchant credentials without items
101+ func testCreateNoItemsPaymentSuccess( ) async {
102+ let result = await createPaymentsAsync ( merchant. merchantId, secret: merchant. secret, payload: payloadNoItems)
103+ switch result {
104+ case . success( let success) :
105+ XCTAssert ( success. transactionId != nil && success. providers != nil )
106+ case . failure( let failure) :
107+ XCTFail ( " Create payment failed: \( failure. localizedDescription) " )
108+ }
109+ }
110+
90111 /// Test Success 200 - Payment create with Shop-in-Shops merchant credentials
91112 func testCreatePaymentSisSuccess( ) async {
92113 let result = await createPaymentsAsync ( " 695861 " , secret: " MONISAIPPUAKAUPPIAS " , payload: payloadSIS)
0 commit comments