Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
58fc99a
authorizeInvoice() api method for `apm-payment` endpoint and basic re…
vitalii-vanziak-cko May 14, 2025
ee97026
authorizeInvoice() in invoices repository
vitalii-vanziak-cko May 15, 2025
8b16db9
Remove NativeAlternativePaymentAuthorizationResponseBody
vitalii-vanziak-cko May 15, 2025
82715b0
authorize() function in invoices service
vitalii-vanziak-cko May 15, 2025
cae577e
Move NativeAlternativePaymentAuthorizationRequestBody
vitalii-vanziak-cko May 15, 2025
b4b5fc5
Added 'parameters' to PONativeAlternativePaymentAuthorizationRequest
vitalii-vanziak-cko May 19, 2025
e831fa2
KDoc
vitalii-vanziak-cko May 19, 2025
95c7559
Base NextStep
vitalii-vanziak-cko May 19, 2025
f4100bc
Parameter 'minLength' and 'maxLength'
vitalii-vanziak-cko May 20, 2025
3809665
AvailableValue
vitalii-vanziak-cko May 20, 2025
991db11
DialingCode
vitalii-vanziak-cko May 20, 2025
36cd9e4
OTP Subtype
vitalii-vanziak-cko May 20, 2025
8df51b1
CustomerInstruction
vitalii-vanziak-cko May 20, 2025
005f731
Phone -> PhoneNumber
vitalii-vanziak-cko May 20, 2025
b4d0da1
Map response
vitalii-vanziak-cko May 20, 2025
f96ffb0
PONativeAlternativePaymentRequest
vitalii-vanziak-cko May 20, 2025
f97107c
GET nativeAlternativePayment()
vitalii-vanziak-cko May 20, 2025
ace15d8
dialing_codes
vitalii-vanziak-cko May 21, 2025
c245431
KDoc
vitalii-vanziak-cko May 21, 2025
338f8c4
AvailableValue
vitalii-vanziak-cko May 21, 2025
e8e71ef
Moshi adapters
vitalii-vanziak-cko May 21, 2025
2bf6b4d
KDoc
vitalii-vanziak-cko May 21, 2025
50606b5
OTP KDoc
vitalii-vanziak-cko May 21, 2025
b0bbe82
KDoc
vitalii-vanziak-cko May 21, 2025
eddfdfd
CustomerInstruction KDoc
vitalii-vanziak-cko May 21, 2025
ce978de
PhoneNumber: value -> number
vitalii-vanziak-cko May 21, 2025
e978e66
Parameter.Value -> Parameter.String
vitalii-vanziak-cko May 21, 2025
2cc4c63
Fix submitting parameters
vitalii-vanziak-cko May 21, 2025
0752086
Mark 'Unknown' case in enums and sealed classes as internal for backw…
vitalii-vanziak-cko May 22, 2025
6f23269
PONativeAlternativePaymentNextStep
vitalii-vanziak-cko May 22, 2025
1426971
NativeAlternativePaymentNextStep
vitalii-vanziak-cko May 22, 2025
7e7627d
PONativeAlternativePaymentCustomerInstruction
vitalii-vanziak-cko May 22, 2025
c509cb3
Backward compatible request parameters
vitalii-vanziak-cko May 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.processout.sdk.api.model.request.napm.v2

import com.processout.sdk.core.annotation.ProcessOutInternalApi
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* Request parameters for native alternative payment authorization.
*
* @param[invoiceId] Invoice identifier.
* @param[gatewayConfigurationId] Gateway configuration identifier.
* @param[parameters] Payment parameters.
*/
/** @suppress */
@ProcessOutInternalApi
data class PONativeAlternativePaymentAuthorizationRequest(
val invoiceId: String,
val gatewayConfigurationId: String,
val parameters: Map<String, Parameter>? = null
) {

/**
* Payment parameter.
*/
data class Parameter internal constructor(
internal val value: Value
) {

companion object {
/**
* Arbitrary string parameter.
*/
fun string(value: String) = Parameter(Value.String(value))

/**
* Phone number parameter.
*
* @param[dialingCode] International dialing code.
* @param[number] The rest of the number without dialing code.
*/
fun phoneNumber(
dialingCode: String,
number: String
) = Parameter(
Value.PhoneNumber(
dialingCode = dialingCode,
number = number
)
)
}

internal sealed class Value {
data class String(
val value: kotlin.String
) : Value()

@JsonClass(generateAdapter = true)
data class PhoneNumber(
@Json(name = "dialing_code")
val dialingCode: kotlin.String,
val number: kotlin.String
) : Value()
}
}
}

