Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Co-Badged Cards Example App #1

Merged
merged 50 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
437247f
Add co-badged cards example app
jnewc Dec 7, 2023
8567402
Add gitignore + remove xcuserdata
jnewc Dec 7, 2023
25e3715
Fix issue with pasting client token directly into simulator (thanks B…
jnewc Dec 11, 2023
508d58e
Update project file + fix delegate method sigs
jnewc Jan 3, 2024
361da4d
Add fastlane + github workflow for building example app
jnewc Jan 3, 2024
6760ddd
Add missing platform to bundle lockfile
jnewc Jan 3, 2024
e91db92
Skip fastlane profile mapping
jnewc Jan 3, 2024
7308565
Fix README step
jnewc Jan 3, 2024
0f81b93
Merge remote-tracking branch 'origin/jn/co-badged-cards-example' into…
jnewc Jan 5, 2024
6cc8099
Point at branch for SDK + fix propogation of selected network
jnewc Jan 8, 2024
1c5f623
Fix scheme name in workflow file
jnewc Jan 8, 2024
2dd1e06
Fix scheme name in workflow matrix
jnewc Jan 8, 2024
087bc94
Merge pull request #2 from primer-io/jn/co-badged-cards/workflows
jnewc Jan 8, 2024
a29b76f
Fix selection of card network logic + project layout issue
jnewc Jan 11, 2024
ba098a6
Update with latest changes to feature branch
jnewc Jan 12, 2024
06fdabb
Clear selected index of co-badged card when new models are received
jnewc Jan 23, 2024
2b382f5
Add loading spinner during remote load
jnewc Jan 23, 2024
4da1b60
Remove available card networks control and logic
jnewc Jan 24, 2024
1bc605e
Fix loading + validation reloads + error order
jnewc Jan 24, 2024
57654f7
Change payment button title + error message
jnewc Jan 25, 2024
3198198
Fix state sync issue + fix CB-only not displaying correctly when not …
jnewc Jan 25, 2024
a0628dc
Remove debug print
jnewc Jan 25, 2024
29b4509
chore: update readme
xevious78 Jan 25, 2024
da96708
chore: update readme
xevious78 Jan 25, 2024
1482e90
Republish loading property
jnewc Jan 25, 2024
41c1f94
chore: update readme url
xevious78 Jan 25, 2024
29adcb6
chore: update url
xevious78 Jan 25, 2024
8e1fcf3
chore: update radme
xevious78 Jan 25, 2024
3084425
chore: update readme
xevious78 Jan 25, 2024
bd2b58e
chore: address pr feedback
xevious78 Jan 25, 2024
9251b52
Fix swiftui bug with duplicate binding triggers
jnewc Jan 25, 2024
a72af6a
AMEX and Diners card formatting
jnewc Jan 25, 2024
2326c4b
Minor code cleanup / reorg
jnewc Jan 26, 2024
db727e8
Re-add logic for disabling card button prior to validation pass
jnewc Jan 26, 2024
7fe3d52
Ensure url text field is lower case
jnewc Jan 26, 2024
a222256
Use new methods for setting textfield attributes
jnewc Jan 26, 2024
5ded10d
project file updates
jnewc Jan 31, 2024
d163b8c
pre-selection
jnewc Feb 2, 2024
417a957
Pin action versions
jnewc Feb 2, 2024
42fb5c6
update packages
jnewc Feb 2, 2024
d63e9bd
Add contribution guide
jnewc Feb 2, 2024
b74f8c9
Merge branch 'jn/co-badged-cards-example' into u/at/update-readme
jnewc Feb 2, 2024
7f74580
Merge pull request #3 from primer-io/u/at/update-readme
jnewc Feb 2, 2024
88d4124
add license
jnewc Feb 12, 2024
d4a1843
PR feedback
jnewc Feb 12, 2024
f734a0a
Remove body for client token
jnewc Feb 16, 2024
3774b87
Remove user defaults storage for client token
jnewc Feb 16, 2024
bc6b85b
Update placeholder for client token url
jnewc Feb 16, 2024
090bd03
Switch workflow actions to git refs
jnewc Feb 16, 2024
340b7d1
Switch workflow actions to git refs with full hashes ...
jnewc Feb 16, 2024
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
73 changes: 73 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributing to our repos

At Primer, we believe that endorsing and maintaining open source software is an important step towards building strong bonds with the wider engineering community. We appreciate and actively invite contribution from outside of our organisation.

## Our Standards

We have expectations of our own behaviour and the behaviour of others when interacting with us in our open source repos.

* Use welcoming and inclusive language at all times
* Be empathetic towards others at all times
* Be respectful of differing viewpoints and experiences
* Gracefully accept constructive criticism
* Focus on what is best for the existing members of the community

There are some behaviours and forms of language that we won't tolerate when communicating with us about our software. Again, this applies to both our organisation members and those community members external to it. These include:

* Sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting and/or derogatory comments, and personal or political attacks
* Public or private harassment of individuals or groups
* Publishing others' private information (a.k.a "doxxing"), such as a physical or electronic
address, without explicit permission from the owner
* Any other conduct that is antithetical to reasonable and polite discourse

## Our Commitments

We appreciate contributions of all forms, but we are not obliged to accept them such that we will make changes to our software or repos to accommodate them.

We will always make best efforts to discuss contributions, but are not obliged to provide timelines, contact details, or other information concerning commitments that we may or may not make to the contribution in question.


## Reporting issues

A bug 🐛 is something nobody ever wants to receive. But, they happen 🤷‍♂️.

Please read the following guidelines before you [report an issue](../issues):

1. **Use the GitHub issue search** — check if the issue has already been
reported. If it has been, please comment on the existing issue. If it is closed,
please reference the closed issue in your new issue report.

2. **Check if the issue has been fixed** — the latest `master`/`main` or
development branch may already contain a fix.

3. **Isolate the problem** — make sure that the code in the
project's repository is responsible for the issue. Create a broken-down list of steps or an
extremely simple and immediately viewable example of the issue.

4. **Include a live example** — provide a link, screenshot, video
or anything that could help us understand better the domain.

Other advice for reporting an issue:

* Please try to be as detailed as possible in your report.
* Please include: what steps will reproduce the issue, which browsers, devices and/or OS
you have recreated the issue with.
* Please state what would you expect the outcome to be.

## Pull requests

Good pull requests — patches, improvements, new features — are a fantastic
help. They should remain focused in scope and avoid containing unrelated
commits.

> [!WARNING]
> If your contribution involves a significant amount of work or substantial
> changes to any part of the project, **please open an issue to discuss it first**.

## Thank you 🙏

👉 from all of the team at Primer ❤️

You are helping us making our product better 👌, faster 🚀, stronger 💪
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Example Apps

on:
pull_request:
types:
- opened
- edited
- synchronize

jobs:
build:
name: "Build Example App"
runs-on: macos-13
strategy:
max-parallel: 2
matrix:
project: [
{ scheme: 'Co-Badged Cards Example', path: 'Co-Badged Cards/SwiftUI/Co-Badged Cards Example.xcodeproj' }
]
steps:
- name: Cancel previous jobs
uses: styfle/[email protected]
jnewc marked this conversation as resolved.
Show resolved Hide resolved
with:
access_token: ${{ github.token }}
- name: Git - Checkout
uses: actions/[email protected]
with:
ref: ${{ github.ref }}
- name: Select Xcode Version
uses: maxim-lobanov/[email protected]
with:
xcode-version: '15.0'
- uses: ruby/[email protected]
with:
ruby-version: "3.2"
bundler-cache: true
- name: Build with fastlane
run: |
bundle exec fastlane ios build_example_app "scheme:${{ matrix.project.scheme }}" "project_path:${{ matrix.project.path }}"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
xcuserdata
fastlane/README.md
fastlane/report.xml
75 changes: 75 additions & 0 deletions Co-Badged Cards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 💳 Co-Badged Cards Example

This example demonstrates how to integrate support for co-badged cards in your iOS app.

## Getting Started

To run the example app:

1. Clone the repo:

```sh
git clone https://github.com/primer-io/checkout-examples-ios.git
```

2. Change directory into the repo

```sh
cd "checkout-examples-ios/Co-Badged Cards/SwiftUI"
```

3. Open the project

```sh
open "Co-Badged Cards Example.xcodeproj"
```

4. Run the project from Xcode 🚀

----

This project requires a server to communicate with Primer's API. To get started quickly, we encourage you to use the [companion backend](https://github.com/primer-io/example-backend).

## Trying it out

This example app allows you to:

- Generate a client token
- Make a payment using a card
- Select a co-badged network when making a payment with a co-badged card

We support several test cards for different test cases, which you can find in our docs:

📄 **[Primer Payments Testing](https://primer.io/docs/payments/testing)**

## Understanding the integration

### PrimerDataService

This class contains all the business logic required to interact with the Primer SDK and start making payments.

This includes:
* SDK ininitialisation
* Handling of card validation via `PrimerHeadlessUniversalCheckoutRawDataManagerDelegate`
* Handling of payment submission via `PrimerHeadlessUniversalCheckoutDelegate`

This class is intended to be a `kitchen sink` that shows the whole integration in one place. You can use it to bootstrap your own integration.

### PrimerCardDataModel & PrimerCardDataErrorsModel

These models are used to reflect changes to user inputs via `CardDetailsFormView`.

The former is updated with user inputs as they are entered in to the form.
The latter is updated with validation errors that are displayed in the form during entry.

### ExampleApp

This class contains two static properties that are used to auto-fill settings. You can get a head start by providing a client token or a URL for an endpoint serving client tokens directly in the code.

If you don't provide these, you can provide them on the app's start page once it's launched.

### ExampleAppLogger

This is a logger used to print useful messages during app execution.

You can find these logs by filtering on `[Co-Badged Cards Example App]` in the Xcode debug console.
Loading
Loading