@JsonClass(generateAdapter = true)
internal data class NativeAlternativePaymentAuthorizationRequestBody(
@Json(name = "gateway_configuration_id")
val gatewayConfigurationId: String,
@Json(name = "submit_data")
val submitData: SubmitData?
) {

@JsonClass(generateAdapter = true)
data class SubmitData(
val parameters: Map<String, Any>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.processout.sdk.api.model.request.napm.v2

import com.processout.sdk.core.annotation.ProcessOutInternalApi

/**
* Request parameters for native alternative payment.
*
* @param[invoiceId] Invoice identifier.
* @param[gatewayConfigurationId] Gateway configuration identifier.
*/
/** @suppress */
@ProcessOutInternalApi
data class PONativeAlternativePaymentRequest(
val invoiceId: String,
val gatewayConfigurationId: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.processout.sdk.api.model.response.napm.v2

import com.processout.sdk.api.model.response.napm.v2.PONativeAlternativePaymentAuthorizationResponse.State
import com.processout.sdk.core.annotation.ProcessOutInternalApi
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* Specifies details of native alternative payment.
*
* @param[state] State of native alternative payment.
* @param[nextStep] Next required step in the payment flow.
* @param[customerInstructions] Instructions for the customer that provide additional information and/or describe required actions.
*/
/** @suppress */
@ProcessOutInternalApi
data class PONativeAlternativePaymentAuthorizationResponse(
val state: State,
val nextStep: PONativeAlternativePaymentNextStep?,
val customerInstructions: List<PONativeAlternativePaymentCustomerInstruction>?
) {

/**
* State of native alternative payment.
*/
@JsonClass(generateAdapter = false)
enum class State {
/** Next step is required to proceed. */
NEXT_STEP_REQUIRED,

/** Payment is ready to be captured. */
PENDING_CAPTURE,

/** Payment is captured. */
CAPTURED,

/**
* Placeholder that allows adding additional cases while staying backward compatible.
* __Warning:__ Do not match this case directly, use _when-else_ instead.
*/
@ProcessOutInternalApi
UNKNOWN
}
}

@JsonClass(generateAdapter = true)
internal data class NativeAlternativePaymentAuthorizationResponseBody(
val state: State,
@Json(name = "next_step")
val nextStep: NativeAlternativePaymentNextStep?,
@Json(name = "customer_instructions")
val customerInstructions: List<PONativeAlternativePaymentCustomerInstruction>?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.processout.sdk.api.model.response.napm.v2

import com.processout.sdk.api.model.response.POBarcode
import com.processout.sdk.api.model.response.POImageResource
import com.processout.sdk.core.annotation.ProcessOutInternalApi
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* Specifies instruction for the customer, providing additional information and/or describing required actions.
*/
/** @suppress */
@ProcessOutInternalApi
sealed class PONativeAlternativePaymentCustomerInstruction {

/**
* Customer instruction provided as a markdown text.
*
* @param[label] Optional instruction display label.
* @param[value] Markdown text.
*/
@JsonClass(generateAdapter = true)
data class Text(
val label: String?,
val value: String
) : PONativeAlternativePaymentCustomerInstruction()

/**
* Customer instruction provided as an image resource.
*
* @param[value] Image resource.
*/
@JsonClass(generateAdapter = true)
data class Image(
val value: POImageResource
) : PONativeAlternativePaymentCustomerInstruction()

/**
* Customer instruction provided via barcode.
*
* @param[rawSubtype] Raw barcode subtype.
* @param[rawValue] Base64 encoded value.
*/
@JsonClass(generateAdapter = true)
data class Barcode(
@Json(name = "subtype")
val rawSubtype: String,
@Json(name = "value")
val rawValue: String
) : PONativeAlternativePaymentCustomerInstruction() {

/** Barcode value. */
val value: POBarcode
get() = POBarcode(
rawType = rawSubtype,
rawValue = rawValue
)
}

/**
* Group of customer instructions.
*
* @param[label] Optional group display label.
* @param[instructions] Grouped instructions for the customer that provide additional information and/or describe required actions.
*/
@JsonClass(generateAdapter = true)
data class Group(
val label: String?,
val instructions: List<PONativeAlternativePaymentCustomerInstruction>
) : PONativeAlternativePaymentCustomerInstruction()

/**
* Placeholder that allows adding additional cases while staying backward compatible.
* __Warning:__ Do not match this case directly, use _when-else_ instead.
*/
@ProcessOutInternalApi
data object Unknown : PONativeAlternativePaymentCustomerInstruction()
}
Loading